|
|
@ -194,4 +194,28 @@ Token.prototype.attrJoin = function attrJoin(name, value) { |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Token.clone() |
|
|
|
* |
|
|
|
* Obtain a shallow clone of the token. You can use this while rendering to |
|
|
|
* prevent modifying the token list while rendering. |
|
|
|
*/ |
|
|
|
|
|
|
|
Token.prototype.clone = function clone() { |
|
|
|
var token = new Token(this.type, this.tag, this.nesting); |
|
|
|
|
|
|
|
token.attrs = this.attrs; |
|
|
|
token.level = this.level; |
|
|
|
token.children = this.children; |
|
|
|
token.content = this.content; |
|
|
|
token.map = this.map; |
|
|
|
token.markup = this.markup; |
|
|
|
token.info = this.info; |
|
|
|
token.meta = this.meta; |
|
|
|
token.block = this.block; |
|
|
|
token.hidden = this.hidden; |
|
|
|
|
|
|
|
return token; |
|
|
|
}; |
|
|
|
|
|
|
|
module.exports = Token; |
|
|
|