parse_pages - fix bug with local URLs that are substrings of another

This commit is contained in:
mDuo13
2015-11-30 18:14:34 -08:00
parent e4b69054b9
commit 6e9f26ce9d

View File

@@ -110,9 +110,11 @@ def parse_markdown(md, target=DEFAULT_TARGET, pages=None):
for page in pages:
if target in page:
#There's a replacement link for this env
if page["html"] in link["href"]:
link["href"] = link["href"].replace(page["html"],
page[target])
local_url = page["html"]
target_url = page[target]
if link["href"][:len(local_url)] == local_url:
link["href"] = link["href"].replace(local_url,
target_url)
print("done")
print("re-rendering HTML")