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)
| 189 | OutputGenerator.endFile(self) |
| 190 | |
| 191 | def writeBlock(self, basename, contents): |
| 192 | """Generate an include file. |
| 193 | |
| 194 | - directory - subdirectory to put file in |
| 195 | - basename - base name of the file |
| 196 | - contents - contents of the file (Asciidoc boilerplate aside)""" |
| 197 | |
| 198 | filename = f"{self.genOpts.directory}/{basename}" |
| 199 | self.logMsg('diag', '# Generating include file:', filename) |
| 200 | with open(filename, 'w', encoding='utf-8') as fp: |
| 201 | write(self.genOpts.conventions.warning_comment, file=fp) |
| 202 | |
| 203 | if len(contents) > 0: |
| 204 | for str in contents: |
| 205 | write(str, file=fp) |
| 206 | else: |
| 207 | self.logMsg('diag', '# No contents for:', filename) |
| 208 | |
| 209 | def genFormat(self, format, formatinfo, alias): |
| 210 | """Generate Formats |