Render titles with markup.
This commit is contained in:
parent
89bf34ed46
commit
cf7cc38bd8
@ -88,7 +88,7 @@ def regen_all(src_top, dest_top, docs=None):
|
|||||||
while i > 0:
|
while i > 0:
|
||||||
i -= 1
|
i -= 1
|
||||||
headline = headlines[i]
|
headline = headlines[i]
|
||||||
if headline.title.strip().lower() == "related" and headline.depth == 1:
|
if headline.title.get_text().strip().lower() == "related" and headline.depth == 1:
|
||||||
if related is not None:
|
if related is not None:
|
||||||
print(
|
print(
|
||||||
"Found duplicated related: {} vs {}".format(
|
"Found duplicated related: {} vs {}".format(
|
||||||
@ -170,7 +170,7 @@ def regen_all(src_top, dest_top, docs=None):
|
|||||||
"relation": "in"
|
"relation": "in"
|
||||||
})
|
})
|
||||||
graph[headline.id] = {
|
graph[headline.id] = {
|
||||||
"title": headline.title.strip(),
|
"title": org_rw.token_list_to_plaintext(headline.title.contents).strip(),
|
||||||
"links": links,
|
"links": links,
|
||||||
"depth": headline.depth,
|
"depth": headline.depth,
|
||||||
}
|
}
|
||||||
@ -311,6 +311,9 @@ def render_results_block(element, acc):
|
|||||||
# acc.append('</code></pre>')
|
# acc.append('</code></pre>')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def render_org_text(element, acc):
|
||||||
|
as_dom = org_rw.text_to_dom(element.contents, element)
|
||||||
|
render_text_tokens(as_dom, acc)
|
||||||
|
|
||||||
def render_text(element, acc):
|
def render_text(element, acc):
|
||||||
acc.append('<div class="text">')
|
acc.append('<div class="text">')
|
||||||
@ -350,6 +353,7 @@ def render_tag(element, acc):
|
|||||||
dom.CodeBlock: render_code_block,
|
dom.CodeBlock: render_code_block,
|
||||||
dom.Text: render_text,
|
dom.Text: render_text,
|
||||||
dom.ResultsDrawerNode: render_results_block,
|
dom.ResultsDrawerNode: render_results_block,
|
||||||
|
org_rw.Text: render_org_text,
|
||||||
}[type(element)](element, acc)
|
}[type(element)](element, acc)
|
||||||
|
|
||||||
|
|
||||||
@ -357,6 +361,11 @@ def render_tree(tree, acc):
|
|||||||
for element in tree:
|
for element in tree:
|
||||||
render_tag(element, acc)
|
render_tag(element, acc)
|
||||||
|
|
||||||
|
def render_inline(tree, f):
|
||||||
|
acc = []
|
||||||
|
f(tree, acc)
|
||||||
|
return ''.join(acc)
|
||||||
|
|
||||||
|
|
||||||
def render(headline, doc, headlineLevel):
|
def render(headline, doc, headlineLevel):
|
||||||
try:
|
try:
|
||||||
@ -390,7 +399,7 @@ def render(headline, doc, headlineLevel):
|
|||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
{state}
|
{state}
|
||||||
<a href=\"javascript:toggle_expand('{html.escape(headline.id)}')\">
|
<a href=\"javascript:toggle_expand('{html.escape(headline.id)}')\">
|
||||||
{html.escape(headline.title)}
|
{render_inline(headline.title, render_tag)}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
<div class='contents'>
|
<div class='contents'>
|
||||||
|
@ -29,11 +29,14 @@ html, body {
|
|||||||
content: "🮦";
|
content: "🮦";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inhibit <p> tags inside items */
|
/* Inhibit <p> tags inside inlined items */
|
||||||
/* TODO: Remove need for this on generator */
|
/* TODO: Remove need for this on generator */
|
||||||
.item p {
|
.item p {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
h1 p,h2 p,h3 p,h4 p,h5 p,h6 p {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
/* Headers */
|
/* Headers */
|
||||||
body > .node > h1 {
|
body > .node > h1 {
|
||||||
|
Loading…
Reference in New Issue
Block a user