Generate code blocks.
This commit is contained in:
parent
8698035f2e
commit
81e6935157
@ -7,6 +7,7 @@ import sys
|
|||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
import org_rw
|
||||||
from org_rw import OrgTime, dom, Link
|
from org_rw import OrgTime, dom, Link
|
||||||
from org_rw import dump as dump_org
|
from org_rw import dump as dump_org
|
||||||
from org_rw import load as load_org
|
from org_rw import load as load_org
|
||||||
@ -152,7 +153,17 @@ def render_list_item(element, acc):
|
|||||||
|
|
||||||
|
|
||||||
def render_code_block(element, acc):
|
def render_code_block(element, acc):
|
||||||
pass
|
acc.append('<pre><code>')
|
||||||
|
for line in element.lines:
|
||||||
|
if isinstance(line, org_rw.org_rw.Text):
|
||||||
|
for tok in line.contents:
|
||||||
|
if not isinstance(tok, org_rw.org_rw.MarkerToken):
|
||||||
|
acc.append(tok)
|
||||||
|
elif isinstance(line, dom.CodeBlock):
|
||||||
|
print(line.lines)
|
||||||
|
else:
|
||||||
|
print(type(line))
|
||||||
|
acc.append('</code></pre>')
|
||||||
|
|
||||||
|
|
||||||
def render_text(element, acc):
|
def render_text(element, acc):
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
/* Any node */
|
/* Node styling */
|
||||||
.node {
|
.node {
|
||||||
max-width: min(650px, 100ex);
|
max-width: min(650px, 100ex);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inner node */
|
|
||||||
.node .node {
|
.node .node {
|
||||||
margin: 2em 0ex 2em 0.5ex;
|
margin: 2em 0ex 2em 0.5ex;
|
||||||
padding: 1ex 0 1ex 1ex;
|
padding: 1ex 0 1ex 1ex;
|
||||||
@ -24,6 +23,7 @@
|
|||||||
content: "🮦";
|
content: "🮦";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
}
|
}
|
||||||
@ -47,6 +47,7 @@ h1.title .state {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lists */
|
||||||
li .tag {
|
li .tag {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -54,3 +55,25 @@ li .tag {
|
|||||||
li .tag::after {
|
li .tag::after {
|
||||||
content: ":: ";
|
content: ":: ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Code blocks */
|
||||||
|
pre {
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0.5ex;
|
||||||
|
padding-left: 0.5ex;
|
||||||
|
padding-left: 1.5ex;
|
||||||
|
background-color: #eee8d5;
|
||||||
|
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.26);
|
||||||
|
}
|
||||||
|
pre > code {
|
||||||
|
display: block;
|
||||||
|
line-height: 1.2em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
padding: 0.5ex;
|
||||||
|
font-size: medium;
|
||||||
|
border: 2px solid #eee8d5;
|
||||||
|
background: #fdf6e3;
|
||||||
|
color: #073642;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user