Commit ce4c81ca authored by PizZaKatZe's avatar PizZaKatZe
Browse files

New command line option: Add draft watermark

parent 228654e9
......@@ -40,6 +40,8 @@ def parse_arguments(args):
parser.add_argument('-p', '--print',
help='print filtered data of session with index PRINT, starting at 1; '
'0 prints all sessions')
parser.add_argument('-r', '--draft', action='store_true',
help='add draft watermark')
parser.add_argument('-t', '--tex', action='store_true',
help='print tex document to stdout')
parser.add_argument('output', nargs='?',
......@@ -81,7 +83,7 @@ def main():
end = int(args.print)
pretty_print(sessions[0 : end if end else None])
tex = generate_tex(sessions, args.homepage, args.links)
tex = generate_tex(sessions, args.homepage, args.links, args.draft)
if args.tex:
flyer = render(tex)
......@@ -40,13 +40,14 @@ def fetch_data(url: str) -> List[Dict]:
results: Dict = load(urlopen(url))['results']
return list(results.values())
def generate_tex(sessions: List[Dict], homeurl: str, links=True) -> str:
def generate_tex(sessions: List[Dict], homeurl: str, links=True, draft=False) -> str:
"""Generates a LaTeX document from self-organized session data.
sessions: processed self-organized session data
homeurl: URL of JHT homepage
links: if set, QR codes with links to session wiki page are generated
draft: if set, adds a draft watermark
a LaTeX document
......@@ -54,7 +55,11 @@ def generate_tex(sessions: List[Dict], homeurl: str, links=True) -> str:
libpath = dirname(__file__)
env = make_env(loader=FileSystemLoader(libpath))
template = env.get_template('template.tex')
tex = template.render(libpath=libpath, sessions=sessions, homeurl=homeurl, links=links)
tex = template.render(libpath=libpath,
return tex
def process_sessions(sessions: List[Dict], day: int) -> List[Dict]:
......@@ -9,6 +9,13 @@
%- if draft
%- endif
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