diff --git a/README.md b/README.md index 727dc053..008be4cf 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,6 @@ env CHROME_BINARY=google-chrome-stable RESOLUTION=1440,900 FETCH_PDF=False ./arc To tweak the outputted html index file's look and feel, just copy the files in `templates/` somewhere else and edit away. Use the two index config variables above to point the script to your new custom template files. -The templates use format strings (not a proper templating engine like jinja2), which is why the CSS is double-bracketed `{{...}}`. - ## Publishing Your Archive The archive produced by `./archive.py` is suitable for serving on any provider that diff --git a/index.py b/index.py index d8a5910a..ab80a70b 100644 --- a/index.py +++ b/index.py @@ -1,5 +1,6 @@ import os from datetime import datetime +from string import Template from config import INDEX_TEMPLATE, INDEX_ROW_TEMPLATE from parse import derived_link_info @@ -16,7 +17,7 @@ def dump_index(links, service): link_html = f.read() article_rows = '\n'.join( - link_html.format(**derived_link_info(link)) for link in links + Template(link_html).substitute(**derived_link_info(link)) for link in links ) template_vars = { @@ -27,4 +28,4 @@ def dump_index(links, service): } with open(os.path.join(service, 'index.html'), 'w', encoding='utf-8') as f: - f.write(index_html.format(**template_vars)) + f.write(Template(index_html).substitute(template_vars)) diff --git a/templates/index.html b/templates/index.html index f6287e5d..c33dc5ca 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,7 +3,7 @@