From 464952e8c610184838cb461ff9cd679f2a10a389 Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Mon, 10 Aug 2015 13:00:07 -0400 Subject: [PATCH] Added script to autogenerate the menu bar --- config.sh | 1 + gensite | 5 ++ pages/articles.md | 2 + pages/home.md | 1 + pages/projects.md | 2 + pages/prototypes.md | 2 + site/articles.html | 0 site/home.html | 10 ++- site/projects.html | 0 site/prototypes.html | 0 site/style2.css | 169 ------------------------------------------- templates/page.html | 13 +--- tools/genmenu.sh | 12 +++ tools/genpage | 4 +- 14 files changed, 37 insertions(+), 184 deletions(-) create mode 100755 gensite create mode 100644 pages/articles.md create mode 100644 pages/projects.md create mode 100644 pages/prototypes.md create mode 100644 site/articles.html create mode 100644 site/projects.html create mode 100644 site/prototypes.html delete mode 100644 site/style2.css create mode 100755 tools/genmenu.sh diff --git a/config.sh b/config.sh index 79a54d9..90bb5c0 100644 --- a/config.sh +++ b/config.sh @@ -3,4 +3,5 @@ export TITLE="Simplicity is the ultimate sophistication" export SUBTITLE=$TITLE export COPYRIGHT="© 2015 Michael D. Lowis" +export MENUTEXT="`genmenu.sh`" diff --git a/gensite b/gensite new file mode 100755 index 0000000..5ae68b0 --- /dev/null +++ b/gensite @@ -0,0 +1,5 @@ +#!/bin/bash + +pages=(`ls pages/*.md | sed -e 's/\.md$//'`) + +echo ${pages[@]} diff --git a/pages/articles.md b/pages/articles.md new file mode 100644 index 0000000..cc019f4 --- /dev/null +++ b/pages/articles.md @@ -0,0 +1,2 @@ +MENUID 1 + diff --git a/pages/home.md b/pages/home.md index 80b506c..7f8275f 100644 --- a/pages/home.md +++ b/pages/home.md @@ -1,4 +1,5 @@ TYPE page +MENUID 0 --- # Header 1 diff --git a/pages/projects.md b/pages/projects.md new file mode 100644 index 0000000..8d71e28 --- /dev/null +++ b/pages/projects.md @@ -0,0 +1,2 @@ +MENUID 2 + diff --git a/pages/prototypes.md b/pages/prototypes.md new file mode 100644 index 0000000..3a3ae70 --- /dev/null +++ b/pages/prototypes.md @@ -0,0 +1,2 @@ +MENUID 3 + diff --git a/site/articles.html b/site/articles.html new file mode 100644 index 0000000..e69de29 diff --git a/site/home.html b/site/home.html index 402e15c..904522c 100644 --- a/site/home.html +++ b/site/home.html @@ -10,16 +10,24 @@
mdlowis - Simplicity is the ultimate sophistication + Simplicity
diff --git a/tools/genmenu.sh b/tools/genmenu.sh new file mode 100755 index 0000000..17614a8 --- /dev/null +++ b/tools/genmenu.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +pushd pages/ > /dev/null +pagelist=(`grep MENUID *.md | sed -e's/\.md:MENUID//' | awk '{print $2, $1}' | sort | cut -d' ' -f2`) + +echo '' +for page in "${pagelist[@]}"; do + echo " $page" +done +echo ' ' +popd > /dev/null + diff --git a/tools/genpage b/tools/genpage index 54577c0..0bee9cf 100755 --- a/tools/genpage +++ b/tools/genpage @@ -22,8 +22,8 @@ ifile=${1:?"missing filename"} ofile="contents.${0##*/}-$$" touch $ofile eval `awk -v OFILE="$ofile" "$awk_script" $ifile` -export CONTENT=`md2html.awk $ofile` -source config.sh +export CONTENT="`md2html.awk $ofile`" +. ./config.sh if [ -f "templates/$TYPE.html" ]; then mo "templates/$TYPE.html" fi -- 2.52.0