@@ -44,7 +44,9 @@ def get_version():
44
44
45
45
46
46
class md_install_scripts (install_scripts ):
47
+
47
48
""" Customized install_scripts. Create markdown_py.bat for win32. """
49
+
48
50
def run (self ):
49
51
install_scripts .run (self )
50
52
@@ -59,21 +61,22 @@ def run(self):
59
61
f = open (bat_path , 'w' )
60
62
f .write (bat_str )
61
63
f .close ()
62
- print ('Created: %s' % bat_path )
64
+ print ('Created: %s' % bat_path )
63
65
except Exception :
64
66
_ , err , _ = sys .exc_info () # for both 2.x & 3.x compatability
65
- print ('ERROR: Unable to create %s: %s' % (bat_path , err ))
67
+ print ('ERROR: Unable to create %s: %s' % (bat_path , err ))
66
68
67
69
68
70
class build_docs (Command ):
71
+
69
72
""" Build markdown documentation into html."""
70
73
71
74
description = '"build" documentation (convert markdown text to html)'
72
75
73
76
user_options = [
74
77
('build-base=' , 'd' , 'directory to "build" to' ),
75
78
('force' , 'f' , 'forcibly build everything (ignore file timestamps)' ),
76
- ]
79
+ ]
77
80
78
81
boolean_options = ['force' ]
79
82
@@ -121,7 +124,7 @@ def _get_context(self, src, path):
121
124
name , ext = os .path .splitext (file )
122
125
parts = [x for x in dir .split (os .sep ) if x ]
123
126
c ['source' ] = '%s.txt' % name
124
- c ['base' ] = '../' * len (parts )
127
+ c ['base' ] = '../' * len (parts )
125
128
# Build page title
126
129
if name .lower () != 'index' or parts :
127
130
c ['page_title' ] = '%s — Python Markdown' % c ['title' ]
@@ -131,7 +134,7 @@ def _get_context(self, src, path):
131
134
crumbs = []
132
135
ctemp = '<li><a href="%s">%s</a> »</li>'
133
136
for n , part in enumerate (parts ):
134
- href = ('../' * n ) + 'index.html'
137
+ href = ('../' * n ) + 'index.html'
135
138
label = part .replace ('_' , ' ' ).capitalize ()
136
139
crumbs .append (ctemp % (href , label ))
137
140
if c ['title' ] and name .lower () != 'index' :
@@ -147,7 +150,7 @@ def run(self):
147
150
try :
148
151
import markdown
149
152
except ImportError :
150
- print ('skipping build_docs: Markdown "import" failed!' )
153
+ print ('skipping build_docs: Markdown "import" failed!' )
151
154
else :
152
155
with codecs .open ('docs/_template.html' , encoding = 'utf-8' ) as f :
153
156
template = f .read ()
@@ -174,7 +177,7 @@ def run(self):
174
177
self .mkpath (os .path .split (outfile )[0 ])
175
178
if self .force or newer (infile , outfile ):
176
179
if self .verbose :
177
- print ('Converting %s -> %s' % (infile , outfile ))
180
+ print ('Converting %s -> %s' % (infile , outfile ))
178
181
if not self .dry_run :
179
182
with codecs .open (infile , encoding = 'utf-8' ) as f :
180
183
src = f .read ()
@@ -189,11 +192,12 @@ def run(self):
189
192
190
193
191
194
class md_build (build ):
195
+
192
196
""" Run "build_docs" command from "build" command. """
193
197
194
198
user_options = build .user_options + [
195
199
('no-build-docs' , None , 'do not build documentation' ),
196
- ]
200
+ ]
197
201
198
202
boolean_options = build .boolean_options + ['build-docs' ]
199
203
0 commit comments