Verified Commit 194e1587 authored by Jakob Moser's avatar Jakob Moser
Browse files

Set language and add heading to title script

parent 9150d896
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[project]
name = "coliverter"
version = "0.2.0"
version = "0.2.1"
authors = [
  { name="Jakob Moser", email="moser@cl.uni-heidelberg.de" },
]
+13 −0
Original line number Diff line number Diff line
-- From https://stackoverflow.com/a/76048743/, by johndoe (https://stackoverflow.com/users/2520247/johndoe), CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
local title
function Header(el)
  if title then return end
  title = pandoc.utils.stringify(el)
end

function Meta(el)
  if not el.pagetitle then
    el.pagetitle = title
    return el
  end
end
+11 −0
Original line number Diff line number Diff line
import importlib.resources as resources

import subprocess
from pathlib import Path


def _get_filter(name: str) -> Path:
    with resources.path("coliverter.resources", f"pandoc-{name}.lua") as path:
        return path


PANDOC_EXECUTABLE = "pandoc"
ACTIVE_MARKDOWN_EXTENSIONS = ("autolink_bare_uris", "emoji", "task_lists")
@@ -9,6 +18,8 @@ PANDOC_OPTIONS = (
    "--wrap=none",
    "--standalone",
    "--css=https://fachschaft.cl.uni-heidelberg.de/wp-content/themes/fscoli-next-master/typography.css",
    "--variable=lang=de",
    f"--lua-filter={_get_filter('heading-to-title')}",
)