Try more possible asciidoc paths for qute://help fallback

This commit is contained in:
Florian Bruhin 2018-09-17 09:51:15 +02:00
parent 02f47b519c
commit be0d6ef3d2
2 changed files with 14 additions and 5 deletions

View File

@ -60,6 +60,8 @@ Fixed
- Error when passing a substring with spaces to `:tab-take`.
- Greasemonkey scripts which start with an UTF-8 BOM are now handled correctly.
- When no documentation has been generated, the plaintext documentation now can
be shown for more files such as `qute://help/userscripts.html`.
Removed
~~~~~~~

View File

@ -375,13 +375,20 @@ def qute_help(url):
except OSError:
# No .html around, let's see if we find the asciidoc
asciidoc_path = path.replace('.html', '.asciidoc')
asciidoc_paths = [asciidoc_path]
if asciidoc_path.startswith('html/doc/'):
asciidoc_path = asciidoc_path.replace('html/doc/', '../doc/help/')
asciidoc_paths += [asciidoc_path.replace('html/doc/', '../doc/help/'),
asciidoc_path.replace('html/doc/', '../doc/')]
try:
asciidoc = utils.read_file(asciidoc_path)
except OSError:
asciidoc = None
asciidoc = None
for path in asciidoc_paths:
try:
asciidoc = utils.read_file(path)
except OSError:
pass
else:
break
if asciidoc is None:
raise