Skip to content

Commit db1f267

Browse files
author
Jason Ward
committed
refs #62: Added a simple entry point for the markdown converter.
1 parent b43f40b commit db1f267

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pydocx/parsers/Docx2Markdown.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from pydocx.DocxParser import DocxParser
24

35

@@ -24,3 +26,18 @@ def italics(self, text):
2426

2527
def underline(self, text):
2628
return '***' + text + '***'
29+
30+
31+
def main():
32+
try:
33+
path_to_docx = sys.argv[1]
34+
path_to_html = sys.argv[2]
35+
except IndexError:
36+
print 'Must specific the file to convert and the name of the resulting file.' # noqa
37+
sys.exit()
38+
html = Docx2Markdown(path_to_docx).parsed
39+
with open(path_to_html, 'w') as f:
40+
f.write(html)
41+
42+
if __name__ == '__main__':
43+
main()

0 commit comments

Comments
 (0)