From 42fab8667c5d50639b4feeed86034174aae488b4 Mon Sep 17 00:00:00 2001 From: fornib Date: Mon, 26 Mar 2018 10:15:02 +0200 Subject: [PATCH] Template update --- EnCAB/EnCAB.py | 9 ++++- EnCAB/templates/algorithm.html | 14 +++---- docs/algorithms/algorithm_bibliography.html | 12 +++--- docs/algorithms/algorithm_materials.html | 24 ++++++------ .../algorithm_position_in_process.html | 24 ++++++------ docs/algorithms/algorithm_type.html | 36 +++++++++--------- .../- current Error Log.txt.lnk | Bin 0 -> 1159 bytes 7 files changed, 62 insertions(+), 57 deletions(-) create mode 100644 docs/algorithms_data/- current Error Log.txt.lnk diff --git a/EnCAB/EnCAB.py b/EnCAB/EnCAB.py index 2a291a6..3b8158d 100644 --- a/EnCAB/EnCAB.py +++ b/EnCAB/EnCAB.py @@ -298,8 +298,13 @@ def generate_html(template, blocks_data, sort): """ Sort and render the data with templates """ path, filename = os.path.split(template) - return jinja2.Environment(loader=jinja2.FileSystemLoader(path or '.'))\ - .get_template(filename).render(blocks_data=blocks_data, sort=sort)#{% set old_sort = '' %} + env = jinja2.Environment(loader=jinja2.FileSystemLoader(path or '.')) + + def capfirst(text): + return ' '.join(s[:1].upper() + s[1:] for s in text.split(' ')) + env.filters['capfirst'] = capfirst + + return env.get_template(filename).render(blocks_data=blocks_data, sort=sort) def check_config(): diff --git a/EnCAB/templates/algorithm.html b/EnCAB/templates/algorithm.html index 67e6501..d3e4c0d 100644 --- a/EnCAB/templates/algorithm.html +++ b/EnCAB/templates/algorithm.html @@ -2,7 +2,7 @@ {#- --- INDEX --- #} {%- set ns = namespace(new_sort = '') %} {% for b, filename in blocks_data -%}{% if b.find(sort).text.lower() != ns.new_sort.lower() %}{% set ns.new_sort = b.find(sort).text %} -{% if ns.new_sort %}{% if not loop.first %} - {% endif %}{{ ns.new_sort|replace('_',' ') }}{% endif %} +{% if ns.new_sort %}{% if not loop.first %} - {% endif %}{{ ns.new_sort|replace('_',' ')|capfirst }}{% endif %} {%- endif %}{% endfor %} {% set ns.new_sort = '' %} @@ -52,16 +52,16 @@ {%- if b.find('biblioref/pagenums2').text %}, {{ b.find('biblioref/pagenums').text }}{% endif %} - Algorithm type:{% if b.find('algorithm_description/algorithm_type').text %}{{ b.find('algorithm_description/algorithm_type').text|title }}{% endif %} - Position in process:{% if b.find('algorithm_description/position_in_process').text %}{{ b.find('algorithm_description/position_in_process').text|title }}{% endif %} + Algorithm type:{% if b.find('algorithm_description/algorithm_type').text %}{{ b.find('algorithm_description/algorithm_type').text|capfirst }}{% endif %} + Position in process:{% if b.find('algorithm_description/position_in_process').text %}{{ b.find('algorithm_description/position_in_process').text|capfirst }}{% endif %} - Material:{% if b.find('algorithm_description/material').text %}{{ b.find('algorithm_description/material').text|title }}{% endif %} - Source type:{% if b.find('algorithm_description/source_type').text %}{{ b.find('algorithm_description/source_type').text|title }}{% endif %} + Material:{% if b.find('algorithm_description/material').text %}{{ b.find('algorithm_description/material').text|capfirst }}{% endif %} + Source type:{% if b.find('algorithm_description/source_type').text %}{{ b.find('algorithm_description/source_type').text|capfirst }}{% endif %} - Source chronology:{% if b.find('algorithm_description/source_chronology').text %}{{ b.find('algorithm_description/source_chronology').text }}{% endif %} - Source geography:{% if b.find('algorithm_description/source_geography').text %}{{ b.find('algorithm_description/source_geography').text }}{% endif %} + Source chronology:{% if b.find('algorithm_description/source_chronology').text %}{{ b.find('algorithm_description/source_chronology').text|capfirst }}{% endif %} + Source geography:{% if b.find('algorithm_description/source_geography').text %}{{ b.find('algorithm_description/source_geography').text|capfirst }}{% endif %} Notes:{{ b.find('algnotes/general_notes').text or '' }} diff --git a/docs/algorithms/algorithm_bibliography.html b/docs/algorithms/algorithm_bibliography.html index b5fb29d..23f0ec1 100644 --- a/docs/algorithms/algorithm_bibliography.html +++ b/docs/algorithms/algorithm_bibliography.html @@ -883,7 +883,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -940,7 +940,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -1054,7 +1054,7 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -1271,8 +1271,8 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern - Source geography:europe + Source chronology:Modern + Source geography:Europe Notes:The values in this algorithm are a bit unclear - first, the number of hours in a work day is not stated, and then the width of the wall is also not known. The wall being built is free standing, and thus tapers towards the top, which would not be the case in the construction of a building. @@ -1448,7 +1448,7 @@

Algorithms:

Source type:Text - Source chronology:bronze age + Source chronology:Bronze Age Source geography:ANE diff --git a/docs/algorithms/algorithm_materials.html b/docs/algorithms/algorithm_materials.html index 6f5beb3..70c4285 100644 --- a/docs/algorithms/algorithm_materials.html +++ b/docs/algorithms/algorithm_materials.html @@ -18,12 +18,12 @@

Algorithms by Bibliography

Algorithms:

-earth - - mortar - - mudbrick - - pise' - - plaster - - stone +Earth + - Mortar + - Mudbrick + - Pise' + - Plaster + - Stone


@@ -196,7 +196,7 @@

Algorithms:

Source type:Text - Source chronology:bronze age + Source chronology:Bronze Age Source geography:ANE @@ -259,7 +259,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -373,7 +373,7 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -658,7 +658,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -1491,8 +1491,8 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern - Source geography:europe + Source chronology:Modern + Source geography:Europe Notes:The values in this algorithm are a bit unclear - first, the number of hours in a work day is not stated, and then the width of the wall is also not known. The wall being built is free standing, and thus tapers towards the top, which would not be the case in the construction of a building. diff --git a/docs/algorithms/algorithm_position_in_process.html b/docs/algorithms/algorithm_position_in_process.html index a98d929..b559e0a 100644 --- a/docs/algorithms/algorithm_position_in_process.html +++ b/docs/algorithms/algorithm_position_in_process.html @@ -19,12 +19,12 @@

Algorithms by Step in Process

Algorithms:

-construction - - manufacture - - materials - - procurement - - tools - - transport +Construction + - Manufacture + - Materials + - Procurement + - Tools + - Transport


@@ -122,7 +122,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -179,8 +179,8 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern - Source geography:europe + Source chronology:Modern + Source geography:Europe Notes:The values in this algorithm are a bit unclear - first, the number of hours in a work day is not stated, and then the width of the wall is also not known. The wall being built is free standing, and thus tapers towards the top, which would not be the case in the construction of a building. @@ -242,7 +242,7 @@

Algorithms:

Source type:Text - Source chronology:bronze age + Source chronology:Bronze Age Source geography:ANE @@ -476,7 +476,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -590,7 +590,7 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern + Source chronology:Modern Source geography:ANE diff --git a/docs/algorithms/algorithm_type.html b/docs/algorithms/algorithm_type.html index d18f9ce..28689a0 100644 --- a/docs/algorithms/algorithm_type.html +++ b/docs/algorithms/algorithm_type.html @@ -19,18 +19,18 @@

Algorithms by Type

Algorithms:

-building cobbles - - cut masonry blocks - - earth digging - - material qualities - - mudbrick - - plaster production - - quarrying cobbles - - quarrying tuff - - sculpturing - - tools - - transport - - wall building +Building Cobbles + - Cut Masonry Blocks + - Earth Digging + - Material Qualities + - Mudbrick + - Plaster Production + - Quarrying Cobbles + - Quarrying Tuff + - Sculpturing + - Tools + - Transport + - Wall Building


@@ -362,7 +362,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -476,7 +476,7 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -767,7 +767,7 @@

Algorithms:

Source type:Text - Source chronology:bronze age + Source chronology:Bronze Age Source geography:ANE @@ -1441,7 +1441,7 @@

Algorithms:

Source type:Experimental Archaeology - Source chronology:modern + Source chronology:Modern Source geography:ANE @@ -1498,8 +1498,8 @@

Algorithms:

Source type:Ethnographic - Source chronology:modern - Source geography:europe + Source chronology:Modern + Source geography:Europe Notes:The values in this algorithm are a bit unclear - first, the number of hours in a work day is not stated, and then the width of the wall is also not known. The wall being built is free standing, and thus tapers towards the top, which would not be the case in the construction of a building. diff --git a/docs/algorithms_data/- current Error Log.txt.lnk b/docs/algorithms_data/- current Error Log.txt.lnk new file mode 100644 index 0000000000000000000000000000000000000000..fb1baf4a989ccd4e93dd423924820432b7f3ab50 GIT binary patch literal 1159 zcmeZaU|?VrVFHp23`R83qM35BZPvJ_DmuS z@&OP0FDSgS$`n|1gM&faz+kQ3|tX{5yD^y=H&QnE)ryLcPYv&OJ!iNW8h?9 zVR*lf*Y$A-NJbB+ro)~CNTOS(b)S>Loxz2nh#`}qi~*>XL5v{{YG#tpr(^+!I9ESs zN2fZVHGWW2yFH70L2@8d+e_Jiq#zI@gSDD03~>yu40#OB42}#=z<>w<+K|tX1+*cV zp#-Q@f*}EJ3r~;$gS%&lN2pVs5d(t<)RxKKsi8?eJV78^^5%kUf%p_*&&A*TK(}WC z>R=Wk>?r5(G5A0B8@$`~Y~!%nTD?aLogHg24uEc5Y~n&&)88**o|^;UbDK7R(a5 z#ERs81_lu%^DHsUOY%t#%<-`Vn|J&iC^R_H%$u2X8_m2h1|tSgBFOPE_EKQT$xqiS zsVHG^fVvQ3qOljqg?~440ZB(R6R#+6FysLJn$DmH41o%8sEPsA6alde5QAbGL|Xtc z2owS_h|dhf6AlR42mtBu%)FHR@?wj4|6m4S`hp~%m^g4?DFhVdXQd{W#JFdcc$6k7 z1f>?_$AD#^B+SV`8(9!(@$^flKbrRwJ>abErZ$%!N&g#hmP?DA0Q+TG6Mhw*XH5? literal 0 HcmV?d00001