summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-08 20:33:32 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-08 20:33:32 +0000
commit493e9ee8d9b14f8de9fade620d9218d5439e9d7c (patch)
tree64d8c68e595fb6b30f7468ff2cd408885c19b0d8
parent85d51bf4e8c4bb7691bb041f21ec6cce42ddbf16 (diff)
Simplify anchor position handling
-rw-r--r--lib/writers/markdown-writer.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/writers/markdown-writer.js b/lib/writers/markdown-writer.js
index 268b8fb..872db13 100644
--- a/lib/writers/markdown-writer.js
+++ b/lib/writers/markdown-writer.js
@@ -98,8 +98,6 @@ function markdownWriter() {
function open(tagName, attributes) {
attributes = attributes || {};
- var idHasBeenWritten = false;
-
var createElement = htmlToMarkdown[tagName] || function() { return {}; };
var element = createElement(attributes, list, listItem);
elementStack.push({end: element.end, list: list});
@@ -108,13 +106,13 @@ function markdownWriter() {
list = element.list;
}
- if (element.anchorPosition === "before") {
+ var anchorBeforeStart = element.anchorPosition === "before";
+ if (anchorBeforeStart) {
writeAnchor(attributes);
- idHasBeenWritten = true;
}
fragments.push(element.start || "");
- if (!idHasBeenWritten) {
+ if (!anchorBeforeStart) {
writeAnchor(attributes);
}
}