commit 212216a7a1ae2cc14b52039ca6e900b849e16913 Author: David Carey <david@davidpcarey.com> Date: Sat, 30 Jul 2022 19:01:45 +0000 initial commit Diffstat:
A | org2html | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 71 insertions(+), 0 deletions(-)
diff --git a/org2html b/org2html @@ -0,0 +1,71 @@ +#!/bin/sh +cat <<EOF +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"/> + <link rel='stylesheet' type='text/css' href="/sty.css"/> + </head> + <body> +EOF +inp=false +while read line +do + case $(printf "$line" | cut -f 1 -d ' ') in + \*) + printf " <h1> %s </h1>\n" "$(printf "$line" | cut -f 2- -d ' ')" + if $inp + then + echo ' </p>' + inp=false + fi + ;; + \*\*) + printf " <h2> %s </h2>\n" "$(printf "$line" | cut -f 2- -d ' ')" + if $inp + then + echo ' </p>' + inp=false + fi + ;; + \*\*\*) + printf " <h3> %s </h3>\n" "$(printf "$line" | cut -f 2- -d ' ')" + if $inp + then + echo ' </p>' + inp=false + fi + ;; + \*\*\*\*) + printf " <h4> %s </h4>\n" "$(printf "$line" | cut -f 2- -d ' ')" + if $inp + then + echo ' </p>' + inp=false + fi + ;; + \*\*\*\*\*) + printf " <h4> %s </h5>\n" "$(printf "$line" | cut -f 2- -d ' ')" + if $inp + then + echo ' </p>' + inp=false + fi + ;; + '') + echo ' </p><p>' + ;; + *) + if ! $inp + then + echo ' <p>' + inp=true + fi + echo " $line" + ;; + esac +done +cat <<EOF + </body> +</html> +EOF