(schemafile, markdownfile)
| 256 | |
| 257 | |
| 258 | def main(schemafile, markdownfile): |
| 259 | start_marker = '[comment]: # (GENERATE-FROM-SCHEMA-START)\n' |
| 260 | end_marker = '[comment]: # (GENERATE-FROM-SCHEMA-END)\n' |
| 261 | |
| 262 | if markdownfile is None: |
| 263 | with open(schemafile, "r") as f: |
| 264 | schema = json.load(f) |
| 265 | generate_from_schema(schema) |
| 266 | return |
| 267 | |
| 268 | with open(markdownfile, "r") as f: |
| 269 | md = f.readlines() |
| 270 | |
| 271 | suppress_output = False |
| 272 | for line in md: |
| 273 | if line == end_marker: |
| 274 | suppress_output = False |
| 275 | |
| 276 | if not suppress_output: |
| 277 | print(line, end='') |
| 278 | |
| 279 | if line == start_marker: |
| 280 | with open(schemafile, "r") as f: |
| 281 | schema = json.load(f) |
| 282 | generate_from_schema(schema) |
| 283 | suppress_output = True |
| 284 | |
| 285 | |
| 286 | if __name__ == "__main__": |
no test coverage detected