parsing into normal flow

This commit is contained in:
Guilhem Fauré 2023-05-09 11:04:10 +02:00
parent 79a50d5e83
commit 08973616b0
2 changed files with 7 additions and 17 deletions

View File

@ -11,20 +11,10 @@ class content:
def get_markdown(self): def get_markdown(self):
markdown = self.spip markdown = self.spip
# Parses the body & display parse tree
try:
parsed = spipParser.parse(self.spip)
print(f" parse tree :\n", parsed.pretty(), "\n")
except Exception as e:
print(" PARSING FAILED :\n", e)
return markdown 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")
# Test
test("../test/0.spip")
test("../test/1.spip")
test("../test/2.spip")
test("../test/3.spip")
test("../test/4.spip")

View File

@ -1,4 +1,4 @@
#!python3 #!python
import sys import sys
from os import mkdir from os import mkdir
from shutil import rmtree from shutil import rmtree