/[navidoc]/navidoc/rst2any.py
ViewVC logotype

Diff of /navidoc/rst2any.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by benja, Fri Mar 21 22:02:54 2003 UTC revision 1.12 by humppake, Mon Mar 24 08:08:13 2003 UTC
# Line 75  def rst2any(input): Line 75  def rst2any(input):
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      """      """
# Line 120  def run_docutils(path): Line 120  def run_docutils(path):
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:
# Line 134  def run_docutils(path): Line 134  def run_docutils(path):
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

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26