(self)
| 362 | print(self.xml) |
| 363 | |
| 364 | def update_dox_file(self): |
| 365 | operator_list_dox = self.project_dir / "docs" / "user_guide" / "operator_list.dox" |
| 366 | |
| 367 | with open(operator_list_dox, "r") as f: |
| 368 | dox_content = f.read() |
| 369 | |
| 370 | # Check that there is only one non-indented table (This table should be the operator list) |
| 371 | x = re.findall("\n<table>", dox_content) |
| 372 | y = re.findall("\n</table>", dox_content) |
| 373 | if len(x) != 1 or len(y) != 1: |
| 374 | raise RuntimeError("Invalid .dox file") |
| 375 | |
| 376 | repl_str = "\n" + self.xml[:-1] # Extra / removed "\n" characters needed to make up for search regex |
| 377 | new_file = re.sub("\n<table>(.|\n)*\n<\/table>", repl_str, dox_content) |
| 378 | |
| 379 | with open(operator_list_dox, "w") as f: |
| 380 | f.write(new_file) |
| 381 | print("Successfully updated operator_list.dox with the XML table of supported operators.") |
| 382 | |
| 383 | |
| 384 | if __name__ == "__main__": |
no test coverage detected