Skip to content
Snippets Groups Projects
Verified Commit 1d4300b8 authored by Jake's avatar Jake
Browse files

added support for lineblocks

parent 990cb144
No related branches found
No related tags found
No related merge requests found
...@@ -463,6 +463,29 @@ class BlockTable(Block): # Attr Caption [ColSpec] TableHead [TableBody] TableFoo ...@@ -463,6 +463,29 @@ class BlockTable(Block): # Attr Caption [ColSpec] TableHead [TableBody] TableFoo
res["rows"] = self.parse_rows(raw_foot[1]) res["rows"] = self.parse_rows(raw_foot[1])
return res return res
class BlockLineBlock(Block): # [[Inline]]
etype = "lineblock"
"""
[
[
{'t': 'Str', 'c': 'Fachgruppe'}, {'t': 'Space'}, {'t': 'Str', 'c': 'Informatik'}, {'t': 'Space'}, {'t': 'Str', 'c': 'Georg-August-Universität'}, {'t': 'Space'}, {'t': 'Str', 'c': 'Göttingen'}
], [
{'t': 'Str', 'c': 'Goldschmidtstr.'}, {'t': 'Space'}, {'t': 'Str', 'c': '7'}
], [
{'t': 'Str', 'c': 'Institut'}, {'t': 'Space'}, {'t': 'Str', 'c': 'für'}, {'t': 'Space'}, {'t': 'Str', 'c': 'Informatik'}
], [
{'t': 'Str', 'c': '37077'}, {'t': 'Space'}, {'t': 'Str', 'c': 'Göttingen'}
]
]
})
"""
def parse_internal(self, pandocraw):
self.lines = []
for line in pandocraw:
self.lines.append(self.parse_inlines(line))
self.linecount = len(self.lines)
############################## INLINE ######################################### ############################## INLINE #########################################
...@@ -696,7 +719,7 @@ block_parsing_register = { ...@@ -696,7 +719,7 @@ block_parsing_register = {
"HorizontalRule": BlockHorizontalRule, "HorizontalRule": BlockHorizontalRule,
"Table" : BlockTable, "Table" : BlockTable,
"DefinitionList": BlockDefinitionList, "DefinitionList": BlockDefinitionList,
#"LineBlock" :{"type":"lineblock", "TODO": True, "c" : [] }, # [[Inline]] # TODO find file that triggers LineBlock "LineBlock" : BlockLineBlock,
#"Null" :{"type":"nothing" }, # TODO find file that triggers Null #"Null" :{"type":"nothing" }, # TODO find file that triggers Null
} }
......
...@@ -91,6 +91,8 @@ ...@@ -91,6 +91,8 @@
{{ render_block_table(block, lang, meta) }} {{ render_block_table(block, lang, meta) }}
{%- elif etype == "definitionlist" -%} {%- elif etype == "definitionlist" -%}
{{ render_block_definitionlist(block, lang, meta) }} {{ render_block_definitionlist(block, lang, meta) }}
{%- elif etype == "lineblock" -%}
{{ render_block_lineblock(block, lang, meta) }}
{%- else -%} {%- else -%}
<br><strong>ERROR: Unhandled block type: '{{ etype|e }}'</strong><br> <br><strong>ERROR: Unhandled block type: '{{ etype|e }}'</strong><br>
{%- endif -%} {%- endif -%}
...@@ -279,6 +281,16 @@ ...@@ -279,6 +281,16 @@
</dl> </dl>
{%- endmacro -%} {%- endmacro -%}
{%- macro render_block_lineblock(block, lang, meta) -%}
{%- set lines = block['lines'] -%}
<div class="lineblock">
{%- for line in lines -%}
{{ render_inlines(line, lang) }}
{%- if not loop.last -%}<br />{%- endif -%}
{%- endfor -%}
</div>
{%- endmacro -%}
{#- ############################ INLINES ################################## -#} {#- ############################ INLINES ################################## -#}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment