mars

superminimal static website framework
git clone git://parazyd.org/mars.git
Log | Files | Refs | README | LICENSE

commit 654c586bc7eaad78a17fbef50a5f40ca3f569a58
parent a16e47faeb4a32510397580735fc6bae1540b7ae
Author: parazyd <parazyd@dyne.org>
Date:   Fri,  1 Jul 2016 15:36:14 +0200

update docu; add mdexample; add better md support

Diffstat:
MREADME.md | 20+++++++++++++++++++-
Dexample/header.php | 14--------------
Rexample/footer.php -> example/markdown/footer.html | 0
Aexample/markdown/header.html | 13+++++++++++++
Aexample/markdown/index.html | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Aexample/markdown/index.md | 5+++++
Aexample/markdown/navigation.html | 24++++++++++++++++++++++++
Rexample/footer.php -> example/php/footer.php | 0
Aexample/php/header.php | 14++++++++++++++
Rexample/index.php -> example/php/index.php | 0
Rexample/navigation.php -> example/php/navigation.php | 0
Mmars.sh | 15+++++++++++++--
Mwebtree | 7+++++--
13 files changed, 142 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md @@ -26,6 +26,9 @@ the `pageformat` variable tells mars to either use php or markdown the `exclude` array is an array of (php/md) files you don't want to be processed. +`precontent` and `postcontent` is (usually) html code in files that will be +concatenated in order - before and after our markdown content (respectively) + the `rsync-exclude` file contains the list of things for rsync to ignore. sidenote: rsync goes over ssh by default, but is easily configurable @@ -46,11 +49,26 @@ an optional third step will delete the html files from the webtree ``` ## example/ explained -the `example` directory shows you how i personally use mars. +the `example` directory shows you ways to use mars with php and markdown +### php `index.php` is the only thing that is being generated as `index.html` mars will process it, and as it's in php, `footer`, `header` and `navigation` are included from `index.php` and get included in the final page. this makes it very easy to manage your content, as the only part you actually have to worry about in `index.php` is the content (text). + +### markdown +`index.md` is the page that is being generated for our static `index.html` + +a custom parseable option is the page title which can be seen in the first line +of `index.md` + +the "syntax" to declare your page's title is + +``` +##+ this is my page's title +``` + +this line will not end up in your final html. diff --git a/example/header.php b/example/header.php @@ -1,14 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="description" content="Who is parazyd, software developer, designer, crypto, bitcoin, linux administrator"> - <title><?php echo $title; ?> : parazyd.cf</title> - <link rel="stylesheet" type="text/css" href="style.css"> -</head> - <div id="header"> - <a href="/"><img alt="logo" src="logo.svg"></a> - <a id="headerLink" href="/">parazyd.cf</a> <span id="headerSubtitle">something something</span> - </div> - -<?php include "navigation.php"; ?> diff --git a/example/footer.php b/example/markdown/footer.html diff --git a/example/markdown/header.html b/example/markdown/header.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="description" content="Who is parazyd, software developer, designer, crypto, bitcoin, linux administrator"> + <title>DEFAULT_TITLE</title> + <link rel="stylesheet" type="text/css" href="../style.css"> +</head> + <div id="header"> + <a href="/"><img alt="logo" src="../logo.svg"></a> + <a id="headerLink" href="/">parazyd.cf</a> <span id="headerSubtitle">something something</span> + </div> + diff --git a/example/markdown/index.html b/example/markdown/index.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="description" content="Who is parazyd, software developer, designer, crypto, bitcoin, linux administrator"> + <title>This is da real title</title> + <link rel="stylesheet" type="text/css" href="../style.css"> +</head> + <div id="header"> + <a href="/"><img alt="logo" src="../logo.svg"></a> + <a id="headerLink" href="/">parazyd.cf</a> <span id="headerSubtitle">something something</span> + </div> + + <div id="menu"> + <span class="left"> + <a class="thisSite" href="https://parazyd.cf">home</a> + <a href="https://moo.parazyd.cf">moo</a> + <a href="https://pub.parazyd.cf">pub</a> + </span> + </div> + + <div id="content"> + <div id="nav"> + + <ul> + <li><a href="/">main</a></li> + <li><a href="https://git.parazyd.cf">code/</a></li> + <li><a href="/blog/">blog/</a></li> + <li><a href="/blog/musings/">&nbsp;&nbsp;&nbsp;&nbsp;musings/</a></li> + <li><a href="/projects/">projects/</a></li> + <li><a href="/contact.html">contact</a></li> + <li><a href="https://www.dyne.org">../dyne.org</a></li> + </ul> + + </div> + + <div id="main"> +<h1>And this will be teh header</h1> +<p>and more st00f</p> </div> + + </div> + + <div id="footer"> + <span class="right"> + copyleft 2016 parazyd, design heavily inspired by <a href="http://suckless.org">suckless.org</a> ♥ + </span> + </div> +</body> +</html> diff --git a/example/markdown/index.md b/example/markdown/index.md @@ -0,0 +1,5 @@ +##+ This is da real title + +# And this will be teh header + +and more st00f diff --git a/example/markdown/navigation.html b/example/markdown/navigation.html @@ -0,0 +1,24 @@ + <div id="menu"> + <span class="left"> + <a class="thisSite" href="https://parazyd.cf">home</a> + <a href="https://moo.parazyd.cf">moo</a> + <a href="https://pub.parazyd.cf">pub</a> + </span> + </div> + + <div id="content"> + <div id="nav"> + + <ul> + <li><a href="/">main</a></li> + <li><a href="https://git.parazyd.cf">code/</a></li> + <li><a href="/blog/">blog/</a></li> + <li><a href="/blog/musings/">&nbsp;&nbsp;&nbsp;&nbsp;musings/</a></li> + <li><a href="/projects/">projects/</a></li> + <li><a href="/contact.html">contact</a></li> + <li><a href="https://www.dyne.org">../dyne.org</a></li> + </ul> + + </div> + + <div id="main"> diff --git a/example/footer.php b/example/php/footer.php diff --git a/example/php/header.php b/example/php/header.php @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="description" content="Who is parazyd, software developer, designer, crypto, bitcoin, linux administrator"> + <title><?php echo $title; ?> : parazyd.cf</title> + <link rel="stylesheet" type="text/css" href="../style.css"> +</head> + <div id="header"> + <a href="/"><img alt="logo" src="../logo.svg"></a> + <a id="headerLink" href="/">parazyd.cf</a> <span id="headerSubtitle">something something</span> + </div> + +<?php include "navigation.php"; ?> diff --git a/example/index.php b/example/php/index.php diff --git a/example/navigation.php b/example/php/navigation.php diff --git a/mars.sh b/mars.sh @@ -42,7 +42,10 @@ countdown() { printf "\n===========================================================\n\n" } -trapctrlc() { print "\n\n"; wrn "aborting..."; exit 2 } +trapctrlc() { + rm -f $tmpage + print "\n\n"; wrn "aborting..."; exit 2 +} trap "trapctrlc" 2 # }}} @@ -81,15 +84,23 @@ process-page() { || print "$(msgnope) $name.$pageformat -> $name.html";; md|markdown) + rm -f $name.html [[ -z $precontent ]] || { for i in $precontent; do cat $i >> $name.html done } - python -m markdown $page >> $name.html \ + local pagetitle=`grep '^##+ ' $page | cut -c 5- -` + sed -i -e 's/DEFAULT_TITLE/'$pagetitle'/' $name.html + tmpage=`mktemp` && cp $page $tmpage + sed -i -e 's/##+ .*//' $tmpage + + python -m markdown $tmpage >> $name.html \ && print "$(msgokay) $name.$pageformat -> $name.html" \ || print "$(msgnope) $name.$pageformat -> $name.html" + rm $tmpage + [[ -z $postcontent ]] || { for i in $postcontent; do cat $i >> $name.html diff --git a/webtree b/webtree @@ -20,8 +20,11 @@ pageformat=md # pub/tmp # pub/tmp/screenshots # ) +# tree=( +# example/php +# ) tree=( - example + example/markdown ) # here add files you want excluded from being generated as .html @@ -37,7 +40,7 @@ exclude=( # ) ## markdown specific settings -[[ $pageformat == md ]] && { ## markdown specific settings +[[ $pageformat == md ]] && { # html that is put in order before the conten precontent=(header.html navigation.html)