|
67 | 67 | """ |
68 | 68 |
|
69 | 69 |
|
70 | | -def mkdir_open(filename, mode): |
71 | | - """Like open(), but make directories as needed.""" |
| 70 | +def mkdir_slashfix_open(filename, mode): |
| 71 | + """Like common.slashfix_open(), but make directories as needed.""" |
| 72 | + filename = common.slashfix(filename) |
72 | 73 | directory = os.path.dirname(filename) |
73 | 74 | os.makedirs(directory, exist_ok=True) |
74 | 75 | return open(filename, mode) |
@@ -198,12 +199,12 @@ def main(): |
198 | 199 | for markdownfile in common.get_markdown_files(): |
199 | 200 | htmlfile = os.path.join('html', fix_filename(markdownfile)) |
200 | 201 | print(' ', markdownfile, '->', htmlfile) |
201 | | - with open(markdownfile.replace('/', os.sep), 'r') as f: |
| 202 | + with common.slashfix_open(markdownfile, 'r') as f: |
202 | 203 | markdown = f.read() |
203 | 204 | renderer = TutorialRenderer() |
204 | 205 | body = mistune.markdown(markdown, renderer=renderer) |
205 | 206 | html = HTML_TEMPLATE.format(title=renderer.title, body=body) |
206 | | - with mkdir_open(htmlfile.replace('/', os.sep), 'w') as f: |
| 207 | + with mkdir_slashfix_open(htmlfile, 'w') as f: |
207 | 208 | print(html, file=f) |
208 | 209 |
|
209 | 210 | print("Copying other files...") |
|
0 commit comments