Skip to content

Commit

Permalink
use double minus signs for negative values, selectable pdf engine
Browse files Browse the repository at this point in the history
  • Loading branch information
cbroschinski committed Oct 16, 2024
1 parent c649a8d commit 99a67ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/generate_apc_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"given institution. Useful if time is short or there's no internet " +
"connection."),
"csv_output": ('Write the APC deviation data to a CSV file ("report.csv") in addition to regular ' +
'report generation')
'report generation'),
"pdf_engine": 'Set the engine used by pandoc (--pdf-engine) to generate the report PDF. Default: xelatex'
}

with open("report/strings.json") as f:
Expand All @@ -50,6 +51,7 @@ def parse():
parser = argparse.ArgumentParser()
parser.add_argument("institution", help=ARG_HELP_STRINGS["institution"])
parser.add_argument("lang", help=ARG_HELP_STRINGS["lang"], choices=LANG.keys())
parser.add_argument("-p", "--pdf-engine", help=ARG_HELP_STRINGS["pdf_engine"], default="xelatex")
parser.add_argument("-v", "--verbose", help=ARG_HELP_STRINGS["verbose"], action="store_true")
parser.add_argument("-d", "--no-doi-resolve-test", help=ARG_HELP_STRINGS["no_doi_resolve_test"],
action="store_true")
Expand Down Expand Up @@ -234,6 +236,8 @@ def generate_apc_deviaton_section(institution, articles, stats, lang, csv_output
elem = "[Link](" + article[16] + ")"
if index in [2, 18, 19, 20]: # monetary
elem = elem + "€"
if elem.startswith("-"):
elem = "-" + elem
row += elem + "|"
row += "\n"
md_content += row
Expand Down Expand Up @@ -342,7 +346,7 @@ def main():
file_name = "report_" + ins + "_" + today + ".pdf"
with open("report.md", "w") as out:
out.write(report)
run(["pandoc", "report.md", "-f", "markdown", "-o", file_name, "--pdf-engine=xelatex"])
run(["pandoc", "report.md", "-f", "markdown", "-o", file_name, "--pdf-engine=" + args.pdf_engine])


if __name__ == '__main__':
Expand Down

0 comments on commit 99a67ab

Please sign in to comment.