Theological Markup Language to gemtext converter
Argument and italic Paragraphs: Parse as blockquote
| -rwxr-xr-x | thml2gmi.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/thml2gmi.py b/thml2gmi.py index 8d3f224..38d542f 100755 --- a/thml2gmi.py +++ b/thml2gmi.py @@ -16,8 +16,10 @@ def iprint(string): def parseSomething(thing): if(len(thing.tag) == 4 and thing.tag[:3] == 'div'): parseDiv(thing) - elif (thing.tag in ['argument', 'div', 'p']): + elif (thing.tag in ['div', 'p']): parseP(thing) + elif (thing.tag == 'argument'): + iprint("> "); parseInline(thing); print("") elif (thing.tag in ['a', 'cite', 'name', 'scripRef', 'span']): parseInline(thing) elif (thing.tag == 'i'): @@ -37,6 +39,10 @@ def parseDiv(div): parseSomething(child) def parseP(p): + i = p.find('i') + if (not p.text) and i is not None and len(p) == 1 and (not i.tail): + iprint("> ") + p = i parseInline(p) # Each paragraph should end with a newline print("") |