Skip to content

Instantly share code, notes, and snippets.

@aoloe aoloe/md-svg-png.py
Created Sep 23, 2018

Embed
What would you like to do?
#!/usr/bin/python3.6
import os
import sys
import argparse
import re
from subprocess import call
parser = argparse.ArgumentParser(description='Convert a svn referenced in a markdown line into png.')
parser.add_argument('lines', nargs='?', type=argparse.FileType('r'), default=sys.stdin)
args = parser.parse_args()
# print(args.lines)
for l in args.lines:
m = re.search('\((.+)\)', l)
svg = m.group(1)
if os.path.isfile('/tmp/scratchblocks.svg'):
os.rename('/tmp/scratchblocks.svg', svg)
call(['/home/ale/src/bin_etc/inkscape-svg-to-png.py', svg])
print(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.