INNER CODE UNIT · Python
replace_block
toyota-connected/ivi-homescreen · scripts/gen_config_reference.py:381
def replace_block(text, begin, end, body):
if begin in text and end in text:
pre = text[: text.index(begin) + len(begin)]
post = text[text.index(end):]
return pre + "\n\n" + body + "\n\n" + post
return None
def main():
check = "--check" in sys.argv[1:]
rows = build()
reftoml = render_reftoml(rows)
table = render_table(rows)
changed = []
if (not REFTOML.exists()) or REFTOML.read_text() != reftoml:
changed.append(str(REFTOML.relative_to(ROOT)))