aboutsummaryrefslogtreecommitdiff
path: root/lib/document-to-html.js
diff options
context:
space:
mode:
authorAndreas Lubbe <git@lubbe.org>2015-01-23 18:24:23 +0100
committerMichael Williamson <mike@zwobble.org>2015-02-09 20:31:51 +0000
commit4d4d9e669b389be294373cf3c9bd4727dd5f32af (patch)
treed66a47574dfea6c24328aa296cb3b67f2d7890f2 /lib/document-to-html.js
parent37cdbc47dc105a3c745e0f718843e68cf1741aed (diff)
Add support for internal hyperlinks
Diffstat (limited to 'lib/document-to-html.js')
-rw-r--r--lib/document-to-html.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index c068fba..000fc5c 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -234,7 +234,9 @@ function DocumentConversion(options) {
callback();
},
"hyperlink": function(element, html, messages, callback) {
- html.open(htmlPaths.element("a", {href: element.href}));
+ var href = element.anchor ? "#" + element.anchor : element.href;
+
+ html.open(htmlPaths.element("a", {href: href}));
convertElements(element.children, html, messages, function(err) {
if (err) {
callback(err);
@@ -280,6 +282,17 @@ function DocumentConversion(options) {
"lineBreak": function(element, html, messages, callback) {
html.selfClosing(htmlPaths.element("br"));
callback();
+ },
+ "bookmarkStart": function(element, html, messages, callback) {
+ if (element.name === "_GoBack") {
+ return callback();
+ }
+
+ html.open(htmlPaths.element("span", {
+ id: element.name
+ }), {alwaysWrite: true});
+ html.close();
+ callback();
}
};
return {