diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-07 20:44:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-07 20:44:20 +0100 |
| commit | baf9808eae3441de70a00cd043e10e0ebf06b7c0 (patch) | |
| tree | 869bcc8376caf7b730f501472d507e816733e565 /lib/style-reader.js | |
| parent | b5768bced10c6dafe8bc621c6ef01aa0bd9d975c (diff) | |
Add HTML path for ignoring elements
Diffstat (limited to 'lib/style-reader.js')
| -rw-r--r-- | lib/style-reader.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/style-reader.js b/lib/style-reader.js index ab9a171..fe60930 100644 --- a/lib/style-reader.js +++ b/lib/style-reader.js @@ -177,16 +177,21 @@ function htmlPathRule() { return htmlPaths.element(tagName, attributes, options); }); - return lop.rules.then( - lop.rules.zeroOrMoreWithSeparator( - styleElementRule, - lop.rules.sequence( - whitespaceRule, - lop.rules.tokenOfType("gt"), - whitespaceRule - ) - ), - htmlPaths.elements + return lop.rules.firstOf("html path", + lop.rules.then(lop.rules.tokenOfType("bang"), function() { + return htmlPaths.ignore; + }), + lop.rules.then( + lop.rules.zeroOrMoreWithSeparator( + styleElementRule, + lop.rules.sequence( + whitespaceRule, + lop.rules.tokenOfType("gt"), + whitespaceRule + ) + ), + htmlPaths.elements + ) ); } @@ -234,7 +239,8 @@ function tokenise(string) { {name: "close-square-bracket", regex: /\]/}, {name: "string", regex: /'([^']*)'/}, {name: "integer", regex: /([0-9]+)/}, - {name: "choice", regex: /\|/} + {name: "choice", regex: /\|/}, + {name: "bang", regex: /(!)/} ]); return tokeniser.tokenise(string); } |
