Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Added examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Oct 5, 2012
1 parent d18e3c1 commit fbd2a3b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/sample-0.js
@@ -0,0 +1,35 @@
/**
* simple-0.js - this generates a simple "Hello World" page.
*
* author R. S. Doiel, <rsdoiel@gmail.com>
*
* copyright (c) 2012 all rights reserved
*
* Released under the Simplified BSD License.
* See: http://opensource.org/licenses/bsd-license.php
*
* Notes: runs under NodeJS, Mongo 2.2 shell and web browsers
*/
/*jslint devel: true, node: true, maxerr: 25, indent: 4, vars: true, sloppy: true */
var fs = require("fs"),
path = require("path"),
TBone = require("../tbone");

//
// Generate a simple HTML page.
//
var HTML = new TBone.HTML(),
page_source = HTML.html(
HTML.head(
HTML.title("Simple 0")
),
HTML.body(
HTML.h1("Sample 0"),
HTML.p("Hello World")
)
).toString();

// Display it
console.log(page_source);
// Render it to disc as sample-0.html
fs.writeFile("sample-0.html", page_source);
35 changes: 35 additions & 0 deletions examples/sample-1.js
@@ -0,0 +1,35 @@
/**
* simple-0.js - this generates a simple "Hello World" page.
*
* author R. S. Doiel, <rsdoiel@gmail.com>
*
* copyright (c) 2012 all rights reserved
*
* Released under the Simplified BSD License.
* See: http://opensource.org/licenses/bsd-license.php
*
* Notes: runs under NodeJS, Mongo 2.2 shell and web browsers
*/
/*jslint devel: true, node: true, maxerr: 25, indent: 4, vars: true, sloppy: true */
var fs = require("fs"),
path = require("path"),
TBone = require("../tbone");

//
// Generate a simple HTML page.
//
var HTML = new TBone.HTML(),
page_source = HTML.html(
HTML.head(
HTML.title("Simple 1")
),
HTML.body(
HTML.h1("Sample 1").attr({"class": "banner"}),
HTML.p("Hello Again World").attr({"class": "content"})
)
).toString();

// Display it
console.log(page_source);
// Render it to disc as sample-0.html
fs.writeFile("sample-0.html", page_source);

0 comments on commit fbd2a3b

Please sign in to comment.