aboutsummaryrefslogtreecommitdiff
path: root/lib/document-to-html.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-11-28 21:08:40 +0000
committerMichael Williamson <mike@zwobble.org>2016-11-28 21:08:40 +0000
commita12b966752ba7ae880f7d6348a42cc986e891a82 (patch)
treeab244d36ea978f5b75021c9c6b49b53376f33aef /lib/document-to-html.js
parent481d5860686b6b02b5536d7455b88baf7325ecfd (diff)
Map breaks with style maps
Diffstat (limited to 'lib/document-to-html.js')
-rw-r--r--lib/document-to-html.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index a51afd0..3a30ed2 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -283,6 +283,23 @@ function DocumentConversion(options, comments) {
];
}
+ function convertBreak(element, messages) {
+ return htmlPathForBreak(element).wrap(function() {
+ return [];
+ });
+ }
+
+ function htmlPathForBreak(element) {
+ var style = findStyle(element);
+ if (style) {
+ return style.to;
+ } else if (element.breakType === "line") {
+ return htmlPaths.topLevelElement("br");
+ } else {
+ return htmlPaths.empty;
+ }
+ }
+
function wrapChildrenInFreshElement(element, wrapElementName, messages) {
var children = convertElements(element.children, messages);
return [
@@ -349,13 +366,7 @@ function DocumentConversion(options, comments) {
"table": convertTable,
"tableRow": convertTableRow,
"tableCell": convertTableCell,
- "break": function(element, messages) {
- if (element.breakType === "line") {
- return [Html.freshElement("br")];
- } else {
- return [];
- }
- }
+ "break": convertBreak
};
return {
convertToHtml: convertToHtml