Skip to content

Commit

Permalink
upgrading node to latest. attempt almost there for changing from json…
Browse files Browse the repository at this point in the history
… to parsing markdown file for each feature from the posts directory.

dquote>
dquote> also added support for robotskirt for markdown parsing.Not using this yet, but will do so when rendering desc for each of these reccomendations.
dquote>
dquote> Added list.js to the template file as it was missing.
  • Loading branch information
Divya Manian committed Dec 12, 2011
1 parent 19b03d6 commit 9a5e603
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 132 deletions.
16 changes: 4 additions & 12 deletions features.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
[
{
"feature": "border-radius",
"status": "use",
"tags": "gtie6 no-polyfill"
},

{
[{
"feature": "SVG",
"status": "use",
"status": "se",
"recco": "All modern browsers support SVG. For legacy browsers, you can use <a href='#'>svgweb</a> as a flash-based polyfill, or develop with <a href='#'>Raphaél</a> which has a VML renderer for <abbr title='Internet Explorer 6-8.'>oldIE</abbr>.",
"tags": "gtie6 gtie7 gtie8 polyfill"
},
Expand Down Expand Up @@ -73,7 +66,7 @@
},
{
"feature": "<code>&lt;input type=range></code>",
"status": "use"
"status": "use",
"tags": "form input polyfill",
"recco": "We recommend you use blah blah, and use <a href='#'>frank yan's polyfill</a> or <a href='#'>freqdec</a>'s."
},
Expand All @@ -100,5 +93,4 @@
"status": "caution",
"tags": "gtie8",
"recco": ""
}
]
}]
110 changes: 4 additions & 106 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link href='css/style.css' rel='stylesheet' />
<script src='js/libs/modernizr-2.0.min.js'></script>
</head>
<body>
<body id="gfs">
<header>
<h1>HTML5 <img src='img/HTML5-logo.png'> Please</h1>
<h2>
Expand All @@ -24,113 +24,11 @@ <h3>
<a href='#'>Divya Manian</a>
</h3>
<h4>
<input name='livesearch' placeholder='type to filter' type='search' value='' />
<input id='livesearch' class='search' name='livesearch' placeholder='type to filter' type='search' value='' />
</h4>
</header>
<div id='main' role='main'>
<section>

<article class="gtie6 no-polyfill">
<h2>border-radius</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="gtie6 gtie7 gtie8 polyfill">
<h2>SVG</h2>
<h3><b><i></i></b></h3>
<p>All modern browsers support SVG. For legacy browsers, you can use <a href='#'>svgweb</a> as a flash-based polyfill, or develop with <a href='#'>Raphaél</a> which has a VML renderer for <abbr title='Internet Explorer 6-8.'>oldIE</abbr>.</p>
</article>

<article class="gtie8 polyfill">
<h2>Canvas</h2>
<h3><b><i></i></b></h3>
<p><a href='#'>FlashCanvas</a> or <a href='#'>excanvas</a> are your polyfills of choice if you absolutely need it.</p>
</article>

<article class="gtie8 polyfill">
<h2>Video/Audio</h2>
<h3><b><i></i></b></h3>
<p>Use mediaelement.js as polyfill for API (flash fallback w/ consistent visual design too).. Video for everyone base setup if No polyfill desired.</p>
</article>

<article class="gtie6 no-polyfill">
<h2>CSS3 Selectors</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="">
<h2><code>data-*</code> attributes</h2>
<h3><b><i></i></b></h3>
<p>GROOVY everywhere obv. old browsers ignore unknown attributes, you can always use <code>getAttribute</code> or you can use the dataset polyfill for IE8+.</p>
</article>

<article class="gtie8 no-polyfill">
<h2>CSS3 Transitions</h2>
<h3><b><i></i></b></h3>
<p>shim layer recomendded to get hwaccel with js fallback (isotope, yui transition, scripty2) ... or let it degrade</p>
</article>

<article class="gtie8 dont-use">
<h2>CSS3 Animations</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="gtie8">
<h2>border-image</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="gtie8">
<h2>box-shadow</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="dont-use">
<h2>box-reflection</h2>
<h3><b><i></i></b></h3>
<p>Webkit only. Dont use.</p>
</article>

<article class="fallback">
<h2>font face</h2>
<h3><b><i></i></b></h3>
<p>don't use cufon. use google webfonts or fontsquirrel generator</p>
</article>

<article class="form input polyfill">
<h2><code>&lt;input type=range></code></h2>
<h3><b><i></i></b></h3>
<p>We recommend you use blah blah, and use <a href='#'>frank yan's polyfill</a> or <a href='#'>freqdec</a>'s.</p>
</article>

<article class="form input dont-use">
<h2><code>&lt;input type=color></code></h2>
<h3><b><i></i></b></h3>
<p>experimental use only</p>
</article>

<article class="form polyfill">
<h2>HTML5 Form Input Validation</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="gtie7">
<h2>background-attachment</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>

<article class="gtie8">
<h2>postMessage</h2>
<h3><b><i></i></b></h3>
<p></p>
</article>
<section class="features">

</section>
</div>
Expand All @@ -143,7 +41,7 @@ <h3><b><i></i></b></h3>
//]]>
</script>
<!-- scripts concatenated and minified via ant build script -->
<script src='js/plugins.js'></script>
<script src='js/libs/list.min.js'></script>
<script src='js/script.js'></script>
<!-- end scripts -->
<script type='text/javascript'>
Expand Down
5 changes: 3 additions & 2 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ exports.Features = Backbone.Collection.extend({
exports.Markup = Backbone.View.extend({
initialize: function() {
var source = fs.readFileSync(TemplateFile).toString();
this.template = Handlebars.compile(source);

this.template = Handlebars.compile(source);
},

render: function() {
console.log("rendering…");
console.log(this.collection);
var html = this.template({ "features": this.collection.toJSON()});
fs.writeFileSync(OutputFile, html);
}
Expand Down
45 changes: 37 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
var fs = require('fs'),
FeaturesData = "./features.json";
var fs = require('fs');

function update() {
try {
// Features data
var Data = JSON.parse(fs.readFileSync("./features.json").toString());
features.reset(Data);
var Data = [];
fs.readdir('./posts', function(err, files) {
files.filter(function(file) { return file.substr(-3); }).forEach(function(file) {
fs.readFile('./posts/' + file, 'utf-8', function(err, contents) {
parser(contents);
});
});
});
//Stolen from Tim Branyen
parser = function(contents) {
var i, len, parts, key, val;
var obj = { metadata: {}, contents: "" };
var docs = contents.split("\n\n");
var lines = docs[0].split("\n");

for (i = 0, len = lines.length; i < len; i++) {
parts = lines[i].trim().split(":");

if (parts.length < 2) {
throw new Error("Invalid key: val");
}

key = parts[0];
val = parts.slice(1).join(":");


obj.metadata[key] = "" + val;
}

obj.contents = docs.slice(1).join("\n\n");

Data.push(obj);
}

features.reset(Data); // Y U NO WORK?

console.log("Features data updated. Rendering…");
} catch(ex) {};
}

Expand All @@ -21,7 +52,5 @@ features.bind("reset", function() {
markup.render();
});

fs.watchFile("./features.json", update);

// Kick off
update();
update();
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"url": "git://github.com/nimbupani/GFS.git"
},
"engines": {
"node": "~v0.4.11"
"node": "~v0.6"
},
"dependencies": {
"backbone": "0.5.3",
"underscore": "1.2.2",
"handlebars": "*"

"handlebars": "*",
"robotskirt": "*",
"node-markdown": "*"
},
"devDependencies": {}
}
2 changes: 1 addition & 1 deletion template.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3><b><i></i></b></h3>
//]]>
</script>
<!-- scripts concatenated and minified via ant build script -->
<script src='js/plugins.js'></script>
<script src='js/libs/list.min.js'></script>
<script src='js/script.js'></script>
<!-- end scripts -->
<script type='text/javascript'>
Expand Down

0 comments on commit 9a5e603

Please sign in to comment.