Commit 28215afa authored by PizZaKatZe's avatar PizZaKatZe

Add JHT homepage URL to template

parent 47535504
......@@ -32,6 +32,8 @@ def parse_arguments(args):
parser = ArgumentParser()
parser.add_argument('-l', '--links', action='store_true',
help='generate QR codes with links to sessions\'s wiki pages')
parser.add_argument('-m', '--homepage',
help='JHT homepage URL')
parser.add_argument('-p', '--print', action='store_true',
help='print filtered data of session with index PRINT, starting at 1; ' +
'0 prints all sessions')
......@@ -67,7 +69,7 @@ def main():
end = int(args.print)
pretty_print(sessions[0 : end if end else -1])
flyer = generate_flyer(sessions, args.links)
flyer = generate_flyer(sessions, args.homepage, args.links)
if args.output:
with open(args.output, 'wb') as output:
output.write(flyer)
......
......@@ -40,12 +40,12 @@ def fetch_data(url: str) -> List[Dict]:
results: Dict = load(urlopen(url))['results']
return list(results.values())
def generate_flyer(sessions: List[Dict], links=True) -> bytes:
def generate_flyer(sessions: List[Dict], homeurl: str, links=True) -> bytes:
"""Generates a PDF from self-organized session data.
"""
env = make_env(loader=FileSystemLoader(dirname(__file__)))
template = env.get_template('template.tex')
pdf = build_pdf(template.render(sessions=sessions, links=links))
pdf = build_pdf(template.render(sessions=sessions, homeurl=homeurl, links=links))
return pdf.__bytes__()
def process_sessions(sessions: List[Dict]) -> List[Dict]:
......
......@@ -22,6 +22,7 @@
\begin{document}
\maketitle
\thispagestyle{empty}
%- if links
\begin{longtable}{|l|p{0.45\linewidth}|p{0.2\linewidth}|l|}
......@@ -47,5 +48,9 @@
\end{longtable}
%- endif
%- if homeurl
\vfill
Weitere Informationen: \qquad \url{\VAR{homeurl}} \hfill \qrcode{\VAR{homeurl}}
%- endif
\end{document}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment