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

Diff of /navidoc/rst2any.py

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

revision 1.3 by humppake, Tue Mar 18 14:43:52 2003 UTC revision 1.4 by humppake, Tue Mar 18 15:09:54 2003 UTC
# Line 39  import config Line 39  import config
39  The main frontend for running Navidoc.  The main frontend for running Navidoc.
40  """  """
41    
42  dbg = config.dbg.shorthand("main")  dbg = config.dbg.shorthand('navidoc')
43    
44  # XXX: figure out, why docutils want locals to be cleaned  # XXX: figure out, why docutils want locals to be cleaned
45  import locale  import locale
# Line 55  def run_docutils(path): Line 55  def run_docutils(path):
55      """      """
56      if os.path.isdir(path):      if os.path.isdir(path):
57          rstfiles = _rstFiles(path)          rstfiles = _rstFiles(path)
58          if os.path.isfile(_slashify(path) + "docutils.conf"):          if os.path.isfile(_slashify(path) + 'docutils.conf'):
59              config.docutils = _slashify(path) + "docutils.conf"              config.docutils = _slashify(path) + 'docutils.conf'
60          for rstfile in rstfiles:          for rstfile in rstfiles:
61              rst2any(_slashify(path)+rstfile)              rst2any(_slashify(path)+rstfile)
62      elif os.path.isfile(path) or os.path.isfile(path+'.rst'):      elif os.path.isfile(path):
63          rst2any(path)          rst2any(path)
64        elif os.path.isfile(path+'.rst'):
65            rst2any(path+'.rst')
66    
67  def rst2any(filepath):  def rst2any(input):
68      """      """
69      Runs docutils for a single file.      Runs docutils for a single file.
70      """      """
71      if filepath.endswith(".rst"): filepath = filepath[0:len(filepath)-4]      if input.endswith('.rst'): output = input[0:len(input)-4]+'.gen.html'
72        else: output = input+'.gen.html'
73        args = "--config "+config.docutils+" "+input+' '+output
74      if html:      if html:
75          args = "--config "+config.docutils+" "+filepath+'.rst '+filepath+'.gen.html'          dbg("Compiling: "+input)
         dbg("Compiling: "+filepath)  
76          docutils.core.publish_cmdline(writer_name='html', argv=args.split())          docutils.core.publish_cmdline(writer_name='html', argv=args.split())
77      if latex:      if latex:
78          args = "--config "+config.docutils+" "+filepath+'.rst '+filepath+'.gen.latex'          dbg("Compiling: "+input)
         dbg("Compiling: "+filepath)  
79          docutils.core.publish_cmdline(writer_name='latex', argv=args.split())          docutils.core.publish_cmdline(writer_name='latex', argv=args.split())
80    
81  # catching loop parameters from the command line  # catching loop parameters from the command line
# Line 93  try: Line 95  try:
95      while 1:      while 1:
96          dbg_name = sys.argv[sys.argv.index("-d") + 1]          dbg_name = sys.argv[sys.argv.index("-d") + 1]
97          config.dbg.enable(dbg_name)          config.dbg.enable(dbg_name)
98          print "Enabling debug for:", dbg_name          print "Enabling debug output for:", dbg_name
99          sys.argv.remove("-d")          sys.argv.remove("-d")
100          sys.argv.remove(dbg_name)          sys.argv.remove(dbg_name)
101                    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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