75 |
if last_dot != -1: output = input[:last_dot] |
if last_dot != -1: output = input[:last_dot] |
76 |
else: output = input |
else: output = input |
77 |
|
|
78 |
dbg_config("Working directory: "+config.working_directory) |
dbg_config('Working directory: '+config.working_directory) |
79 |
dbg_config("Input file: "+config.input_filename) |
dbg_config('Input file: '+config.input_filename) |
80 |
|
|
81 |
if html: |
if html: |
82 |
dbg('Compiling: '+input) |
dbg('Compiling: '+input) |
83 |
if not output.endswith('index'): |
if not output.endswith('index'): |
84 |
output = output+".gen.html" |
output = output+'.gen.html' |
85 |
else: |
else: |
86 |
# For practical reasons, we need to transform |
# For practical reasons, we need to transform |
87 |
# index.rst into index.html ... |
# index.rst into index.html ... |
88 |
output = output+".html" |
output = output+'.html' |
89 |
config.output_filename = os.path.basename(output) |
config.output_filename = os.path.basename(output) |
90 |
dbg_config("Output file: "+config.output_filename) |
dbg_config('Output file: '+config.output_filename) |
91 |
args = "--config "+config.docutils+" "+input+' '+output |
args = '--config '+config.docutils+' '+input+' '+output |
92 |
docutils.core.publish_cmdline(writer_name='html', argv=args.split()) |
docutils.core.publish_cmdline(writer_name='html', argv=args.split()) |
93 |
|
|
94 |
if latex: |
if latex: |
95 |
dbg('Compiling: '+input) |
dbg('Compiling: '+input) |
96 |
output = output+".gen.latex" |
output = output+'.gen.latex' |
97 |
config.output_filename = os.path.basename(output) |
config.output_filename = os.path.basename(output) |
98 |
dbg_config("Output file: "+config.output_filename) |
dbg_config('Output file: '+config.output_filename) |
99 |
args = "--config "+config.docutils+" "+input+' '+output |
args = '--config '+config.docutils+' '+input+' '+output |
100 |
docutils.core.publish_cmdline(writer_name='latex', argv=args.split()) |
docutils.core.publish_cmdline(writer_name='latex', argv=args.split()) |
101 |
|
|
102 |
config.output_filename = "" |
config.output_filename = '' |
103 |
|
|
104 |
def postprocess(path): |
def postprocess(path): |
105 |
""" |
""" |
120 |
specified by ``path``) and forwards them to conversion method. |
specified by ``path``) and forwards them to conversion method. |
121 |
""" |
""" |
122 |
if os.path.isdir(path) and not os.path.islink(path): |
if os.path.isdir(path) and not os.path.islink(path): |
123 |
dirlist = _listdir(path,["rst"],dirs=1) |
dirlist = _listdir(path,['rst'],dirs=1) |
124 |
if os.path.isfile(_slashify(path) + 'docutils.conf'): |
if os.path.isfile(_slashify(path) + 'docutils.conf'): |
125 |
config.docutils = _slashify(path) + 'docutils.conf' |
config.docutils = _slashify(path) + 'docutils.conf' |
126 |
for entry in dirlist: |
for entry in dirlist: |
134 |
config.working_directory = os.path.normpath(os.path.dirname(path)) |
config.working_directory = os.path.normpath(os.path.dirname(path)) |
135 |
config.input_filename = os.path.basename(path+'.rst') |
config.input_filename = os.path.basename(path+'.rst') |
136 |
rst2any(path+'.rst') |
rst2any(path+'.rst') |
137 |
config.input_filename = "" |
config.input_filename = '' |
138 |
|
|
139 |
# catching loop parameters from the command line |
# catching loop parameters from the command line |
140 |
try: sys.argv.remove('--loop'); loop = 1 |
try: sys.argv.remove('--loop'); loop = 1 |