🎩 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.

Source
npmnpm
Version
0.1.5
Version published
Weekly downloads
11
266.67%
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".

It is designed to work in NodeJS, Mongo's shell (via mongo-modules).

Examples

NodeJS/Mongo Shell example

sample-0.js

	var TBone = require("tbone"),
		markup = new TBone.HTML();

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

sample-1.js

	var TBone = require("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
	console.log(page_source);

sample-2.js

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
console.log(page_source);

FAQs

Package last updated on 12 Oct 2012

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