Browse Source

Markdown.pl: do not leave remnant state lying around

When commit c86fea4089 ("Markdown:
enhance link handling", 2019-10-20, markdown_1.1.8) did its thing,
a new global (%g_anchors_id) was introduced to keep track of all
the link ids being used/generated in order to better connect them
up to the links meant to target them.

Unfortunately, that hash was not getting cleared before processing
each new document.  While this is mostly not a problem when running
from the command line since typically only one document ever gets
processed at once, if more than one document is processed at a time,
prior documents could affect the link fragment targets for subsequent
documents.

Correct the problem by properly resetting the global (along with
all the others that are also reset) before processing a new document.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 4 years ago
parent
commit
e004a5275c
  1. 1
      Markdown.pl

1
Markdown.pl

@ -1040,6 +1040,7 @@ sub Markdown {
%g_urls = ();
%g_titles = ();
%g_anchors = ();
%g_anchors_id = ();
%g_block_ids = ();
%g_code_block_ids = ();
%g_html_blocks = ();

Loading…
Cancel
Save