comparison docs/test2rst.py @ 5659:5ea837c515d9 stable

test2rst: now that we don't use directory mode, remove it too
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 09 Nov 2020 23:08:15 +0800
parents 6e37ce7be367
children 9d6c3e227455
comparison
equal deleted inserted replaced
5658:398a3f0ca07a 5659:5ea837c515d9
57 newlines.append(line) 57 newlines.append(line)
58 58
59 return "\n".join(newlines) 59 return "\n".join(newlines)
60 60
61 61
62 def main(base): 62 def main(path):
63 if os.path.isdir(base):
64 one_dir(base)
65 else:
66 one_file(base)
67
68
69 def one_dir(base):
70 for fn in sorted(os.listdir(base)):
71 if not fn.endswith('.t'):
72 continue
73 one_file(os.path.join(base, fn))
74
75
76 def one_file(path):
77 with open(path) as f: 63 with open(path) as f:
78 content = f.read() 64 content = f.read()
79 rst = rstify(content) 65 rst = rstify(content)
80 target = os.path.splitext(path)[0] + '.rst' 66 target = os.path.splitext(path)[0] + '.rst'
81 with open(target, 'w') as f: 67 with open(target, 'w') as f: