Detect rel-attributes on <a> elements for :navigate

This commit is contained in:
Florian Bruhin 2017-02-11 20:48:01 +01:00
parent 760f016285
commit bd8ead2279
4 changed files with 24 additions and 1 deletions

View File

@ -65,6 +65,7 @@ Fixed
- Fixed showing of keybindings in the :help completion
- Worked around a segfault when opening a URL after a QtWebEngine renderer process crash
- Using :undo or :tab-clone with a view-source:// or chrome:// tab is now prevented, as it segfaults
- `:navigate prev/next` now detects `rel` attributes on `<a>` elements
v0.9.1
------

View File

@ -72,7 +72,7 @@ def _find_prevnext(prev, elems):
# First check for <link rel="prev(ious)|next">
rel_values = ('prev', 'previous') if prev else ('next')
for e in elems:
if e.tag_name() != 'link' or 'rel' not in e:
if e.tag_name() not in ['link', 'a'] or 'rel' not in e:
continue
if e['rel'] in rel_values:
log.hints.debug("Found {!r} with rel={}".format(e, e['rel']))

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Navigate</title>
</head>
<body>
<p>Index page</p>
<a href="/data/navigate/prev.html" rel="prev">bla</a>
<a href="/data/navigate/next.html" rel="next">blub</a>
</body>
</html>

View File

@ -43,6 +43,16 @@ Feature: Using :navigate
And I run :navigate next
Then data/navigate/next.html should be loaded
Scenario: Navigating to previous page with rel
When I open data/navigate/rel.html
And I run :navigate prev
Then data/navigate/prev.html should be loaded
Scenario: Navigating to next page with rel
When I open data/navigate/rel.html
And I run :navigate next
Then data/navigate/next.html should be loaded
# increment/decrement
Scenario: Incrementing number in URL