From 493e9ee8d9b14f8de9fade620d9218d5439e9d7c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 8 Feb 2015 20:33:32 +0000 Subject: Simplify anchor position handling --- lib/writers/markdown-writer.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib') 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); } } -- cgit v1.2.3