Skip to content

Commit 37da6d9

Browse files
committed
Made some changes: Copy the actualy Readme before parsing
1 parent 92eb820 commit 37da6d9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

nicedoc/write_on_readme.py

100644100755
+10-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
#!/usr/bin/python3
2+
13
import re
24
import os
35
import sys
46
import glob
57

6-
def write_on_readme(filename, doc_text, readme_path = 'README.md'):
8+
9+
def write_on_readme(filename, doc_text, readme_path='README.md'):
710
with open(readme_path, 'r') as fp:
811
readme_text = fp.read()
912
print(filename)
@@ -30,13 +33,17 @@ def write_on_readme(filename, doc_text, readme_path = 'README.md'):
3033
with open('README.md', 'w') as fp:
3134
readme_text = fp.write(final_text)
3235

36+
3337
def Main():
3438
argv = sys.argv
3539
argc = len(argv)
40+
41+
# Copy the main README file
42+
os.system('cp ../README.md .')
3643
if argc != 2:
3744
print(f"Usage: {argv[0]} <md-files-directory | md-file-path>")
3845
quit()
39-
srcpath = argv[1]
46+
srcpath = argv[1]
4047

4148
if os.path.isdir(srcpath):
4249
all_files = os.listdir(srcpath)
@@ -54,7 +61,7 @@ def Main():
5461
filename = srcpath.split('/')[-1].split('.')[0]
5562

5663
with open(srcpath, 'r') as fp:
57-
doc_text = fp.read()
64+
doc_text = fp.read()
5865

5966
write_on_readme(filename, doc_text)
6067

0 commit comments

Comments
 (0)