Updates document content, compares old and new content, and prints update information. Args: generated_content: New generated document content parse: Whether to parse the content (default is True) predefined_filename: Predefined filename (used if
(self, generated_content, parse=True, predefined_filename="")
| 36 | self.docbooks[predefined_filename] = self.generated_content |
| 37 | |
| 38 | def _update_docs(self, generated_content, parse=True, predefined_filename=""): |
| 39 | """ |
| 40 | Updates document content, compares old and new content, and prints update information. |
| 41 | Args: |
| 42 | generated_content: New generated document content |
| 43 | parse: Whether to parse the content (default is True) |
| 44 | predefined_filename: Predefined filename (used if not parsing) |
| 45 | """ |
| 46 | new_docs = Documents(generated_content, parse, predefined_filename) # Create a new Documents instance |
| 47 | for key in new_docs.docbooks.keys(): |
| 48 | # If the document content has changed or is new, update docbooks |
| 49 | if key not in self.docbooks.keys() or self.docbooks[key] != new_docs.docbooks[key]: |
| 50 | print(f"{key} updated.") # Print updated filename |
| 51 | print(Fore.WHITE + f"------Old:\n{self.docbooks.get(key, '# None')}\n------New:\n{new_docs.docbooks[key]}") |
| 52 | self.docbooks[key] = new_docs.docbooks[key] # Update docbooks |
| 53 | |
| 54 | def _rewrite_docs(self): |
| 55 | """ |
no test coverage detected