(source, image_id)
| 67 | |
| 68 | |
| 69 | def render_image(source, image_id): |
| 70 | source = _add_dots(source, image_id) |
| 71 | print(source) |
| 72 | target = Path(f'images/{image_id}.png') |
| 73 | if target.exists(): |
| 74 | target.unlink() |
| 75 | tf = Path(tempfile.NamedTemporaryFile().name) |
| 76 | tf.write_text(source) |
| 77 | cmd = ['asciidoctor', '-r', 'asciidoctor-diagram', '-a', f'imagesoutdir={IMAGES_DIR}', str(tf)] |
| 78 | print(' '.join(cmd)) |
| 79 | subprocess.run(cmd, check=True) |
| 80 | |
| 81 | |
| 82 | if __name__ == '__main__': |
no test coverage detected