Skip to content

Commit

Permalink
Add option to modify <footer> of every page in settings.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Apr 24, 2021
1 parent 6ccf99e commit 140701b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def run():
settings.zulip_icon_url,
repo_root,
settings.page_head_html,
settings.page_footer_html,
)

if __name__ == '__main__':
Expand Down
5 changes: 5 additions & 0 deletions default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
'''
page_head_html = '<html>\n<head><meta charset="utf-8"><title>Zulip Chat Archive</title></head>\n'

'''
This is where you modify the <footer> section of every page.
'''
page_footer_html = '\n</html>'


'''
You may only want to include certain streams. In `streams.yaml`
Expand Down
17 changes: 10 additions & 7 deletions lib/jekyll.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
)


def build_website(json_root, md_root, site_url, html_root, title, zulip_url, zulip_icon_url, repo_root, page_head_html):
def build_website(json_root, md_root, site_url, html_root, title, zulip_url, zulip_icon_url, repo_root, page_head_html, page_footer_html):
stream_info = read_zulip_stream_info(json_root)

streams = stream_info['streams']
date_footer = last_updated_footer_html(stream_info)
write_main_page(md_root, site_url, html_root, title, streams, date_footer, page_head_html)
write_main_page(md_root, site_url, html_root, title, streams, date_footer, page_head_html, page_footer_html)
write_css(md_root)

for stream_name in streams:
Expand All @@ -67,6 +67,7 @@ def build_website(json_root, md_root, site_url, html_root, title, zulip_url, zul
stream_data,
date_footer,
page_head_html,
page_footer_html
)

for topic_name in topic_data:
Expand All @@ -83,6 +84,7 @@ def build_website(json_root, md_root, site_url, html_root, title, zulip_url, zul
topic_name,
date_footer,
page_head_html,
page_footer_html
)

# Copy the entire content of <repo_root>/assets into md_root.
Expand All @@ -96,7 +98,7 @@ def build_website(json_root, md_root, site_url, html_root, title, zulip_url, zul

# writes the index page listing all streams.
# `streams`: a dict mapping stream names to stream json objects as described in the header.
def write_main_page(md_root, site_url, html_root, title, streams, date_footer, page_head_html):
def write_main_page(md_root, site_url, html_root, title, streams, date_footer, page_head_html, page_footer_html):
'''
The main page in our website lists streams:
Expand All @@ -112,10 +114,10 @@ def write_main_page(md_root, site_url, html_root, title, streams, date_footer, p
outfile.write(page_head_html)
outfile.write(content)
outfile.write(date_footer)
outfile.write('\n</html>')
outfile.write(page_footer_html)
outfile.close()

def write_stream_topics(md_root, site_url, html_root, title, stream_name, stream, date_footer, page_head_html):
def write_stream_topics(md_root, site_url, html_root, title, stream_name, stream, date_footer, page_head_html, page_footer_html):
'''
A stream page lists all topics for the stream:
Expand All @@ -138,7 +140,7 @@ def write_stream_topics(md_root, site_url, html_root, title, stream_name, stream
outfile.write(page_head_html)
outfile.write(content)
outfile.write(date_footer)
outfile.write('\n</html>')
outfile.write(page_footer_html)
outfile.close()

def write_topic_messages(
Expand All @@ -154,6 +156,7 @@ def write_topic_messages(
topic_name,
date_footer,
page_head_html,
page_footer_html,
):
'''
Writes the topics page, which lists all messages
Expand Down Expand Up @@ -214,7 +217,7 @@ def write_topic_messages(
outfile.write('\n\n')

outfile.write(date_footer)
outfile.write('\n</html>')
outfile.write(page_footer_html)
outfile.close()

def write_css(md_root):
Expand Down

0 comments on commit 140701b

Please sign in to comment.