Skip to content
Snippets Groups Projects
Commit 87dc396b authored by Alexis Filipozzi's avatar Alexis Filipozzi
Browse files

small correction in ul translation

parent 7a62cf88
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,8 @@ class TextContent(ParagraphContent): ...@@ -89,6 +89,8 @@ class TextContent(ParagraphContent):
def get_string(self, clean = True): def get_string(self, clean = True):
text = self._text text = self._text
if not text:
text = ""
if clean: if clean:
text = text.strip() text = text.strip()
return text return text
......
...@@ -88,6 +88,7 @@ class Parser: ...@@ -88,6 +88,7 @@ class Parser:
self._data._body.append(Paragraph(indent)) self._data._body.append(Paragraph(indent))
else: else:
self.parse_paragraph(c) self.parse_paragraph(c)
if content.name == "li":
if self._data._body[-1]._content: if self._data._body[-1]._content:
last_content = self._data._body[-1]._content[-1] last_content = self._data._body[-1]._content[-1]
if isinstance(last_content, TextContent): if isinstance(last_content, TextContent):
......
...@@ -32,12 +32,11 @@ def parse_and_format(dir_path, filename, dest): ...@@ -32,12 +32,11 @@ def parse_and_format(dir_path, filename, dest):
for sub_file in os.listdir(path_to_file): for sub_file in os.listdir(path_to_file):
parse_and_format(path_to_file, sub_file, path_to_dst) parse_and_format(path_to_file, sub_file, path_to_dst)
elif os.path.isfile(path_to_file): elif os.path.isfile(path_to_file):
parse_format_and_write_file(path_to_file, path_to_dst) parse_format_and_write_file(path_to_file, os.path.join(dest, filename.replace(".html", ".protoxml")))
else: else:
print "Unhandled file type (probably symlink) with file " + str(path_to_file) print "Unhandled file type (probably symlink) with file " + str(path_to_file)
def parse_format_and_write_file(filename, dest): def parse_format_and_write_file(filename, dest):
print "parse file"
has_been_parsed = False has_been_parsed = False
parser = None parser = None
formatter = None formatter = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment