Render with style.
This commit is contained in:
parent
07aa1c28f6
commit
e9f3725706
@ -87,7 +87,7 @@ def main(src_top, dest_top):
|
|||||||
endpath = os.path.join(dest_top, headline.id + ".node.html")
|
endpath = os.path.join(dest_top, headline.id + ".node.html")
|
||||||
|
|
||||||
with open(endpath, "wt") as f:
|
with open(endpath, "wt") as f:
|
||||||
f.write(render(headline, doc))
|
f.write(as_document(render(headline, doc)))
|
||||||
files_generated += 1
|
files_generated += 1
|
||||||
|
|
||||||
logging.info("Generated {} files".format(files_generated))
|
logging.info("Generated {} files".format(files_generated))
|
||||||
@ -175,7 +175,7 @@ def render(headline, doc):
|
|||||||
else:
|
else:
|
||||||
todo_state = "done"
|
todo_state = "done"
|
||||||
return f"""
|
return f"""
|
||||||
<article id="{html.escape(headline.id)}" class="{todo_state}">
|
<div id="{html.escape(headline.id)}" class="node {todo_state}">
|
||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
{state}
|
{state}
|
||||||
<a href=\"org-protocol://org-id?id={html.escape(headline.id)}\">
|
<a href=\"org-protocol://org-id?id={html.escape(headline.id)}\">
|
||||||
@ -184,10 +184,24 @@ def render(headline, doc):
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
{''.join(content)}
|
{''.join(content)}
|
||||||
</article>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def as_document(html):
|
||||||
|
return f"""
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href="../static/style.css" rel="stylesheet"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{html}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def save_changes(doc):
|
def save_changes(doc):
|
||||||
assert doc.path is not None
|
assert doc.path is not None
|
||||||
with open(doc.path, "wt") as f:
|
with open(doc.path, "wt") as f:
|
||||||
|
13
static/style.css
Normal file
13
static/style.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
.node .node {
|
||||||
|
margin-left: 1ex;
|
||||||
|
padding-left: 1ex;
|
||||||
|
border-left: 1px solid #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
li .tag {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
li .tag::after {
|
||||||
|
content: ": ";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user