]> git.mdlowis.com Git - projs/mikedlowis.github.io/commitdiff
Added script to autogenerate the menu bar
authorMike D. Lowis <mike.lowis@gentex.com>
Mon, 10 Aug 2015 17:00:07 +0000 (13:00 -0400)
committerMike D. Lowis <mike.lowis@gentex.com>
Mon, 10 Aug 2015 17:00:07 +0000 (13:00 -0400)
14 files changed:
config.sh
gensite [new file with mode: 0755]
pages/articles.md [new file with mode: 0644]
pages/home.md
pages/projects.md [new file with mode: 0644]
pages/prototypes.md [new file with mode: 0644]
site/articles.html [new file with mode: 0644]
site/home.html
site/projects.html [new file with mode: 0644]
site/prototypes.html [new file with mode: 0644]
site/style2.css [deleted file]
templates/page.html
tools/genmenu.sh [new file with mode: 0755]
tools/genpage

index 79a54d9ae11cc635d6ba755a0db1870e3e9e1a37..90bb5c0d408d95eb1d37bbdc852299f187f13a2e 100644 (file)
--- 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 (executable)
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 (file)
index 0000000..cc019f4
--- /dev/null
@@ -0,0 +1,2 @@
+MENUID 1
+
index 80b506cc477edc35c8c02a7a13b9f43021ae199d..7f8275fa3df7d3831ca7068a87221ee28d0975d8 100644 (file)
@@ -1,4 +1,5 @@
 TYPE page
+MENUID 0
 ---
 # Header 1
 
diff --git a/pages/projects.md b/pages/projects.md
new file mode 100644 (file)
index 0000000..8d71e28
--- /dev/null
@@ -0,0 +1,2 @@
+MENUID 2
+
diff --git a/pages/prototypes.md b/pages/prototypes.md
new file mode 100644 (file)
index 0000000..3a3ae70
--- /dev/null
@@ -0,0 +1,2 @@
+MENUID 3
+
diff --git a/site/articles.html b/site/articles.html
new file mode 100644 (file)
index 0000000..e69de29
index 402e15c75c9d39e74118c3b006717ca2200ded49..904522c06561512d2491055e6b9954887c86dd08 100644 (file)
     <div class="header">
         <a href="index.html"><img src="logo.png"></a>
         <a class="headerLink" href="index.html">mdlowis</a>
-        <span class="headerSubtitle">Simplicity is the ultimate sophistication</span>
+        <span class="headerSubtitle">Simplicity</span>
     </div>
 
     <div class="menu">
+        <span class="left">
+            <a class="" href="site/home.html">home</a>
+            <a class="" href="site/articles.html">articles</a>
+            <a class="" href="site/projects.html">projects</a>
+            <a class="" href="site/prototypes.html">prototypes</a>
+        </span>
+    <!--
         <span class="left">
             <a class="current" href="index.html">home</a>
             <a href="">articles</a>
             <a href="">projects</a>
             <a href="">prototypes</a>
         </span>
+    -->
         <!--
         <span class="right">
             <a href="">download</a>
diff --git a/site/projects.html b/site/projects.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/site/prototypes.html b/site/prototypes.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/site/style2.css b/site/style2.css
deleted file mode 100644 (file)
index fd958a8..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
-*  * Content Styling
-*   **/
-body {
-background-color: #eee;
-color: #333;
-font-family: sans-serif;
-padding: 0;
-margin: 0;
-}
-
-h1, h2, h3, h4 { margin: 1em 1ex 0.5ex 0; }
-
-h1 { font-size: 1.4em; }
-
-h2 { font-size: 1.3em; }
-
-h3 { font-size: 1.2em; }
-
-h4 { font-size: 1.1em; }
-
-a {
-color: #005386;
-text-decoration: none;
-}
-
-a:hover {
-background-color: #eeeeee;
-}
-
-.left {
-float: left;
-margin: 0;
-padding: 0;
-}
-
-.right {
-float: right;
-margin: 0;
-padding: 0;
-}
-
-/**
-*  * Header Styling
-*   **/
-.header {
-clear: both;
-color: #333;
-font-size: 1.78em;
-padding: 0.7ex 0.7ex 0.7ex 0.7em;
-}
-
-.headerLink {
-color: #aa1111;
-margin-left: 5px;
-}
-
-.headerSubtitle {
-font-size: 0.75em;
-font-style: italic;
-margin-left: 1em;
-}
-
-/**
-*  * Menu Styling
-*   **/
-.menu {
-clear: both;
-overflow: hidden;
-background-color: #a11;
-padding: 0.7ex;
-font-size: 94%;
-/*
-*     border-top: 2px solid #0f6793;
-*         border-bottom: 2px solid #0f6793;
-*         */
-border-top: 2px solid black;
-border-bottom: 2px solid black;
-}
-
-.menu a {
-padding: 0.5ex 1ex 0.5ex 1ex;
-color: #fff;
-vertical-align: middle;
-}
-
-.menu a:hover {
-background-color: #f00;
-vertical-align: middle;
-}
-
-.menu a.current {
-font-weight: bold;
-vertical-align: middle;
-}
-
-/**
-*  * Main Page Content
-*   **/
-.content {
-clear: both;
-margin: 0;
-padding: 0;
-overflow: hidden;
-}
-
-/**
-*  * Navigation Bar
-*   **/
-.nav {
-float: left;
-margin: 0 1px 0 0;
-padding: 1em 0;
-width: 200px;
-}
-
-.nav ul {
-margin: 0;
-padding: 0;
-}
-
-.nav li {
-list-style: none;
-padding: 0;
-margin: 0;
-}
-
-.nav li ul {
-padding-left: 0.6em !important;
-}
-
-.nav li a {
-display: block;
-margin: 0;
-padding: 0.8ex 2em 0.8ex 1em;
-color: #a11;
-}
-.nav li a:hover {
-color: #f00;
-text-decoration: underline;
-}
-
-.nav li a.thisPage {
-color: #333;
-font-weight: bold;
-}
-
-/**
-*  * Article/Page Text
-*   **/
-.main {
-margin: 0 0 0 200px;
-padding: 1.5em;
-max-width: 50em;
-border-left: 1px solid #000;
-}
-
-/**
-*  * Page Footer
-*   **/
-.footer {
-clear: both;
-color: #fff;
-background: #a11;
-border-top: 1px solid #000;
-font-size: 84%;
-padding: 1em 1em 1.5em 1em;
-}
-
index c92af98e8729f3c49d269505c35f669e3aee29cb..93920a2ba6b251a2dacb925e9e61e25ac5b6e35a 100644 (file)
     </div>
 
     <div class="menu">
-        <span class="left">
-            <a class="current" href="index.html">home</a>
-            <a href="">articles</a>
-            <a href="">projects</a>
-            <a href="">prototypes</a>
-        </span>
-        <!--
-        <span class="right">
-            <a href="">download</a>
-            <a href="">source</a>
-        </span>
-        -->
+        {{MENUTEXT}}
     </div>
 
     <div class="content">
diff --git a/tools/genmenu.sh b/tools/genmenu.sh
new file mode 100755 (executable)
index 0000000..17614a8
--- /dev/null
@@ -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 '<span class="left">'
+for page in "${pagelist[@]}"; do
+    echo "            <a class=\"\" href=\"site/$page.html\">$page</a>"
+done
+echo '        </span>'
+popd > /dev/null
+
index 54577c0c4b5c3b4147ad8ba74ad837ad9e6a5008..0bee9cf9d16ea393cd6e44d9ca427dd22ad2b2b2 100755 (executable)
@@ -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