diff options
| author | Zach DeCook <zachdecook@librem.one> | 2020-12-02 21:06:17 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2020-12-02 21:06:17 -0500 |
| commit | 028e867041aa919e8ba94c4a1859b33933d13c3c (patch) | |
| tree | 4cd0c98930077841fb3953062cc81c5827b95f85 | |
| parent | a56329ccd6c7476281ced948ea143d04647bca88 (diff) | |
| download | thml2gmi-028e867041aa919e8ba94c4a1859b33933d13c3c.tar.gz | |
Parse p as a line of text
| -rwxr-xr-x | thml2gmi.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/thml2gmi.py b/thml2gmi.py index 24bc18a..9137ab5 100755 --- a/thml2gmi.py +++ b/thml2gmi.py @@ -12,6 +12,8 @@ def main(argv): def parseSomething(thing): if(len(thing.tag) == 4 and thing.tag[:3] == 'div'): parseDiv(thing) + elif (thing.tag == 'p'): + parseP(thing) def parseDiv(div): indentLevel = int(div.tag[3:]) @@ -20,5 +22,9 @@ def parseDiv(div): for child in list(div): parseSomething(child) +def parseP(p): + text = "".join([x for x in p.itertext()]) + print(text.replace("\n", " ")) + if __name__ == '__main__': main(sys.argv) |
