check_links - use devportal config dirs, handle HEAD 404 better; parse_pages - sub links in template HTML too

(cherry picked from commit 2f3c18246c3d590e85ab2af7991ce9b470340400)
This commit is contained in:
mDuo13
2016-02-25 16:49:22 -08:00
parent c7de77110e
commit 798ea6fa40
3 changed files with 53 additions and 18 deletions

View File

@@ -184,7 +184,7 @@ def parse_markdown(md, target=None, pages=None):
#buttonize links ending in >
buttonize_try_it(soup)
# Replace links for live site
# Replace links for any non-default target
if target["name"] != config["targets"][0]["name"]:
substitute_links_for_target(soup, target)
@@ -375,6 +375,12 @@ def render_pages(target=None, for_pdf=False, bypass_errors=False):
pages=pages,
content=html_content)
# Experimental: replace links in full HTML, not just content
soup = BeautifulSoup(out_html, "html.parser")
if target["name"] != config["targets"][0]["name"]:
substitute_links_for_target(soup, target)
out_html = str(soup)
if for_pdf:
out_path = config["temporary_files_path"]
else: