Basic table rendering.
This commit is contained in:
parent
76cc5f78c5
commit
760b0b0913
|
@ -59,6 +59,13 @@ def header(doc, item, cls="", root=True):
|
||||||
return "<h%s%s>%s</h%s>\n" % (depth, cls, item.value, depth)
|
return "<h%s%s>%s</h%s>\n" % (depth, cls, item.value, depth)
|
||||||
|
|
||||||
|
|
||||||
|
def table(doc, item, cls="", root=True):
|
||||||
|
tbl = ""
|
||||||
|
for row in item.value.split("\n"):
|
||||||
|
tbl += "<tr>" + "</td><td>".join(row.split("|")) + "</tr>\n"
|
||||||
|
return "<table%s%s>%s</table%s>\n" % (depth, cls, tbl, depth)
|
||||||
|
|
||||||
|
|
||||||
builddoc = {
|
builddoc = {
|
||||||
tokens.HEADER: (header, None),
|
tokens.HEADER: (header, None),
|
||||||
tokens.IMAGE: (img, "materialboxed center-align responsive-img"),
|
tokens.IMAGE: (img, "materialboxed center-align responsive-img"),
|
||||||
|
@ -72,6 +79,7 @@ builddoc = {
|
||||||
tokens.SOURCE: (src, None),
|
tokens.SOURCE: (src, None),
|
||||||
tokens.EXAMPLE: (blockquote, None),
|
tokens.EXAMPLE: (blockquote, None),
|
||||||
tokens.RESULTS: (blockquote, None),
|
tokens.RESULTS: (blockquote, None),
|
||||||
|
tokens.TABLE: (table, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 |
|
||||||
|
| | |
|
Loading…
Reference in New Issue