Skip to content

Instantly share code, notes, and snippets.

@atmoz
Created April 7, 2013 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atmoz/5332427 to your computer and use it in GitHub Desktop.
Save atmoz/5332427 to your computer and use it in GitHub Desktop.
<h1>My first post</h1>
<p>So this is how it looks</p>
<p>My second paragraph</p>
content=$(<content.html)
template=$(<template.html)
# Rewrite the template so that we can source it proper.
eof_key=$'\x02'
template="cat <<EOF$eof_key
$template
EOF$eof_key"
source /dev/stdin <<< "$template"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>%TITLE%</title>
</head>
<body>
<header>
<h1>blog.atmoz.net</h1>
<nav>
<ul id="menu">
<li><a href="2013-03-09-my-first-post.md">My first post</a></li>
</ul>
</nav>
<div id="toggleNav"></div>
</header>
<article id="content" style="display: none;">
%CONTENT%
</article>
<footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="src/marked/lib/marked.js"></script>
<script src="src/static-web/static-web.js"></script>
<script>
$(document).ready(function() {
staticWeb({
linkSelector: 'a[href$=".md"]',
contentHandler: function(data, url) {
// Convert markdown to HTML
return marked(data);
},
beforePageLoad: function($content, url) {
$content.fadeOut(200);
},
afterPageLoad: function($content, url) {
$content.fadeIn(200);
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment