UNPKG

1.22 kBJavaScriptView Raw
1/*!
2 * Stylus - @block
3 * Copyright (c) Automattic <developer.wordpress.com>
4 * MIT Licensed
5 */
6
7/**
8 * Module dependencies.
9 */
10
11var Node = require('./node');
12
13/**
14 * Initialize a new `@block` node.
15 *
16 * @api public
17 */
18
19var Atblock = module.exports = function Atblock(){
20 Node.call(this);
21};
22
23/**
24 * Return `block` nodes.
25 */
26
27Atblock.prototype.__defineGetter__('nodes', function(){
28 return this.block.nodes;
29});
30
31/**
32 * Inherit from `Node.prototype`.
33 */
34
35Atblock.prototype.__proto__ = Node.prototype;
36
37/**
38 * Return a clone of this node.
39 *
40 * @return {Node}
41 * @api public
42 */
43
44Atblock.prototype.clone = function(parent){
45 var clone = new Atblock;
46 clone.block = this.block.clone(parent, clone);
47 clone.lineno = this.lineno;
48 clone.column = this.column;
49 clone.filename = this.filename;
50 return clone;
51};
52
53/**
54 * Return @block.
55 *
56 * @return {String}
57 * @api public
58 */
59
60Atblock.prototype.toString = function(){
61 return '@block';
62};
63
64/**
65 * Return a JSON representation of this node.
66 *
67 * @return {Object}
68 * @api public
69 */
70
71Atblock.prototype.toJSON = function(){
72 return {
73 __type: 'Atblock',
74 block: this.block,
75 lineno: this.lineno,
76 column: this.column,
77 fileno: this.fileno
78 };
79};