Skip to content

Commit

Permalink
add a couchapp markdown reader for progit called "chacon"
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Mar 30, 2010
1 parent 9364393 commit 84a12ab
Show file tree
Hide file tree
Showing 9 changed files with 815 additions and 0 deletions.
1 change: 1 addition & 0 deletions couchapp/.couchapprc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
13 changes: 13 additions & 0 deletions couchapp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TODO: research wildcard targets

en: figures
cp ../en/*/*.markdown ./_docs/

de: figures
cp ../de/*/*.markdown ./_docs/

figures:
mkdir -p _attachments/figures/
cp ../figures/* _attachments/figures/

clean:
1 change: 1 addition & 0 deletions couchapp/_id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_design/chacon
14 changes: 14 additions & 0 deletions couchapp/shows/chapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function(doc, req) {
//!json templates
send(templates.head);
var markdown = require("vendor/markdown/showdown");

var resolve_figures = function (text) {
return text.replace(/Insert ([^\.]+).png/g, function(all, figure) {
return '<img src="../../figures/' + figure + '-tn.png"><br>';
});
};

send(markdown.toHtml(resolve_figures(doc.body)));
send(templates.foot);
}
1 change: 1 addition & 0 deletions couchapp/templates/chapters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<li><a href="../../_show/chapter/{{id}}">{{key}}</a></li>
7 changes: 7 additions & 0 deletions couchapp/templates/foot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

<div id="footer">
<div id="fleuron"></div>
<a href="http://progit.org/">© 2009–2010 Scott Chacon</a>
</div>
</body>
</html>
56 changes: 56 additions & 0 deletions couchapp/templates/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Progit — By Scott Chacon</title>
<style type="text/css" media="screen">
body {
font-family:"Minion Pro";
width: 32em;

margin-left:2em;
}

ol li {
list-style-type: none;
}

code {
font-family:monospace;
}

#chapters {
float:right;
margin:6ex 0 8ex 4em;
}

#footer {
text-align:center;
margin-bottom:6ex;
}

#footer a {
text-decoration: none;
}

#fleuron {
margin:6ex 0 8ex 0;
}

</style>
</head>

<body>
<div id="chapters">
<ol>
<li><a href="01-chapter1">Chapter 1</a></li>
<li><a href="01-chapter2">Chapter 2</a></li>
<li><a href="01-chapter3">Chapter 3</a></li>
<li><a href="01-chapter4">Chapter 4</a></li>
<li><a href="01-chapter5">Chapter 5</a></li>
<li><a href="01-chapter6">Chapter 6</a></li>
<li><a href="01-chapter7">Chapter 7</a></li>
<li><a href="01-chapter8">Chapter 8</a></li>
<li><a href="01-chapter9">Chapter 9</a></li>
</ol>
</div>
Loading

0 comments on commit 84a12ab

Please sign in to comment.