Skip to content

Commit

Permalink
Merge pull request #14 from fabfab1/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Forni B authored Mar 26, 2018
2 parents 0c60c38 + 42fab86 commit 13ec91b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 57 deletions.
9 changes: 7 additions & 2 deletions EnCAB/EnCAB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
14 changes: 7 additions & 7 deletions EnCAB/templates/algorithm.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}<a href="#{{ ns.new_sort.lower() }}">{{ ns.new_sort|replace('_','&nbsp;') }}</a>{% endif %}
{% if ns.new_sort %}{% if not loop.first %} - {% endif %}<a href="#{{ ns.new_sort.lower() }}">{{ ns.new_sort|replace('_','&nbsp;')|capfirst }}</a>{% endif %}
{%- endif %}{% endfor %}
{% set ns.new_sort = '' %}

Expand Down Expand Up @@ -52,16 +52,16 @@
{%- if b.find('biblioref/pagenums2').text %}, {{ b.find('biblioref/pagenums').text }}{% endif %}</td>
</tr>
<tr>
<td>Algorithm type:</td><td>{% if b.find('algorithm_description/algorithm_type').text %}<a href="../algorithm_type/{{b.find('algorithm_description/algorithm_type').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/algorithm_type').text|title }}</a>{% endif %}</td>
<td>Position in process:</td><td>{% if b.find('algorithm_description/position_in_process').text %}<a href="../position_in_process/{{b.find('algorithm_description/position_in_process').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/position_in_process').text|title }}</a>{% endif %}</td>
<td>Algorithm type:</td><td>{% if b.find('algorithm_description/algorithm_type').text %}<a href="../algorithm_type/{{b.find('algorithm_description/algorithm_type').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/algorithm_type').text|capfirst }}</a>{% endif %}</td>
<td>Position in process:</td><td>{% if b.find('algorithm_description/position_in_process').text %}<a href="../position_in_process/{{b.find('algorithm_description/position_in_process').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/position_in_process').text|capfirst }}</a>{% endif %}</td>
</tr>
<tr>
<td>Material:</td><td>{% if b.find('algorithm_description/material').text %}<a href="../material/{{b.find('algorithm_description/material').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/material').text|title }}</a>{% endif %}</td>
<td>Source type:</td><td>{% if b.find('algorithm_description/source_type').text %}<a href="../source_type/{{b.find('algorithm_description/source_type').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_type').text|title }}</a>{% endif %}</td>
<td>Material:</td><td>{% if b.find('algorithm_description/material').text %}<a href="../material/{{b.find('algorithm_description/material').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/material').text|capfirst }}</a>{% endif %}</td>
<td>Source type:</td><td>{% if b.find('algorithm_description/source_type').text %}<a href="../source_type/{{b.find('algorithm_description/source_type').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_type').text|capfirst }}</a>{% endif %}</td>
</tr>
<tr>
<td>Source chronology:</td><td>{% if b.find('algorithm_description/source_chronology').text %}<a href="../source_chronology/{{b.find('algorithm_description/source_chronology').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_chronology').text }}</a>{% endif %}</td>
<td>Source geography:</td><td>{% if b.find('algorithm_description/source_geography').text %}<a href="../source_geography/{{b.find('algorithm_description/source_geography').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_geography').text }}</a>{% endif %}</td>
<td>Source chronology:</td><td>{% if b.find('algorithm_description/source_chronology').text %}<a href="../source_chronology/{{b.find('algorithm_description/source_chronology').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_chronology').text|capfirst }}</a>{% endif %}</td>
<td>Source geography:</td><td>{% if b.find('algorithm_description/source_geography').text %}<a href="../source_geography/{{b.find('algorithm_description/source_geography').text|replace(' ','_')|lower}}.html">{{ b.find('algorithm_description/source_geography').text|capfirst }}</a>{% endif %}</td>
</tr>
<tr>
<td>Notes:</td><td colspan="3">{{ b.find('algnotes/general_notes').text or '' }}</td>
Expand Down
12 changes: 6 additions & 6 deletions docs/algorithms/algorithm_bibliography.html
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -940,7 +940,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -1054,7 +1054,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -1271,8 +1271,8 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">europe</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">Europe</a></td>
</tr>
<tr>
<td>Notes:</td><td colspan="3">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.</td>
Expand Down Expand Up @@ -1448,7 +1448,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/text.html">Text</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">bronze age</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">Bronze Age</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down
24 changes: 12 additions & 12 deletions docs/algorithms/algorithm_materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ <h4><a name="Position in Process">Algorithms by Bibliography</a></h4>
<h4> Algorithms: </h4>
<section block="algorithm" sort="material">

<a href="#earth">earth</a>
- <a href="#mortar">mortar</a>
- <a href="#mudbrick">mudbrick</a>
- <a href="#pise'">pise'</a>
- <a href="#plaster">plaster</a>
- <a href="#stone">stone</a>
<a href="#earth">Earth</a>
- <a href="#mortar">Mortar</a>
- <a href="#mudbrick">Mudbrick</a>
- <a href="#pise'">Pise'</a>
- <a href="#plaster">Plaster</a>
- <a href="#stone">Stone</a>


<br><br><br>
Expand Down Expand Up @@ -196,7 +196,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/text.html">Text</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">bronze age</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">Bronze Age</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -259,7 +259,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -373,7 +373,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -658,7 +658,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -1491,8 +1491,8 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">europe</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">Europe</a></td>
</tr>
<tr>
<td>Notes:</td><td colspan="3">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.</td>
Expand Down
24 changes: 12 additions & 12 deletions docs/algorithms/algorithm_position_in_process.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ <h4><a name="Position in Process">Algorithms by Step in Process</a></h4>
<h4> Algorithms: </h4>
<section block="algorithm" sort="position_in_process">

<a href="#construction">construction</a>
- <a href="#manufacture">manufacture</a>
- <a href="#materials">materials</a>
- <a href="#procurement">procurement</a>
- <a href="#tools">tools</a>
- <a href="#transport">transport</a>
<a href="#construction">Construction</a>
- <a href="#manufacture">Manufacture</a>
- <a href="#materials">Materials</a>
- <a href="#procurement">Procurement</a>
- <a href="#tools">Tools</a>
- <a href="#transport">Transport</a>


<br><br><br>
Expand Down Expand Up @@ -122,7 +122,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -179,8 +179,8 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">europe</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">Europe</a></td>
</tr>
<tr>
<td>Notes:</td><td colspan="3">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.</td>
Expand Down Expand Up @@ -242,7 +242,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/text.html">Text</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">bronze age</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">Bronze Age</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -476,7 +476,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -590,7 +590,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down
36 changes: 18 additions & 18 deletions docs/algorithms/algorithm_type.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ <h4><a name="Position in Process">Algorithms by Type</a></h4>
<h4> Algorithms: </h4>
<section block="algorithm" sort="algorithm_type">

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


<br><br><br>
Expand Down Expand Up @@ -362,7 +362,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -476,7 +476,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -767,7 +767,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/text.html">Text</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">bronze age</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/bronze_age.html">Bronze Age</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -1441,7 +1441,7 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/experimental_archaeology.html">Experimental Archaeology</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/ane.html">ANE</a></td>
</tr>
<tr>
Expand Down Expand Up @@ -1498,8 +1498,8 @@ <h4> Algorithms: </h4>
<td>Source type:</td><td><a href="../source_type/ethnographic.html">Ethnographic</a></td>
</tr>
<tr>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">europe</a></td>
<td>Source chronology:</td><td><a href="../source_chronology/modern.html">Modern</a></td>
<td>Source geography:</td><td><a href="../source_geography/europe.html">Europe</a></td>
</tr>
<tr>
<td>Notes:</td><td colspan="3">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.</td>
Expand Down
Binary file added docs/algorithms_data/- current Error Log.txt.lnk
Binary file not shown.

0 comments on commit 13ec91b

Please sign in to comment.