Skip to content
Snippets Groups Projects
Commit d3b0945a authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

prace: box -> LineMarkup

parent e139356c
Branches
No related tags found
No related merge requests found
import panflute as pf import panflute as pf
from formatitko.command_env import parse_string from formatitko.command_env import parse_string
from formatitko.elements import Slanted from formatitko.elements import Slanted, FLineMarkup
formatitko_commands={} formatitko_commands={}
def formatitko_command(f): def formatitko_command(f):
...@@ -45,6 +45,14 @@ def box(element, context, processor): ...@@ -45,6 +45,14 @@ def box(element, context, processor):
'lemma': "Lemma", 'lemma': "Lemma",
'def': "Definice", 'def': "Definice",
}[element.attributes["t"]] }[element.attributes["t"]]
color = {
'fact': "red",
'task': "orange",
'algo': "brown",
'theorem': "green",
'lemma': "lightgreen",
'def': "blue",
}.get(element.attributes["t"], "black")
out = [] out = []
intro = [] intro = []
if 'name' in element.attributes: if 'name' in element.attributes:
...@@ -56,12 +64,12 @@ def box(element, context, processor): ...@@ -56,12 +64,12 @@ def box(element, context, processor):
for e in content: for e in content:
if not out: if not out:
if isinstance(e, pf.Para): if isinstance(e, pf.Para):
out.append(pf.Para(intro, Slanted(*e.content))) out.append(pf.Para(intro, *e.content))
else: else:
raise NotImplemented() raise NotImplemented()
else: else:
out += make_emph(e, wrap_class=Slanted) out.append(e)
return out return [FLineMarkup(*out, color=color)]
@formatitko_command @formatitko_command
def proof(element, context, processor): def proof(element, context, processor):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment