Markdown to OpenSSL HTML5 pages
authorRichard Levitte <levitte@openssl.org>
Tue, 29 Jan 2019 11:43:41 +0000 (12:43 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 29 Jan 2019 12:32:04 +0000 (13:32 +0100)
Markdown is a popular format for text files, and some documents are
easier to read in this form than in HTML.  For future purposes, this
is the scripts we need to process markdown files into HTML5.

This script is based on pandoc, which is a pretty good translator
between a range of different document formats.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/web/pull/108)

bin/md-to-html5 [new file with mode: 0755]
bin/md-to-html5.tmpl.html5 [new file with mode: 0644]

diff --git a/bin/md-to-html5 b/bin/md-to-html5
new file mode 100755 (executable)
index 0000000..7bb815b
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+template="$0.tmpl.html5"
+
+for f in "$@"; do
+    b=`basename "$f" .md`
+    if [ "$f" != "$b" ]; then
+       bns=`echo "$b" | sed -e 's|  *||g'`
+       t=`dirname "$b"`.tmpl.html5
+       if [ ! -f "$t" ]; then
+           t="$template"
+       fi
+       pandoc -t html5 --template="$t" "$f" > "$bns.html"
+    fi
+done
diff --git a/bin/md-to-html5.tmpl.html5 b/bin/md-to-html5.tmpl.html5
new file mode 100644 (file)
index 0000000..b1fbe38
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--#include virtual="/inc/head.shtml" -->
+
+<body>
+<!--#include virtual="/inc/banner.shtml" -->
+
+  <div id="main">
+    <div id="content">
+      <div class="blog-index">
+        <article>
+$if(title)$
+<header>
+<h1 class="title">$title$</h1>
+$if(subtitle)$
+<p class="subtitle">$subtitle$</p>
+$endif$
+$for(author)$
+<p class="author">$author$</p>
+$endfor$
+$if(date)$
+<p class="date">$date$</p>
+$endif$
+</header>
+$endif$
+$body$
+        </article>
+      </div>
+      <!--#include virtual="sidebar.shtml" -->
+    </div>
+  </div>
+
+<!--#include virtual="/inc/footer.shtml" -->
+</body>