Closed avarone-github closed 3 years ago
After further investigations, it seems to me the problem has to do with the is_doc function inside prprocessor/links/util.py and the use of os.path instead of posixpath inside the same file when working under Windows. The is_doc doesn't recognize an href ending with a slash (default document) as a "document". The normalize_href function, in its turn, replaces slashes with "operating system slashes" (i.e., under Windows, backslashes), which seems not good for subsequent links operations. In the is_doc function I tried and change line 14 from:
htmlfile = ext.startswith('.html')
to:
htmlfile = ext.startswith('.html') or href.endswith('/')
in order to recognize default documents as legitimate "documents". I also replaced import os with import posixpath and replaced all references to os.path with references to posixpath. This seems to solve the problem, but I would greatly appreciate a feedback from the authors.
@avarone-github,
Quite busy currently, we'll look into this issue as soon as possible and come back to you with a feedback on the suggested fix.
KR, Gerry Ntabuhashe
this change does not work well. I get many anchor errors. Some links in the document work, some not. The TOC is half-broken.
In docs folder structure I have dokumentacia_k_produktu
, caste_problemy
and dokumentacia_k_zdrojovemu_kodu
directly in docs, not nested as can be seen in the errors
ERROR - Content discarded: target points to undefined anchor "('string', '#dokumentacia_k_produktu/prirucky/pouzivatelska_prirucka/obmedzovace/#mkpdf-dokumentacia_k_produktu/prirucky/pouzivatelska_prirucka/obmedzovace/:')"
ERROR - Content discarded: target points to undefined anchor "('string', '#dokumentacia_k_produktu/prirucky/pouzivatelska_prirucka/analyza_moonscript_projektov/#mkpdf-dokumentacia_k_produktu/prirucky/pouzivatelska_prirucka/analyza_moonscript_projektov/:')"
ERROR - Content discarded: target points to undefined anchor "('string', '#dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/#mkpdf-dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/:')"
ERROR - Content discarded: target points to undefined anchor "('string', '#dokumentacia_k_produktu/caste_problemy/#mkpdf-dokumentacia_k_produktu/caste_problemy/:')"
ERROR - No anchor #dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/#mkpdf-dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/: for internal URI reference
ERROR - No anchor #dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/#mkpdf-dokumentacia_k_produktu/dokumentacia_k_zdrojovemu_kodu/: for internal URI reference
ERROR - No anchor #dokumentacia_k_produktu/caste_problemy/#mkpdf-dokumentacia_k_produktu/caste_problemy/: for internal URI reference
ERROR - No anchor #dokumentacia_k_produktu/caste_problemy/#mkpdf-dokumentacia_k_produktu/caste_problemy/: for internal URI reference
@avarone-github problem seems to be fixed by #35 which is part of the upcoming release
Generated PDF contains file system links instead of internal links. This is mkdocs.yml:
These are the .md file contained in the docs folder:
index.md:
one.md:
two.md:
See combined.pdf file: TOC links are OK, links contained inside the pages point to a kind of file system path (e.g., file:///E|/mkpdfs_test/two/) which is not good. All link inside the static HTML site are OK, link syntax is allowed.