xonecas.io
818
Du

dustymarkdown / commit 1ff3101

wrote some guidelines

xonecas2011-04-29 1ff3101f458203a6d07df0748552b52d898c343d parent 77bd4a4

9 files changed

README.md+38−0
@@ -14,4 +14,42 @@ This app is only possible thanks to:
1414 * Dust.js
1515 * Markdown
1616
17+### The gist:
18+
19+So the build.js file grabs the source files you write and
20+compiles them into static assets (@TODO add compression
21+and concatenation). The way it knows what to do with your
22+files is because it expects a specific folder/naming
23+convention.
24+
25+This app is the example of that convention:
26+
27+
28+ root/
29+ build.js // compiler
30+ server.js // static asset provider
31+
32+ templates/ // home to your pages/views
33+ index.dust // root of the app
34+ pagename.dust // pagename becomes
35+ // http://server/pagename
36+
37+ markdown/ // where your content goes
38+ keyname.md // you can refer to this in
39+ // your template susing {keyname}
40+ section_keyname.md // you can refer to several
41+ // keynames using {#section}
42+ htdocs/ // your static content
43+ ...
44+ ... // organize it how you want it
45+ // just remember that the .html
46+ // files are created by build.js
47+ // so don't edit them by hand
48+
49+The default htdocs folder is from HTML5 Boilerplate and so is
50+the static file server. One difference is that this app uses
51+Ender for the js library, but you're welcome to change it.
52+There is also a very simple unique visitors/request counter.
53+
54+Browse the content of this repo for an example.
1755
build.js+5−2
@@ -5,6 +5,9 @@ var fs = require('fs'),
55 dust = require('dust'),
66 markdown = require("node-markdown").Markdown;
77
8+// little tweak to dust
9+dust.optimizers.format = function(ctx, node) { return node };
10+
811 //debug
912 var ins = require('util').inspect;
1013 function log (data) { console.log(ins(data)); };
@@ -52,9 +55,9 @@ function readdir(dir, callback) {
5255 // sort files by creation date
5356 if (index === files.length-1) {
5457 result.sort(function (a, b) {
55- return a.ctime - b.ctime;
58+ return +new Date(a.ctime) - +new Date(b.ctime);
5659 });
57- callback(result.reverse());
60+ callback(result);
5861 }
5962 });
6063 });
htdocs/about.html+51−2
@@ -1,5 +1,54 @@
1-<!doctype html><!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --><!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--><head><meta charset="utf-8"><title></title><meta name="description" content=""><meta name="author" content=""><!-- Mobile viewport optimized …
1+<!doctype html>
2+<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3+<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
4+<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
5+<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
6+<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
7+<head>
8+ <meta charset="utf-8">
9+
10+ <title>Dusty Markdown</title>
11+ <meta name="description" content="simple command line content manager">
12+ <meta name="author" content="@xonecas">
13+
14+ <!-- Mobile viewport optimized: j.mp/bplateviewport -->
15+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16+
17+ <!-- CSS: implied media="all" -->
18+ <link rel="stylesheet" href="css/style.css">
19+ <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
20+
21+ <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
22+ <script src="js/libs/modernizr.js"></script>
23+
24+</head>
25+
26+<body>
27+ <header><h1>Dusty Markdown</h1></header>
28+ <section id="main">
29+ <h2>This is just an example page.</h2>
230
331 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with deskto …
432
5-<p>Click <a href="/">here</a> to go back.</p></section><!-- JavaScript at the bottom for fast page loading --><script src="js/libs/ender.js"></script><!-- scripts concatenated and minified via ant build script--><script src="js/script.js"></script><!-- end scripts--><!-- simple uniques and page requests tracker, see server.js --><script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script><script>var s = localStorage, key = s.getItem('key');if (key == …
33+<p>Click <a href="/">here</a> to go back.</p>
34+ </section>
35+
36+ <!-- JavaScript at the bottom for fast page loading -->
37+ <script src="js/libs/ender.js"></script>
38+
39+ <!-- scripts concatenated and minified via ant build script-->
40+ <script src="js/script.js"></script>
41+ <!-- end scripts-->
42+
43+
44+ <!-- simple uniques and page requests tracker, see server.js -->
45+ <script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script>
46+ <script>
47+ var s = localStorage, key = s.getItem('key');
48+ if (key === null) { key = +new Date(); s.setItem('key', key); };
49+ $.ajax('/track?key='+key);
50+ </script>
51+
52+</body>
53+</html>
54+
htdocs/css/style.css+3−3
@@ -141,8 +141,8 @@ input:invalid, textarea:invalid {
141141 /* These selection declarations have to be separate
142142 No text-shadow: twitter.com/miketaylr/status/12228805301
143143 Also: hot pink! */
144-::-moz-selection{ background: #FF5E99; color:#fff; text-shadow: none; }
145-::selection { background:#FF5E99; color:#fff; text-shadow: none; }
144+::-moz-selection{ background: #333; color:#fff; text-shadow: none; }
145+::selection { background:#333; color:#fff; text-shadow: none; }
146146
147147 /* Bicubic resizing for non-native sized IMG:
148148 code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */
@@ -171,7 +171,7 @@ h1, h2, h3, h4, h5, h6 { font-weight: bold; margin: 1em 0; }
171171 */
172172 body {
173173 font-size: 1.230769230769231em;
174- text-shadow: 0 2px 0 #ccc;
174+ text-shadow: 0 1px 2px #ccc;
175175 }
176176
177177 header { width: 100%; text-align: center; margin-bottom:1em; }
htdocs/index.html+97−4
@@ -1,4 +1,35 @@
1-<!doctype html><!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --><!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--><head><meta charset="utf-8"><title></title><meta name="description" content=""><meta name="author" content=""><!-- Mobile viewport optimized …
1+<!doctype html>
2+<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3+<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
4+<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
5+<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
6+<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
7+<head>
8+ <meta charset="utf-8">
9+
10+ <title>Dusty Markdown</title>
11+ <meta name="description" content="simple command line content manager">
12+ <meta name="author" content="@xonecas">
13+
14+ <!-- Mobile viewport optimized: j.mp/bplateviewport -->
15+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16+
17+ <!-- CSS: implied media="all" -->
18+ <link rel="stylesheet" href="css/style.css">
19+ <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
20+
21+
22+ <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
23+ <script src="js/libs/modernizr.js"></script>
24+
25+</head>
26+
27+<body>
28+ <header>
29+ <h1>Dusty Markdown</h1>
30+ </header>
31+ <section id="main" class="center">
32+ <p>This project is the new content manager under xonecas.com.
233 It's very minimal and light, developer friendly. The idea
334 is that you can write the dynamic content in markdown and
435 use dust to combine static and dynamic.</p>
@@ -12,8 +43,70 @@ use dust to combine static and dynamic.</p>
1243 <li>Markdown</li>
1344 </ul>
1445
15-<p>See the example page <a href="/about">here</a>.</p></section><footer class="center"><h3>Thu, 28 of April, 2011</h3>
46+<h3>The gist:</h3>
47+
48+<p>So the build.js file grabs the source files you write and
49+compiles them into static assets (@TODO add compression
50+and concatenation). The way it knows what to do with your
51+files is because it expects a specific folder/naming
52+convention.</p>
53+
54+<p>This app is the example of that convention:</p>
55+
56+<pre><code> root/
57+ build.js // compiler
58+ server.js // static asset provider
59+
60+ templates/ // home to your pages/views
61+ index.dust // root of the app
62+ pagename.dust // pagename becomes
63+ // http://server/pagename
64+
65+ markdown/ // where your content goes
66+ keyname.md // you can refer to this in
67+ // your template susing {keyname}
68+ section_keyname.md // you can refer to several
69+ // keynames using {#section}
70+ htdocs/ // your static content
71+ ...
72+ ... // organize it how you want it
73+ // just remember that the .html
74+ // files are created by build.js
75+ // so don't edit them by hand
76+</code></pre>
77+
78+<p>The default htdocs folder is from HTML5 Boilerplate and so is
79+the static file server. One difference is that this app uses
80+Ender for the js library, but you're welcome to change it.
81+There is also a very simple unique visitors/request counter.</p>
82+
83+<p>See the example page <a href="/about">here</a>.</p>
84+ </section>
85+ <footer class="center">
86+ <h3>Thu, 28 of April, 2011</h3>
87+
88+<p>This is an example entry so that I now it's working.</p> <h3>Thu, 28 of April, 2011</h3>
89+
90+<p>First cleaned up. Added defult pages. Things look pretty now.</p>
91+ </footer>
92+
93+
94+
95+ <!-- JavaScript at the bottom for fast page loading -->
96+ <script src="js/libs/ender.js"></script>
97+
98+ <!-- scripts concatenated and minified via ant build script-->
99+ <script src="js/script.js"></script>
100+ <!-- end scripts-->
101+
16102
17-<p>First cleaned up. Added defult pages. Things look pretty now.</p> <h3>Thu, 28 of April, 2011</h3>
103+ <!-- simple uniques and page requests tracker, see server.js -->
104+ <script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script>
105+ <script>
106+ var s = localStorage, key = s.getItem('key');
107+ if (key === null) { key = +new Date(); s.setItem('key', key); };
108+ $.ajax('/track?key='+key);
109+ </script>
18110
19-<p>This is an example entry so that I now it's working.</p> </footer><!-- JavaScript at the bottom for fast page loading --><script src="js/libs/ender.js"></script><!-- scripts concatenated and minified via ant build script--><script src="js/script.js"></script><!-- end scripts--><!-- simple uniques and page requests tracker, see server.js --><script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script><script>var s = localStorage, key = s.getItem('ke …
111+</body>
112+</html>
markdown/about.md+37−0
@@ -11,5 +11,42 @@ This app is only possible thanks to:
1111 * Dust.js
1212 * Markdown
1313
14+### The gist:
15+
16+So the build.js file grabs the source files you write and
17+compiles them into static assets (@TODO add compression
18+and concatenation). The way it knows what to do with your
19+files is because it expects a specific folder/naming
20+convention.
21+
22+This app is the example of that convention:
23+
24+
25+ root/
26+ build.js // compiler
27+ server.js // static asset provider
28+
29+ templates/ // home to your pages/views
30+ index.dust // root of the app
31+ pagename.dust // pagename becomes
32+ // http://server/pagename
33+
34+ markdown/ // where your content goes
35+ keyname.md // you can refer to this in
36+ // your template susing {keyname}
37+ section_keyname.md // you can refer to several
38+ // keynames using {#section}
39+ htdocs/ // your static content
40+ ...
41+ ... // organize it how you want it
42+ // just remember that the .html
43+ // files are created by build.js
44+ // so don't edit them by hand
45+
46+The default htdocs folder is from HTML5 Boilerplate and so is
47+the static file server. One difference is that this app uses
48+Ender for the js library, but you're welcome to change it.
49+There is also a very simple unique visitors/request counter.
50+
1451 See the example page [here](/about).
1552
markdown/changelog_3.md+4−0
@@ -0,0 +1,4 @@
1+
2+### Thu, 29 of April, 2011
3+
4+Added more documentation.
templates/about.dust+3−3
@@ -7,9 +7,9 @@
77 <head>
88 <meta charset="utf-8">
99
10- <title></title>
11- <meta name="description" content="">
12- <meta name="author" content="">
10+ <title>Dusty Markdown</title>
11+ <meta name="description" content="simple command line content manager">
12+ <meta name="author" content="@xonecas">
1313
1414 <!-- Mobile viewport optimized: j.mp/bplateviewport -->
1515 <meta name="viewport" content="width=device-width, initial-scale=1.0">
templates/index.dust+3−3
@@ -7,9 +7,9 @@
77 <head>
88 <meta charset="utf-8">
99
10- <title></title>
11- <meta name="description" content="">
12- <meta name="author" content="">
10+ <title>Dusty Markdown</title>
11+ <meta name="description" content="simple command line content manager">
12+ <meta name="author" content="@xonecas">
1313
1414 <!-- Mobile viewport optimized: j.mp/bplateviewport -->
1515 <meta name="viewport" content="width=device-width, initial-scale=1.0">