Added templates.
h3rald h3rald@h3rald.com
Sat, 05 Aug 2017 14:42:17 +0200
8 files changed,
232 insertions(+),
12 deletions(-)
M
rules.min
→
rules.min
@@ -10,24 +10,31 @@ asset "output/articles/$1/$1" (name) => % %id #asset
asset output-cp ) :copy-pdf-article-asset -( - (dict) expect -> =content -) :process-md-content - +; Process a content file applying the appropriate template +; and compiling markdown to HTML if necessary. ( (dict) expect -> =content -) :process-html-content + content /content-type :ct + content /id :id + "page" :tpl + (ct "article" ==) ("article" @tpl) when + (id "index" ==) ("home" @tpl) when + "" :page + "" :contents + content ( + (input-fread @contents content) + ((/ext ".md" ==) (=temp contents temp markdown @contents temp) when) + (contents %contents) + (=temp tpl temp mustache @page temp) + (page %contents) + ((id "index" !=)("$1/index" (id) => % %id ".html" %ext) when) + ) tap +) :process-content ;;;; MAIN ;;;; -contents ( - dup - ( - ((/ext ".md" ==) (process-md-content)) - ((/ext ".html" ==) (process-html-content)) - ) case -) foreach +contents (process-content output-fwrite) foreach ; Process all assets. assets (
A
templates/_head.mustache
@@ -0,0 +1,33 @@
+ <head> + <title>{{title}} - H3RALD</title> + <meta charset="utf-8" /> + <meta name="author" content="Fabio Cevasco" /> + <meta name="robots" content="all, follow" /> + <meta name="Revisit-After" content="2 Days" /> + <meta name="description" content="H3RALD - Fabio Cevasco's Web Site" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> + <!-- + min_keywords = "h3rald, fabio cevasco, " + default = "ruby, rails technical writing, reviews, software, browsers, articles, traveling, books, genova" + case @item[:type] + when 'article' then + keywords = min_keywords+@item[:tags].join(', ') + when 'project' then + keywords = @item[:permalink] == 'h3rald' ? "fabio cevasco, "+@item[:permalink] : min_keywords+@item[:permalink] + else + keywords = min_keywords+default + end + --> + <meta name="keywords" content="{{keywords}}" /> + <link rel="shortcut icon" href="/favicon.png" type="image/png" /> + <meta content="44.388041;9.073248" name="ICBM" /> + <link rel="stylesheet" type="text/css" href="/styles/style.css" /> + <script src="js/fingerprint.js"></script> + <script src="/js/jquery.js" type="text/javascript"></script> + <script src="/js/jquery-timeago.js" type="text/javascript"></script> + <script src="/js/date.js" type="text/javascript"></script> + <script src="/js/init.js" type="text/javascript"></script> + <script src="/js/search.js" type="text/javascript"></script> + <script src="/js/highlight.js" type="text/javascript"></script> + <script src="/js/bootstrap.js" type="text/javascript"></script> + </head>
A
templates/_header.mustache
@@ -0,0 +1,35 @@
+<header class="container" id="site-header"> + <nav id="main-navbar" class="navbar navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <h1 class="navbar-brand"> + <a href="/" class="h3rald h3rald-header"> </a> + </h1> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="/projects/"><i class="h3-fizzing-flask"></i> PROJECTS</a></li> + <li><a href="/tags/"><i class="h3-tags"></i> TAGS</a></li> + <li><a href="/archives/"><i class="h3-lb-book-02"></i> ARCHIVES</a></li> + <li><a href="/about/"><i class="h3-scroll-unfurled"></i> ABOUT</a></li> + <li> + </li> + </ul> + <form class="navbar-form navbar-right"> + <div class="input-group"> + <input type="text" class="form-control" name="q" placeholder="Search" id="h3rald-search-box"> + <span class="input-group-btn"> + <button class="btn btn-default" id="h3rald-search-btn" type="button"><i class="fa fa-search"></i></button> + </span> + </div> + </form> + </div> + </div> + </nav> +</header>
A
templates/_page_header.mustache
@@ -0,0 +1,6 @@
+<header class="col-md-9"> + <h2>{{title}}</h2> + {{#subtitle}} + <h3>{{subtitle}}</h3> + {{/subtitle}} +</header>
A
templates/article.mustache
@@ -0,0 +1,27 @@
+<!DOCTYPE html> +<html lang="en"> + {{> _head}} + <body> + <div id="wrap"> + {{> _header}} + <main id="main" class="container"> + <article class="{{content-type}}"> + <div class="row"> + {{> _page_header}} + <ul class="list-unstyled article-info col-md-3"> + <li><i class="h3-quill-ink"></i> <time datetime="{{date-iso8601}}">{{date}}</time></li> + <li><i class="h3-tags"></i> {{tag-links}}</li> + {{#pdf}} + <li><a href="/articles/{{id}}/{{id}}.pdf"><i class="fa fa-download"> </i>Download as PDF</a></li> + {{/pdf}} + </ul> + </div> + <div id="body-text" class="hyphenate"> + {{{contents}}} + </div> + </article> + </main> + {{> _footer}} + </div> + </body> +</html>
A
templates/home.mustache
@@ -0,0 +1,13 @@
+<!DOCTYPE html> +<html lang="en"> + {{> _head}} + <body> + <div id="wrap"> + {{> _header}} + <main id="main" class="container"> + {{{contents}}} + </main> + {{> _footer}} + </div> + </body> +</html>
A
templates/page.mustache
@@ -0,0 +1,20 @@
+<!DOCTYPE html> +<html lang="en"> + {{> _head}} + <body> + <div id="wrap"> + {{> _header}} + <main id="main" class="container"> + <article class="{{content-type}}"> + <div class="row"> + {{> _page_header}} + </div> + <div id="body-text" class="hyphenate"> + {{{contents}}} + </div> + </article> + </main> + {{> _footer}} + </div> + </body> +</html>