forked from csev/py4e
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpre-html.py
More file actions
executable file
·32 lines (25 loc) · 718 Bytes
/
pre-html.py
File metadata and controls
executable file
·32 lines (25 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
while True:
try:
line = raw_input()
except:
break
# General patching
# 
# 
if line.find('!') == 0 :
oparen = line.find('(')
cparen = line.find(')')
atsign = line.find('@')
if atsign < 0 : atsign=oparen
if cparen < atsign or cparen < 1 or oparen < 1 or atsign < 1 :
print line
continue
fname = line[atsign+1:cparen]
try:
fh = open(fname+'.svg')
except:
fname = fname+'.png'
print line[:oparen+1]+fname+')'
continue
print line