aboutsummaryrefslogtreecommitdiff
path: root/lib/style-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-08-28 19:55:24 +0100
committerMichael Williamson <mike@zwobble.org>2016-08-28 19:55:38 +0100
commitb1ae23f544c479d2b71347bbf67df7baac40d78f (patch)
tree383e694dae42ba544f690c3b0ab388a7931c0793 /lib/style-reader.js
parent7dba15069f9a606b9e248d7e4cd024ddaa6ac3e3 (diff)
parentc42714e5f4b643de27b106a084601e39b7e5d04c (diff)
Merge branch 'master' into image-errors
Conflicts: test/mammoth.tests.js
Diffstat (limited to 'lib/style-reader.js')
-rw-r--r--lib/style-reader.js28
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);
}