Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Jul 22, 2020
1 parent ba4b900 commit 1ca8bd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wireviz/build_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def build(dirname):
if build_readme:
include_readme = 'md' in paths[dirname][readme]
include_source = 'yml' in paths[dirname][readme]
with open_file_write(path / 'readme.md') as out:
with open_file_write(path / readme) as out:
out.write(f'# {paths[dirname]["title"]}\n\n')
# collect and iterate input YAML files
for yaml_file in collect_filenames('Building', dirname, input_extensions):
Expand All @@ -59,9 +59,9 @@ def build(dirname):

with open_file_append(path / readme) as out:
if include_readme:
with open_file_read(path / f'{yaml_file.stem}.md') as info:
with open_file_read(yaml_file.with_suffix('.md')) as info:
for line in info:
out.write(line.replace('## ', '## {} - '.format(i)))
out.write(line.replace('## ', f'## {i} - '))
out.write('\n\n')
else:
out.write(f'## Example {i}\n')
Expand Down

0 comments on commit 1ca8bd1

Please sign in to comment.