Skip to content

Commit 266c3fa

Browse files
committed
fix: fixing some indent errors
1 parent 5370ad9 commit 266c3fa

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/pyconverter/xml2py/ast_tree.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def to_py_arg_name(name: str) -> str:
147147
else:
148148
num_value = num(arg[0], to="ordinal")
149149
arg = f"{num_value}{arg[3:]}"
150-
print(arg)
151150

152151
if ("," in arg and "--" in arg) or arg == "–":
153152
return ""
@@ -675,6 +674,11 @@ def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=No
675674
items.append(str_item)
676675

677676
rst_item = " ".join(items) + "\n"
677+
678+
if "Terminates the analysis if the" in rst_item:
679+
print("RST in Paragraph : ")
680+
print(rst_item)
681+
print(type(item))
678682

679683
return rst_item
680684

@@ -837,19 +841,11 @@ def to_rst(self, indent="", max_length=100):
837841
rst_item = header + textwrap.indent(source_code, prefix=indent + " " * 3) + "\n"
838842
return rst_item
839843

840-
841-
def resize_list_text(text, max_length=100):
842-
lines = text.split("\n")
843-
new_text = []
844-
for line in lines:
845-
n_line = len(re.match(r"^\s*", line).group())
846-
if line.strip() and line.strip()[0] == "*":
847-
n_line += 2
848-
new_text.append(
849-
resize_length(line, max_length, initial_indent="", subsequent_indent=" " * n_line)
850-
)
851-
return "\n".join(new_text)
852-
844+
def resize_element_list(text, max_length=100):
845+
element_list = re.finditer(r"^\* ", text)
846+
subsequent_indent = " " * 2
847+
element_list =resize_length(text, max_length, initial_indent="", subsequent_indent=subsequent_indent)
848+
return element_list
853849

854850
class Variablelist(Element):
855851
"""Provides the variable list."""
@@ -883,10 +879,10 @@ def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=No
883879
if type(item) != str and len(item.children) > 1 and type(item[1]) != str:
884880
intersection_types = set(NO_RESIZE_LIST).intersection(set(item[1].children_types))
885881
if len(intersection_types) == 0:
886-
rst_item = resize_list_text(rst_item, max_length)
882+
rst_item = resize_element_list(rst_item, max_length)
887883

888884
else:
889-
rst_item = resize_list_text(rst_item, max_length)
885+
rst_item = resize_element_list(rst_item, max_length)
890886
active_items.append(rst_item)
891887

892888
return "\n".join(active_items) + "\n"
@@ -1038,6 +1034,10 @@ def py_text(self, links=None, base_url=None, fcache=None):
10381034
if "GUI" not in sentence:
10391035
valid.append(sentence)
10401036
rst = ". ".join(valid)
1037+
if "Terminates the analysis if the" in rst:
1038+
print("RST : ")
1039+
print(rst)
1040+
10411041
return rst
10421042

10431043
def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=None):
@@ -2657,10 +2657,10 @@ def term_replacer(match):
26572657
is_dash_sign = False
26582658
i = 0
26592659
while i < len(lines):
2660-
if lines[i].lstrip().startswith("-"):
2660+
if lines[i].lstrip().startswith("--"):
26612661
if is_dash_sign == False:
26622662
is_dash_sign = True
2663-
elif lines[i].lstrip().startswith("="):
2663+
elif lines[i].lstrip().startswith("=="):
26642664
if is_equal_sign or is_dash_sign:
26652665
lines[i - 1] = "**" + lines[i - 1] + "**"
26662666
lines.pop(i)

0 commit comments

Comments
 (0)