beejournal/pandoc.py

16 lines
538 B
Python
Raw Permalink Normal View History

2022-02-27 22:31:07 +00:00
import glob
2022-02-28 23:07:09 +00:00
from pathlib import Path
2022-02-27 22:31:07 +00:00
import subprocess
specials = ["footer", "todo"]
for filename in specials:
2022-02-28 23:07:09 +00:00
with open(filename+".html", "w") as outfile:
subprocess.run(["pandoc", f"{filename}.md"], stdout=outfile)
2022-02-27 22:31:07 +00:00
for filename in glob.glob("*.md"):
2022-02-28 23:07:09 +00:00
filename = Path(filename).stem
2022-02-27 22:31:07 +00:00
if filename in specials:
continue
2022-02-28 23:07:09 +00:00
with open(filename+".html", "w") as outfile:
subprocess.run(["pandoc", "--toc", "--css=github-pandoc.css", "-A", "footer.html", "--standalone", f"{filename}.md"], stdout=outfile)