diff options
| author | Craig Leinoff <leinoff@un.org> | 2014-01-06 18:11:33 -0500 |
|---|---|---|
| committer | Craig Leinoff <leinoff@un.org> | 2014-01-06 18:11:33 -0500 |
| commit | d9fbde9f0b200da41888df0189e0b83f983ed46a (patch) | |
| tree | a7a1c0fa4e0836f4599c3f04641853d3a548eb45 /lib/heuristics-processor.js | |
| parent | 24b0789dfacffd38fc16724ea1b2b8a14b49b29d (diff) | |
Adding heuristicis processing as separate step.
Diffstat (limited to 'lib/heuristics-processor.js')
| -rw-r--r-- | lib/heuristics-processor.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/heuristics-processor.js b/lib/heuristics-processor.js new file mode 100644 index 0000000..1c49f9d --- /dev/null +++ b/lib/heuristics-processor.js @@ -0,0 +1,28 @@ +exports.HeuristicsProcessor = HeuristicsProcessor; + +var q = require("q"); + +function HeuristicsProcessor() { + function processHeuristics(document) { + for (var i = 0; i < document.value.children.length; i++) { + var element = document.value.children[i]; + switch (element.type) { + case 'paragraph': + document.value.children[i] = processParagraph(document.value.children[i]); + break; + } + } + return document; + } + + function processParagraph(element) { + if (element.alignment == 'center' && !element.styleName) { + element.styleName = "CenteredHeading"; + } + return element; + } + + return { + processHeuristics: processHeuristics + } +}
\ No newline at end of file |
