Merge branch 'master' of https://github.com/qutebrowser/qutebrowser
This commit is contained in:
commit
15b00cea6a
@ -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
|
||||
~~~~~~~
|
||||
|
@ -349,6 +349,23 @@ def qute_gpl(_url):
|
||||
return 'text/html', utils.read_file('html/license.html')
|
||||
|
||||
|
||||
def _asciidoc_fallback_path(path):
|
||||
"""Fall back to plaintext asciidoc if the HTML is unavailable."""
|
||||
asciidoc_path = path.replace('.html', '.asciidoc')
|
||||
asciidoc_paths = [asciidoc_path]
|
||||
if asciidoc_path.startswith('html/doc/'):
|
||||
asciidoc_paths += [asciidoc_path.replace('html/doc/', '../doc/help/'),
|
||||
asciidoc_path.replace('html/doc/', '../doc/')]
|
||||
|
||||
for path in asciidoc_paths:
|
||||
try:
|
||||
return utils.read_file(path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
@add_handler('help')
|
||||
def qute_help(url):
|
||||
"""Handler for qute://help."""
|
||||
@ -373,15 +390,7 @@ def qute_help(url):
|
||||
try:
|
||||
data = utils.read_file(path)
|
||||
except OSError:
|
||||
# No .html around, let's see if we find the asciidoc
|
||||
asciidoc_path = path.replace('.html', '.asciidoc')
|
||||
if asciidoc_path.startswith('html/doc/'):
|
||||
asciidoc_path = asciidoc_path.replace('html/doc/', '../doc/help/')
|
||||
|
||||
try:
|
||||
asciidoc = utils.read_file(asciidoc_path)
|
||||
except OSError:
|
||||
asciidoc = None
|
||||
asciidoc = _asciidoc_fallback_path(path)
|
||||
|
||||
if asciidoc is None:
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user