diff --git a/publish.py b/publish.py index ce11b80e..388c6fd9 100755 --- a/publish.py +++ b/publish.py @@ -1,8 +1,10 @@ #!/usr/bin/python3 import os, sys -HEADER = """ - +HEADER_START = """ + + + @@ -32,12 +34,18 @@ .math { font-family: MJXc-TeX-math-Iw } +""" +HEADER_END = """ + +
""" -FOOTER = """
""" +FOOTER = """ + + """ TOC_HEADER = """ @@ -138,8 +146,10 @@ def make_toc_item(metadata): os.system('pandoc -o /tmp/temp_output.html {} {}'.format(file_location, options)) total_file_contents = ( - HEADER + + HEADER_START + + '{}\n'.format(metadata['title']) + make_twitter_card(metadata, global_config) + + HEADER_END + defancify(open('/tmp/temp_output.html').read()) + FOOTER ) @@ -157,11 +167,14 @@ def make_toc_item(metadata): toc_items = [make_toc_item(metadata) for metadata in sorted_metadatas] toc = ( - HEADER + + HEADER_START + + '{}\n'.format(global_config['title']) + make_twitter_card(global_config, global_config) + + HEADER_END + TOC_HEADER.format(global_config['title']) + ''.join(toc_items) + - TOC_FOOTER + TOC_FOOTER + + FOOTER ) open('site/index.html', 'w').write(toc)