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: for page in pages:
if target in page: if target in page:
#There's a replacement link for this env #There's a replacement link for this env
if page["html"] in link["href"]: local_url = page["html"]
link["href"] = link["href"].replace(page["html"], target_url = page[target]
page[target]) if link["href"][:len(local_url)] == local_url:
link["href"] = link["href"].replace(local_url,
target_url)
print("done") print("done")
print("re-rendering HTML") print("re-rendering HTML")