From 85016e706cd00e527dba3fa83b2783dfb56a4ffa Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 27 Dec 2020 18:45:04 -0500 Subject: Squashed 'www/git.causal.agency/cgit/' content from commit 02221fd3 git-subtree-dir: www/git.causal.agency/cgit git-subtree-split: 02221fd3fe523a3293d64e3359036e3a71d6fd7e --- filters/html-converters/man2html | 4 + filters/html-converters/md2html | 307 +++++++++++++++++++++++++++++++++++++++ filters/html-converters/rst2html | 2 + filters/html-converters/txt2html | 4 + 4 files changed, 317 insertions(+) create mode 100755 filters/html-converters/man2html create mode 100755 filters/html-converters/md2html create mode 100755 filters/html-converters/rst2html create mode 100755 filters/html-converters/txt2html (limited to 'filters/html-converters') diff --git a/filters/html-converters/man2html b/filters/html-converters/man2html new file mode 100755 index 00000000..0ef78841 --- /dev/null +++ b/filters/html-converters/man2html @@ -0,0 +1,4 @@ +#!/bin/sh +echo "
" +groff -mandoc -T html -P -r -P -l | egrep -v '(||||||||" diff --git a/filters/html-converters/md2html b/filters/html-converters/md2html new file mode 100755 index 00000000..dc20f42a --- /dev/null +++ b/filters/html-converters/md2html @@ -0,0 +1,307 @@ +#!/usr/bin/env python3 +import markdown +import sys +import io +from pygments.formatters import HtmlFormatter +from markdown.extensions.toc import TocExtension +sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') +sys.stdout.write(''' + +''') +sys.stdout.write("
") +sys.stdout.flush() +# Note: you may want to run this through bleach for sanitization +markdown.markdownFromFile( + output_format="html5", + extensions=[ + "markdown.extensions.fenced_code", + "markdown.extensions.codehilite", + "markdown.extensions.tables", + TocExtension(anchorlink=True)], + extension_configs={ + "markdown.extensions.codehilite":{"css_class":"highlight"}}) +sys.stdout.write("
") diff --git a/filters/html-converters/rst2html b/filters/html-converters/rst2html new file mode 100755 index 00000000..02d90f81 --- /dev/null +++ b/filters/html-converters/rst2html @@ -0,0 +1,2 @@ +#!/bin/bash +exec rst2html.py --template <(echo -e "%(stylesheet)s\n%(body_pre_docinfo)s\n%(docinfo)s\n%(body)s") diff --git a/filters/html-converters/txt2html b/filters/html-converters/txt2html new file mode 100755 index 00000000..495eeceb --- /dev/null +++ b/filters/html-converters/txt2html @@ -0,0 +1,4 @@ +#!/bin/sh +echo "
"
+sed "s|&|\\&|g;s|'|\\'|g;s|\"|\\"|g;s|<|\\<|g;s|>|\\>|g"
+echo "
" -- cgit 1.4.1