Whitespace
This commit is contained in:
parent
9516e36b78
commit
c2df7e8bf4
|
|
@ -21,16 +21,24 @@ tmpfile = os.path.join(
|
|||
if not os.path.exists(os.path.dirname(tmpfile)):
|
||||
os.makedirs(os.path.dirname(tmpfile))
|
||||
|
||||
# styling for window size depended margin scaling and line height
|
||||
header = """<!DOCTYPE html>
|
||||
# Styling for dynamic window margin scaling and line height
|
||||
HEADER = """
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>%s</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<style type="text/css">
|
||||
body{margin:40px auto;max-width:650px;line-height:1.4;padding:0 10px}
|
||||
h1,h2,h3{line-height:1.2}
|
||||
body {
|
||||
margin: 40px auto;
|
||||
max-width: 650px;
|
||||
line-height: 1.4;
|
||||
padding: 0 10px;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
line-height: 1.2;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
"""
|
||||
|
|
@ -42,15 +50,15 @@ with codecs.open(os.environ['QUTE_HTML'], 'r', 'utf-8') as source:
|
|||
from breadability.readable import Article as reader
|
||||
doc = reader(data)
|
||||
title = doc._original_document.title
|
||||
content = header % title + doc.readable + "</html>"
|
||||
content = HEADER % title + doc.readable + "</html>"
|
||||
except ImportError:
|
||||
from readability import Document
|
||||
doc = Document(data)
|
||||
title = doc.title()
|
||||
content = doc.summary().replace('<html>', header % title)
|
||||
content = doc.summary().replace('<html>', HEADER % title)
|
||||
|
||||
with codecs.open(tmpfile, 'w', 'utf-8') as target:
|
||||
target.write(content)
|
||||
target.write(content.lstrip())
|
||||
|
||||
with open(os.environ['QUTE_FIFO'], 'w') as fifo:
|
||||
fifo.write('open -t %s' % tmpfile)
|
||||
|
|
|
|||
Loading…
Reference in New Issue