Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /*!
|
---|
2 | * Stylus - @block
|
---|
3 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
4 | * MIT Licensed
|
---|
5 | */
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Module dependencies.
|
---|
9 | */
|
---|
10 |
|
---|
11 | var Node = require('./node');
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Initialize a new `@block` node.
|
---|
15 | *
|
---|
16 | * @api public
|
---|
17 | */
|
---|
18 |
|
---|
19 | var Atblock = module.exports = function Atblock(){
|
---|
20 | Node.call(this);
|
---|
21 | };
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Return `block` nodes.
|
---|
25 | */
|
---|
26 |
|
---|
27 | Atblock.prototype.__defineGetter__('nodes', function(){
|
---|
28 | return this.block.nodes;
|
---|
29 | });
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Inherit from `Node.prototype`.
|
---|
33 | */
|
---|
34 |
|
---|
35 | Atblock.prototype.__proto__ = Node.prototype;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Return a clone of this node.
|
---|
39 | *
|
---|
40 | * @return {Node}
|
---|
41 | * @api public
|
---|
42 | */
|
---|
43 |
|
---|
44 | Atblock.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 |
|
---|
60 | Atblock.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 |
|
---|
71 | Atblock.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 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.