From 776e564a1a8f71672abf6fb0e696ba5a6a05d2e2 Mon Sep 17 00:00:00 2001 From: raute Date: Tue, 7 May 2024 23:39:36 +0200 Subject: [PATCH] Don't use Pandoc, wiki can do Markdown now. --- llplenum | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/llplenum b/llplenum index 9f1546c..76f7eec 100755 --- a/llplenum +++ b/llplenum @@ -14,9 +14,8 @@ months = ["", clipboard = subprocess.check_output(["xclip", "-out", "-selection", "clipboard"]).decode() -m = re.match( - r"# ([0-9][0-9]+)\. Plenum .+ ([0-9]{1,2})\. (" + "|".join(months[1:]) + ") (20[0-9]{2})", - clipboard) +m = re.match(r"# ([0-9][0-9]+)\. Plenum .+ ([0-9]{1,2})\. (" + "|".join(months[1:]) + ") (20[0-9]{2})", + clipboard) if not m: print("Error: Überschrift nicht erkannt.", file=sys.stderr) sys.exit(1) @@ -44,19 +43,14 @@ if month_later == 13: month_name = month_name.lower() earlier = "verein:plenum:{}_{}_{}".format(str(num - 1).rjust(3, "0"), - months[month_earlier].lower(), + months[month_earlier].lower().replace("ä", "ae"), year_earlier) later = "verein:plenum:{}_{}_{}".format(str(num + 1).rjust(3, "0"), - months[month_later].lower(), + months[month_later].lower().replace("ä", "ae"), year_later) -links = "[⇐ vorheriges Plenum]({}) | [nächstes Plenum ⇒]({})".format(earlier, - later) - +links = "[⇐ vorheriges Plenum]({}) | [nächstes Plenum ⇒]({})".format(earlier, later) markdown = "{}\n\n{}".format(links, clipboard) -pandoc_output = subprocess.check_output(["pandoc", "-f", "markdown", "-t", "dokuwiki"], - input=markdown.encode()).decode() -replaced = pandoc_output.replace("[x]", - "").replace("[ ]", - "") +output = f"\n\n{markdown}" +replaced = output.replace("[x]", "").replace("[ ]", "") subprocess.run(["xclip", "-in", "-selection", "clipboard"], input=replaced.encode()) print("Dokuwiki-Code kopiert.")