Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
TBone is an small JavaScript library for generating valid HTML. It is based on an article by Jason Grosman, "Behind the Code: Avoiding Spaghetti".
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
depreciated
examples
src/gallery-tbone
test-data
.npmignore
.travis.yml
AUTHORS
README.md
index.js
index_test.js
package.json
tbone_test.html
tbone_test.js

README.md

build status

TBone

TBone is an small JavaScript library for generating valid HTML. It is based on an article by Jason Grosman, "Behind the Code: Avoiding Spaghetti". As of version 0.2.x it has been re-written as a YUI module (mostly so I can learn YUI's toolchain :-)

Examples

NodeJS/Mongo Shell example

sample-0.js

    var YUI = require("yui").YUI;

    YUI().use("tbone", function (Y) {
        var TBone = Y.TBone,
            markup = new TBone.HTML();

        // Displaying an HTML 5 valid HTML page.
        Y.log(markup.html(
            markup.head(
                markup.title("Hello World")
            ),
            markup.body(
                markup.h1("Hello World")
            )
        ));
    });

sample-1.js

    YUI().use("tbone", function (Y) {
        var TBone = Y.TBone,
            markup = new TBone.HTML();

        //
        // Generate a simple HTML page.
        //
        var markup = new TBone.HTML(),
            page_source = tbone.html(
                markup.head(
                    "<!-- Test comment -->",
                    markup.title("Simple 0")
                ),
                markup.body(
                    markup.h1("Sample 0"),
                    markup.p("Hello World")
                )
            );

        // Display it
        Y.log(page_source);
    });

sample-2.js

    YUI().use("tbone", function (Y) {
        var TBone = require("tbone");

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

        // Display it
        Y.log(page_source);
Something went wrong with that request. Please try again.