aboutsummaryrefslogtreecommitdiff
path: root/lib/style-applicator.js
diff options
context:
space:
mode:
authorCraig Leinoff <leinoff@un.org>2014-01-07 11:50:49 -0500
committerCraig Leinoff <leinoff@un.org>2014-01-07 11:50:49 -0500
commitb3cc8c0c5ce2aa2e556e995d587da5a00c6a3185 (patch)
tree7b0a1e3b259595842817f1d0b703484bab4acc11 /lib/style-applicator.js
parent6b6872357118572f7243967888e1f4c621db0f99 (diff)
Renaming heuristics-processor to style-applicator
Diffstat (limited to 'lib/style-applicator.js')
-rw-r--r--lib/style-applicator.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/style-applicator.js b/lib/style-applicator.js
new file mode 100644
index 0000000..0e3c97d
--- /dev/null
+++ b/lib/style-applicator.js
@@ -0,0 +1,26 @@
+exports.HeuristicsProcessor = HeuristicsProcessor;
+
+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