UNPKG

637 BJavaScriptView Raw
1
2/*!
3 * Jade - nodes - Text
4 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
5 * MIT Licensed
6 */
7
8/**
9 * Module dependencies.
10 */
11
12var Node = require('./node');
13
14/**
15 * Initialize a `Text` node with optional `line`.
16 *
17 * @param {String} line
18 * @api public
19 */
20
21var Text = module.exports = function Text(line) {
22 this.nodes = [];
23 if ('string' == typeof line) this.push(line);
24};
25
26/**
27 * Inherit from `Node`.
28 */
29
30Text.prototype.__proto__ = Node.prototype;
31
32/**
33 * Push the given `node.`
34 *
35 * @param {Node} node
36 * @return {Number}
37 * @api public
38 */
39
40Text.prototype.push = function(node){
41 return this.nodes.push(node);
42};