Merge branch 'rsteube-master'
This commit is contained in:
commit
69ffb45152
@ -45,6 +45,8 @@ Added
|
|||||||
parameters (like `utm_source` etc.) to strip off when yanking an URL.
|
parameters (like `utm_source` etc.) to strip off when yanking an URL.
|
||||||
- Support for the
|
- Support for the
|
||||||
https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API[HTML5 page visibility API]
|
https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API[HTML5 page visibility API]
|
||||||
|
- New `readability` userscript which shows a readable version of a page (using
|
||||||
|
the `readability-lxml` python package)
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -227,6 +227,7 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Franz Fellner
|
* Franz Fellner
|
||||||
* zwarag
|
* zwarag
|
||||||
* xd1le
|
* xd1le
|
||||||
|
* rsteube
|
||||||
* rmortens
|
* rmortens
|
||||||
* oniondreams
|
* oniondreams
|
||||||
* issue
|
* issue
|
||||||
|
25
misc/userscripts/readability
Executable file
25
misc/userscripts/readability
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
#
|
||||||
|
# Executes python-readability on current page and opens the summary as new tab.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# :spawn --userscript readability
|
||||||
|
#
|
||||||
|
from __future__ import absolute_import
|
||||||
|
import codecs, os
|
||||||
|
from readability.readability import Document
|
||||||
|
|
||||||
|
tmpfile=os.path.expanduser('~/.local/share/qutebrowser/userscripts/readability.html')
|
||||||
|
if not os.path.exists(os.path.dirname(tmpfile)):
|
||||||
|
os.makedirs(os.path.dirname(tmpfile))
|
||||||
|
|
||||||
|
with codecs.open(os.environ['QUTE_HTML'], 'r', 'utf-8') as source:
|
||||||
|
doc = Document(source.read())
|
||||||
|
content = doc.summary().replace('<html>', '<html><head><title>%s</title></head>' % doc.title())
|
||||||
|
|
||||||
|
with codecs.open(tmpfile, 'w', 'utf-8') as target:
|
||||||
|
target.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />')
|
||||||
|
target.write(content)
|
||||||
|
|
||||||
|
with open(os.environ['QUTE_FIFO'], 'w') as fifo:
|
||||||
|
fifo.write('open -t %s' % tmpfile)
|
Loading…
Reference in New Issue
Block a user