Skip to content
Snippets Groups Projects
Commit 454164fa authored by carignani's avatar carignani
Browse files

support tables for examples in Annex A

parent afdf7ea4
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import re
import traceback
from docx.text.paragraph import Paragraph
from docx.table import Table
class Example():
......@@ -50,6 +51,9 @@ def is_heading(txt :str):
'''
return txt.startswith("A.")
def is_example_table(tab):
return len(tab.rows) == 1 and len(tab.rows[0].cells) == 1
def parse_all_examples(txt):
'''
Parses TOSCA examples. Txt is a list of Docx items (Paragraph, etc.).
......@@ -67,6 +71,9 @@ def parse_all_examples(txt):
if is_heading(linetext):
clause = linetext.split("\t")[0]
i = 1
elif isinstance(line, Table):
if is_example_table(line):
linetext = str(line.rows[0].cells[0].text)
elif isinstance(line, str):
linetext = line
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment