diff --git a/spip2md/content.py b/spip2md/content.py index a5f7df5..53895aa 100644 --- a/spip2md/content.py +++ b/spip2md/content.py @@ -18,3 +18,18 @@ class content: except Exception as e: print(" PARSING FAILED :\n", e) return markdown + +# Parses a file & display its parse tree +def test(filename): + print(f"--- Parsing of {filename} ---\n") + parsed = spipParser.parse(open(path.dirname(__file__) + "/" + filename).read()) + print(parsed, "\n") + print(f"--- Parse tree of {filename} ---\n\n", parsed.pretty(), "\n") + +if __name__ == "__main__": + # Test + test("../test/0.spip") + test("../test/1.spip") + test("../test/2.spip") + test("../test/3.spip") + test("../test/4.spip")