aboutsummaryrefslogtreecommitdiff
path: root/lib/style-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-11-28 21:22:41 +0000
committerMichael Williamson <mike@zwobble.org>2016-11-28 21:22:41 +0000
commit72ad04159683e8958ff957695fc9bb224fc376ca (patch)
tree9c122c874a5ad16dd50857fef2bc340295fc5729 /lib/style-reader.js
parenta12b966752ba7ae880f7d6348a42cc986e891a82 (diff)
Parse break style mappings
Diffstat (limited to 'lib/style-reader.js')
-rw-r--r--lib/style-reader.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/style-reader.js b/lib/style-reader.js
index 20cdb56..3a71ef6 100644
--- a/lib/style-reader.js
+++ b/lib/style-reader.js
@@ -139,13 +139,35 @@ function documentMatcherRule() {
var strikethrough = identifierToConstant("strike", documentMatchers.strikethrough);
var commentReference = identifierToConstant("comment-reference", documentMatchers.commentReference);
+ var breakMatcher = sequence(
+ lop.rules.token("identifier", "br"),
+ sequence.cut(),
+ lop.rules.tokenOfType("open-square-bracket"),
+ lop.rules.token("identifier", "type"),
+ lop.rules.tokenOfType("equals"),
+ sequence.capture(stringRule),
+ lop.rules.tokenOfType("close-square-bracket")
+ ).map(function(breakType) {
+ switch (breakType) {
+ case "line":
+ return documentMatchers.lineBreak;
+ case "page":
+ return documentMatchers.pageBreak;
+ case "column":
+ return documentMatchers.columnBreak;
+ default:
+ // TODO: handle unknown document matchers
+ }
+ });
+
return lop.rules.firstOf("element type",
paragraphOrRun,
bold,
italic,
underline,
strikethrough,
- commentReference
+ commentReference,
+ breakMatcher
);
}