Generate an include file. - directory - subdirectory to put file in - basename - base name of the file - contents - contents of the file (Asciidoc boilerplate aside)
(self, basename, contents)
| 51 | OutputGenerator.endFile(self) |
| 52 | |
| 53 | def writeBlock(self, basename, contents): |
| 54 | """Generate an include file. |
| 55 | |
| 56 | - directory - subdirectory to put file in |
| 57 | - basename - base name of the file |
| 58 | - contents - contents of the file (Asciidoc boilerplate aside)""" |
| 59 | |
| 60 | filename = f"{self.genOpts.directory}/{basename}" |
| 61 | self.logMsg('diag', '# Generating include file:', filename) |
| 62 | dirname = os.path.dirname(filename) |
| 63 | if not os.path.exists(dirname): |
| 64 | os.makedirs(dirname) |
| 65 | with open(filename, 'w', encoding='utf-8') as fp: |
| 66 | write(self.genOpts.conventions.warning_comment, file=fp) |
| 67 | |
| 68 | if len(contents) > 0: |
| 69 | for str in contents: |
| 70 | write(str, file=fp) |
| 71 | else: |
| 72 | self.logMsg('diag', '# No contents for:', filename) |
| 73 | |
| 74 | def genSyncStage(self, stageinfo): |
| 75 | OutputGenerator.genSyncStage(self, stageinfo) |
no test coverage detected