File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 2
2
import markdown
3
3
import shutil
4
4
import os
5
+ import sys
6
+ import subprocess
5
7
6
8
def create_index ():
7
9
articles = []
@@ -73,6 +75,33 @@ def to_markdown(text):
73
75
return markdown .markdown (text , ['abbr' ])
74
76
75
77
78
+ def merge_pages ():
79
+ git = subprocess .Popen (['git' , 'status' ], stdout = subprocess .PIPE )
80
+
81
+ result = git .communicate ()[0 ].strip ().split ('\n ' )
82
+ if not result [- 1 ].startswith ('nothing to commit' ):
83
+ print 'ERROR: Please commit to master first'
84
+ print 'Merge aborted.'
85
+
86
+ else :
87
+ print 'Copying files...'
88
+ if not os .path .exists ('build' ):
89
+ os .mkdir ('build' )
90
+
76
91
if __name__ == '__main__' :
77
- create_index ()
92
+ if len (sys .argv ) > 1 :
93
+ if sys .argv [1 ] == 'pages' :
94
+ print 'Merging into pages...'
95
+ merge_pages ()
78
96
97
+ elif sys .argv [1 ] == 'all' :
98
+ print 'Generating index...'
99
+ create_index ()
100
+
101
+ print 'Merging into pages...'
102
+ merge_pages ()
103
+
104
+ else :
105
+ print 'Generating index...'
106
+ create_index ()
107
+
You can’t perform that action at this time.
0 commit comments