Created
September 23, 2018 14:45
-
-
Save aoloe/21bf52c93288ddb52c0dd92de36dbb93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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