1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-03 14:12:17 -05:00
Simba/Doc/docgen.py
2011-10-11 16:36:11 +02:00

23 lines
484 B
Python

import re
from sys import argv
files = argv[1:]
commentregex = re.compile('\(\*.+?\*\)', re.DOTALL)
for file in files:
print file
f = open(file)
p = file.rfind('/')
filetrim = file[p+1:]
p = filetrim.rfind('.pas')
filetrim2 = filetrim[:p]
o = open('sphinx/mmlref/%s.rst' % filetrim2, 'w+')
c = ''.join([x for x in f])
res = commentregex.findall(c)
for y in res:
o.write(y[2:][:-2])
o.close()
f.close()