diff --git a/eorg/generate.py b/eorg/generate.py index 4b94313..c10828f 100644 --- a/eorg/generate.py +++ b/eorg/generate.py @@ -59,6 +59,13 @@ def header(doc, item, cls="", root=True): return "%s\n" % (depth, cls, item.value, depth) +def table(doc, item, cls="", root=True): + tbl = "" + for row in item.value.split("\n"): + tbl += "" + "".join(row.split("|")) + "\n" + return "%s\n" % (depth, cls, tbl, depth) + + builddoc = { tokens.HEADER: (header, None), tokens.IMAGE: (img, "materialboxed center-align responsive-img"), @@ -72,6 +79,7 @@ builddoc = { tokens.SOURCE: (src, None), tokens.EXAMPLE: (blockquote, None), tokens.RESULTS: (blockquote, None), + tokens.TABLE: (table, None), } diff --git a/tests/fixtures/test_table.org b/tests/fixtures/test_table.org new file mode 100644 index 0000000..418c072 --- /dev/null +++ b/tests/fixtures/test_table.org @@ -0,0 +1,13 @@ +#+TITLE: Emacs org-mode tables +#+AUTHOR: Eric H. Neilsen, Jr. +#+EMAIL: neilsen@fnal.gov +#+DATE: jkkj +#+KEYWORDS: emacs, orgmode, tests +#+DESCRIPTION: Test DESCRIPTION +#+KEYWORDS: key1, key2 + +| Header 1 | Header 2 | +|----------+----------| +| 11 | 12 | +| 21 | 22 | +| | |