improve line blank code and add link descriptions

This commit is contained in:
randomuser 2021-06-30 15:45:57 -05:00
parent ad8198a24b
commit 0c19d47ad3
1 changed files with 11 additions and 3 deletions

14
uml.py
View File

@ -140,8 +140,12 @@ def main():
for i in finput(): for i in finput():
i = i.rstrip() i = i.rstrip()
# ignore blank lines # ignore blank lines (but not seperating paragraphs)
if len(i) == 0: continue if len(i) == 0 and not flags["IN_PREFORMATTED"]:
if flags["PARA_PREV"]:
print("hi")
flags["PARA_PREV"] = False
continue
# lines with text # lines with text
if i[0].isalpha() and not flags["IN_PREFORMATTED"]: if i[0].isalpha() and not flags["IN_PREFORMATTED"]:
@ -185,7 +189,11 @@ def main():
elif command == "*": chain.append(Element("l", params)) elif command == "*": chain.append(Element("l", params))
elif command == "-": chain.append(Element("l", params)) elif command == "-": chain.append(Element("l", params))
elif command == ">": chain.append(Element("q", params)) elif command == ">": chain.append(Element("q", params))
elif command == "=": chain.append(Element("r", params)) elif command == "=":
splitted = params.split(' ')
url = splitted[0]
desc = ' '.join(splitted[1:])
chain.append(Element("r", url, desc))
elif command == "|": elif command == "|":
if flags["TABLE_PREV"]: if flags["TABLE_PREV"]:
chain[-1].data.addrow(params) chain[-1].data.addrow(params)