pre-big change
This commit is contained in:
@@ -24,7 +24,9 @@ END_RE = re.compile(r"^\s*end\b")
|
||||
|
||||
|
||||
def format_modelica(text: str) -> str:
|
||||
lines = text.replace("\t", " ").splitlines()
|
||||
normalized = text.replace("\r\n", "\n").replace("\r", "\n").replace("\t", " ")
|
||||
had_trailing_newline = normalized.endswith("\n")
|
||||
lines = normalized.split("\n")
|
||||
out = []
|
||||
indent = 0
|
||||
|
||||
@@ -63,7 +65,10 @@ def format_modelica(text: str) -> str:
|
||||
elif SECTION_RE.match(stripped):
|
||||
indent += 1
|
||||
|
||||
return "\n".join(out) + "\n"
|
||||
formatted = "\n".join(out)
|
||||
if had_trailing_newline:
|
||||
return formatted
|
||||
return formatted + "\n"
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user