--- /dev/null
+<!DOCTYPE html>
+<!-- Site design *heavily* based on the excellent design of http://suckless.org/ -->
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>{{TITLE}}</title>
+ <link rel="shortcut icon" type="image/x-icon" href="{{LOGO}}" />
+ <link rel="stylesheet" type="text/css" href="{{STYLE}}">
+ <meta charset="utf-8">
+ <style>
+ #menuitem{{MENUID}} { font-weight: bold; }
+ </style>
+</head>
+<body>
+ <div class="header">
+ <a href="index.html"><img src="{{LOGO}}"></a>
+ <a class="headerLink" href="index.html">mdlowis</a>
+ <span class="headerSubtitle">{{SUBTITLE}}</span>
+ </div>
+
+ <div class="menu">
+ {{MENUTEXT}}
+ </div>
+
+ <div class="content">
+ <div class="nav">
+ {{SECTION1}}
+ </div>
+ <div class="main">
+ {{SECTION2}}
+ </div>
+ </div>
+
+ <div class="footer">
+ <span class="right">{{COPYRIGHT}}</span>
+ </div>
+</body><div></div></html>
#!/bin/sh
-awk_script='
-BEGIN {
- file = OFILE
- mode = 0
-}
-mode == 1 { print $0 > file }
+#awk_script='
+#BEGIN {
+# file = OFILE
+# mode = 0
+#}
+#
+#mode == 1 { print $0 > file }
+#
+#mode == 0 {
+# if (($0 != "") && ($1 != "#")) {
+# if ($0 != "---") {
+# first = $1
+# $1 = ""
+# print "export " first "=\"" substr($0, 2) "\""
+# } else {
+# mode = 1
+# }
+# }
+#}'
-mode == 0 {
- if (($0 != "") && ($1 != "#")) {
- if ($0 != "---") {
- first = $1
- $1 = ""
- print "export " first "=\"" substr($0, 2) "\""
- } else {
- mode = 1
- }
- }
-}'
ifile=${1:?"missing filename"}
-ofile="contents.${0##*/}-$$"
-touch $ofile
-eval `awk -v OFILE="$ofile" "$awk_script" $ifile`
-export CONTENT="`md2html.awk $ofile`"
+sections=(`awk -v PID="$$" -f ./tools/sections.awk $ifile`)
+
+for i in "${!sections[@]}"; do
+ if [[ "$i" -eq "0" ]]; then
+ source "${sections[$i]}"
+ else
+ eval "export SECTION$i=\"`./tools/md2html.awk ${sections[$i]}`\""
+ fi
+ rm "${sections[$i]}"
+done
+
+#ifile=${1:?"missing filename"}
+#ofile="contents.${0##*/}-$$"
+#touch $ofile
+#eval `awk -v OFILE="$ofile" "$awk_script" $ifile`
+#export CONTENT="`md2html.awk $ofile`"
. ./config.sh
if [ -f "templates/$TYPE.html" ]; then
mo "templates/$TYPE.html"
fi
-rm $ofile
+#rm $ofile
--- /dev/null
+#!/bin/env awk -f
+
+BEGIN {
+ mode = 0
+ pid = PID
+ sectid = 0
+ newfile = "section-" sectid "-" pid
+ ofile = ""
+}
+
+ofile == "" {
+ ofile = newfile
+ print ofile
+}
+
+mode == 0 {
+ if (($0 != "") && ($1 != "#")) {
+ if ($0 != "---") {
+ first = $1
+ $1 = ""
+ print "export " first "=\"" substr($0, 2) "\"" > ofile
+ } else {
+ mode = 1
+ sectid = sectid + 1
+ newfile = "section-" sectid "-" pid
+ ofile = ""
+ }
+ }
+}
+
+mode == 1 {
+ if ($0 != "---") {
+ print $0 > ofile
+ } else {
+ sectid = sectid + 1
+ newfile = "section-" sectid "-" pid
+ ofile = ""
+ }
+}
+