🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

tbone

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tbone

A simple library to generate valid HTML markup.

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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);

FAQs

Package last updated on 21 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts