aboutsummaryrefslogtreecommitdiff
path: root/lib/document-to-html.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-09 20:44:09 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-09 20:54:02 +0000
commit7a7d96213635a63986b45d74cb1c25bb834f9ca8 (patch)
treeac9cc0068fe86682b94e08f63384ecf5e922a627 /lib/document-to-html.js
parentdae5823ec141dd6e567a05f68db80efc5f728a08 (diff)
Include ID prefix when generating IDs for internal links
Diffstat (limited to 'lib/document-to-html.js')
-rw-r--r--lib/document-to-html.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index 579a11b..8a6e080 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -147,11 +147,15 @@ function DocumentConversion(options) {
});
function noteHtmlId(note) {
- return idPrefix + "-" + note.noteType + "-" + note.noteId;
+ return htmlId(note.noteType + "-" + note.noteId);
}
function noteRefHtmlId(note) {
- return idPrefix + "-" + note.noteType + "-ref-" + note.noteId;
+ return htmlId(note.noteType + "-ref-" + note.noteId);
+ }
+
+ function htmlId(suffix) {
+ return idPrefix + "-" + suffix;
}
function convertTable(element, html, messages, callback) {
@@ -234,7 +238,7 @@ function DocumentConversion(options) {
callback();
},
"hyperlink": function(element, html, messages, callback) {
- var href = element.anchor ? "#" + element.anchor : element.href;
+ var href = element.anchor ? "#" + htmlId(element.anchor) : element.href;
html.open(htmlPaths.element("a", {href: href}));
convertElements(element.children, html, messages, function(err) {
@@ -284,8 +288,8 @@ function DocumentConversion(options) {
callback();
},
"bookmarkStart": function(element, html, messages, callback) {
- html.open(htmlPaths.element("span", {
- id: element.name
+ html.open(htmlPaths.element("a", {
+ id: htmlId(element.name)
}), {alwaysWrite: true});
html.close();
callback();