From 7f3602ca7a12ada5fa95afd42af78ac963f058db Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" <mackyle@gmail.com> Date: Sat, 31 Oct 2020 02:59:15 -0700 Subject: [PATCH] install.sh: include sources when formatting markdown docs Instead of redirecting the "source of this document" links to the "blob" in a markdown repository that may or may not actually exist on the current server and may or may not actually contain the matching sources, go ahead and format the raw sources as additional "*.md.html" documents and include them alongside the rest while pointing the "source of this document" links to them. Signed-off-by: Kyle J. McKay <mackyle@gmail.com> --- install.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index d03869e..eb5887d 100755 --- a/install.sh +++ b/install.sh @@ -1105,8 +1105,28 @@ done echo "*** Formatting markdown documentation..." mkdir -p "$cgiroot/html/gfm" for d in basics.md syntax.md; do + { + cat <<-HEADER + <!DOCTYPE html> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8" /> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <title>$d</title> + </head> + <body><pre> + HEADER + <"markdown.git/$d" LC_ALL=C sed -e '/\[[Ll]icense\]/d' \ + -e 's, \([a-z][a-z]*\)\.md, \1.md.html,' \ + -e 's/ by adding `.md` to the URL//' \ + -e 's/&/\&/g' -e 's/</\</g' <"markdown.git/$d" + cat <<-FOOTER + </pre></body> + </html> + FOOTER + } >"$cgiroot/html/gfm/$d.html" <"markdown.git/$d" LC_ALL=C sed -e '/\[[Ll]icense\]/d' \ - -e 's, \([a-z][a-z]*\)\.md, /markdown.git/blob/HEAD:/\1.md,' \ + -e 's, \([a-z][a-z]*\)\.md, \1.md.html,' \ -e 's/ by adding `.md` to the URL//' | "$perlbin" "markdown.git/Markdown.pl" --stub >"$cgiroot/html/gfm/${d%.md}.html" done -- 2.11.4.GIT