[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] navidoc ./rst2any.py navidoc/__init__.py navido...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] navidoc ./rst2any.py navidoc/__init__.py navido... |
Date: |
Wed, 19 Mar 2003 10:34:02 -0500 |
CVSROOT: /cvsroot/navidoc
Module name: navidoc
Changes by: Asko Soukka <address@hidden> 03/03/19 10:34:02
Modified files:
. : rst2any.py
navidoc : __init__.py
navidoc/directives: __init__.py pegboard.py
navidoc/modules: navbar.py
navidoc/utils : path.py
Added files:
navidoc/modules: __init__.py metalink.py navbar.py.~1.1.~
Log message:
dumdedum
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/rst2any.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/__init__.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/__init__.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/pegboard.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/metalink.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/navbar.py.~1.1.~?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/navbar.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/utils/path.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: navidoc/navidoc/__init__.py
diff -u navidoc/navidoc/__init__.py:1.2 navidoc/navidoc/__init__.py:1.3
--- navidoc/navidoc/__init__.py:1.2 Wed Mar 19 04:23:26 2003
+++ navidoc/navidoc/__init__.py Wed Mar 19 10:34:02 2003
@@ -23,8 +23,12 @@
# Written by Asko Soukka
#
+__docformat__ = 'reStructuredText'
+
import docutils.core
import config
+
+import navidoc.directives
def docutils_system_message(self, level, message, *children, **kwargs):
"""
Index: navidoc/navidoc/directives/__init__.py
diff -u navidoc/navidoc/directives/__init__.py:1.1
navidoc/navidoc/directives/__init__.py:1.2
--- navidoc/navidoc/directives/__init__.py:1.1 Tue Mar 18 09:34:29 2003
+++ navidoc/navidoc/directives/__init__.py Wed Mar 19 10:34:02 2003
@@ -1 +1,32 @@
+#
+# Copyright (c) 2003 Asko Soukka
+#
+# This file is part of Navidoc.
+#
+# Navidoc is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Navidoc is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General
+# Public License along with Navidoc; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
#
+# Written by Asko Soukka
+#
+
+__docformat__ = 'reStructuredText'
+
+import docutils
+
+#from navidoc.directives.pegboard import pegboard_directive
+
+#docutils.parsers.rst.directives._directives['pegboard'] = pegboard_directive
Index: navidoc/navidoc/directives/pegboard.py
diff -u navidoc/navidoc/directives/pegboard.py:1.2
navidoc/navidoc/directives/pegboard.py:1.3
--- navidoc/navidoc/directives/pegboard.py:1.2 Tue Mar 18 11:28:36 2003
+++ navidoc/navidoc/directives/pegboard.py Wed Mar 19 10:34:02 2003
@@ -25,12 +25,184 @@
__docformat__ = 'reStructuredText'
+
+import os, string
+import docutils
+
+import config
+
+from navidoc.utils.path import *
+
+dbg = config.dbg.shorthand('pegboard')
+
+
+def pegcmp(a, b):
+ """
+ Comparison function used when sorting pegs.
+ Sorts pegs primarily in descending priority order of status
+ and secondarily in descending time stamp.
+ """
+ if priority.has_key(a['status'].capitalize().split()[0]) \
+ and priority.has_key(b['status'].capitalize().split()[0]) \
+ and not a['status'].lower().split() == b['status'].lower().split():
+ return priority[a['status'].capitalize().split()[0]] \
+ > priority[b['status'].capitalize().split()[0]] or -1
+
+ as = a['last-modified'].split('-')
+ bs = b['last-modified'].split('-')
+ if not len(as) == 3 or not len(bs) == 3:
+ return len(as) < len(bs) or (len(bs) < len(as)) * -1 or 0
+ ac = int(as[0])*10000 + int(as[1])*100 + int(as[2])
+ bc = int(bs[0])*10000 + int(bs[1])*100 + int(bs[2])
+ return ac < bc or (ac > bc) * -1 or 0
+
+def getTagValue(document, tagName, all=0, always_raw=0):
+ """
+ Returns the value of the first occurrence, or all values of all of
+ the occurrences of given tagName in docutils' document tree
+ """
+ values = []
+ if document.tagname.lower() == tagName.lower():
+ if hasattr(document.children[0], 'data') and not always_raw:
+ return document.children[0].data
+ else:
+ return document.rawsource
+ if hasattr(document, 'children'):
+ for child in document.children:
+ value = getTagValue(child, tagName, all=all, always_raw=always_raw)
+ if value and not all:
+ return value
+ elif value:
+ if type(value) == type([]):
+ values.extend(value)
+ else:
+ values.append(value)
+ if len(values) > 0:
+ return values
+ else:
+ return ''
+
+def getFieldTagValue(document, fieldName):
+ """
+ Returns the value of the first occurrense of field tag with given
+ field name.
+ """
+ if document.tagname.lower() == 'field':
+ if document.children[0].rawsource.lower() == fieldName.lower():
+ return document.children[1].rawsource
+ if hasattr(document, 'children'):
+ for child in document.children:
+ value = getFieldTagValue(child, fieldName)
+ if value:
+ return value
+ return ''
+
+def build_pegtable():
+ """
+ Search all subdirs of working directory for peg files and
+ parses peg metadata from them. Returns the table containing
+ metadata from all the pegs.
+ """
+
+ pegtable = []
+
+ pegdirs = [d for d in os.listdir(_slashify(config.working_directory))
+ if os.path.isdir(_slashify(config.working_directory)+d) and d !=
'CVS']
+
+
+ for pegdir in pegdirs:
+ dbg('processing PEG ' + pegdir)
+
+ peg = {'authors': [], 'status': undefined, 'topic': pegdir,
'stakeholders': [],
+ 'last-modified': '', 'dir': pegdir, 'files': '', 'html': '',
'rst': '',
+ 'rstfiles': [], 'cvsignore': [] }
+
+ pegfiles = [f for f in os.listdir(pegroot+'/'+pegdir+'/') \
+ if os.path.isfile(pegroot+'/'+pegdir+'/'+f) and not
f.startswith('.')
+ and '#' not in f and '~' not in f]
+
+ peg['files'] = pegfiles
+
+ try:
+ index = pegfiles.index('peg.rst')
+ peg['rst'] = pegfiles[index]
+ except ValueError:
+ for pegfile in peg['files']:
+ if pegfile.endswith('.rst'):
+ peg['rst'] = pegfile
+
+ rstfiles = [f for f in peg['files'] if f.endswith('.rst')]
+
+ for rstfile in rstfiles:
+ #creates and setups a new docutils.core.Publisher, which seems to be
+ #easy interface to use docutils
+ pub = Publisher()
+ pub.set_reader('standalone', None, 'restructuredtext')
+ pub.set_writer('html')
+ file = pegroot+'/'+pegdir+'/'+rstfile[0:len(rstfile)-4]
+ args = '-stg --stylesheet ../'+css+' %s.rst %s.gen.html' % (file,file)
+
+ #saves using contexts for diagrams
+ settings['context'] = pegroot+'/'+pegdir+'/'+rstfile
+ umltool.set_transition_paths(settings['context'])
+ pub.process_command_line(argv=args.split())
+
+ #conversion may fail because of bad restructuredtext
+ try:
+ pub.set_io()
+ document = pub.reader.read(pub.source, pub.parser, pub.settings)
+ pub.apply_transforms(document)
+ output = pub.writer.write(document, pub.destination)
+ peg['cvsignore'].append(rstfile[0:len(rstfile)-4]+'.gen.html')
+
+ #conversion have succeeded so far, parsing peg's metadata
+ #from its document tree
+ if rstfile == peg['rst']:
+ peg['html'] = rstfile[0:len(rstfile)-4]+'.gen.html'
+ peg['topic'] = getTagValue(document, 'title', always_raw=1)
+ peg['topic'] = peg['topic']
+ peg['last-modified'] = getFieldTagValue(document,
'last-modified')
+ #we may have got 'rawsource', which needs some tidying
+ if peg['last-modified'].startswith('$Date'):
+ peg['last-modified'] =
peg['last-modified'][7:len(peg['last-modified'])-11].replace('/', '-')
+ peg['status'] = getTagValue(document, 'status') or undefined
+ stakeholders = getFieldTagValue(document, 'stakeholder')
+ if not stakeholders:
+ stakeholders = getFieldTagValue(document, 'stakeholders')
+ peg['stakeholders'] = [s.strip() for s in
stakeholders.split(',')]
+ peg['authors'] = getTagValue(document, 'author', all=1)
+ else:
+ status = getTagValue(document, 'status')
+ if status:
+ peg['rstfiles'].append({'filename': rstfile, 'status':
status})
+
+ except:
+ fails += 'PEG %s: Docutil raised an exception while converting %s.
' % (pegdir, rstfile)
+ fails += 'Conversion failed and HTML not created.\n'
+
+ if not peg['html']:
+ for file in peg['files']:
+ if file[len(file)-5:len(file)] == '.html':
+ peg['html'] = file
+ break
+ elif file[len(file)-4:len(file)] in ('.rst', '.txt'):
+ peg['html'] = file
+ break
+
+ #finally adds peg's metadata into pegtable
+ pegtable.append(peg)
+
+
+#create the ``.. pegboard::`` directive
+
+
def pegboard_directive(*args):
+
+ pegtable = build_pegtable()
pegtable.sort(pegcmp)
- ## Python doesn't like this, as 'class' is reserved
+ # Python doesn't like this, as 'class' is reserved
# table = nodes.table(class='pegboard')
-
table = nodes.table()
table['class'] = 'pegboard'
tgroup = nodes.tgroup(cols=6)
@@ -85,35 +257,105 @@
status_emph
]
- ## massive uglification here because cpython doesn't like
- ## the use of the reserved word 'class'. ;-/. Gotta think of
- ## something cuter.
+ # massive uglification here because cpython doesn't like
+ # the use of the reserved word 'class'. ;-/. Gotta think of
+ # something cuter.
#row += td(status, class='peg_status_field')
#row += td(ref, class='peg_name_field')
#row += td(peg['topic'].split(':')[-1], class='peg_topic_field')
#row += td(string.join(_authors, ', '), class='peg_authors_field')
#row += td(string.join(_stakeholders, ', '),
class='peg_stakeholders_field')
- temp = td(status)
- temp['class'] = 'peg_status_field'
+ temp = td(status); temp['class'] = 'peg_status_field'
row += temp
- temp = td(ref)
- temp['class'] = 'peg_name_field'
+ temp = td(ref); temp['class'] = 'peg_name_field'
row += temp
- temp = td(peg['topic'].split(':')[-1])
- temp['class'] = 'peg_topic_field'
+ temp = td(peg['topic'].split(':')[-1]); temp['class'] =
'peg_topic_field'
row += temp
- temp = td(string.join(_authors, ', '))
- temp['class'] = 'peg_authors_field'
+ temp = td(string.join(_authors, ', ')); temp['class'] =
'peg_authors_field'
row += temp
- temp = td(string.join(_stakeholders, ', '))
- temp['class'] = 'peg_stakeholders_field'
+ temp = td(string.join(_stakeholders, ', ')); temp['class'] =
'peg_stakeholders_field'
row += temp
row += make_files(peg)
return [table]
+def td(__node, **args):
+ entry = nodes.entry(**args)
+ para = nodes.paragraph()
+ entry += para
+
+ if isinstance(__node, type('')):
+ str = __node
+ #mark literates
+ if str.count('``')%2 == 0:
+ for i in range(str.count('``')/2):
+ if str.find('``') != 0:
+ para += nodes.Text(str[0:str.find('``')])
+ str = str[str.find('``')+2:len(str)]
+ literal = nodes.literal(para,
nodes.Text(str[0:str.find('``')]))
+ para += literal
+ str = str[str.find('``')+2:len(str)]
+ __node = nodes.Text(str)
+
+ para += __node
+ return entry
+
+
+def make_files(peg):
+ # again, cpython and 'class'
+ # list = nodes.bullet_list(class="plain")
+ list = nodes.bullet_list()
+ list['class'] = 'plain'
+
+ # entry = nodes.entry(class='peg_files_field')
+ entry = nodes.entry()
+ entry['class'] = 'peg_files_field'
+
+ entry += list
+
+ for file in peg['files']:
+ try:
+ if peg['cvsignore'].index(file):
+ pass
+ except ValueError:
+ converted = 0
+ status = 0
+ if file != peg['rst']:
+ for rstfile in peg['rstfiles']:
+ if rstfile['filename'] == file:
+ status = rstfile['status']
+ for htmlfile in peg['cvsignore']:
+ if htmlfile == file[0:len(file)-4]+'.html':
+ converted = htmlfile
+ if converted:
+ href = peg['dir'] + '/' + converted
+
+ ref = nodes.reference(anonymous=1, refuri=href)
+ if status:
+ klass = 'peg-'+status.split()[0].lower()
+ #ref = nodes.reference(anonymous=1, class=klass,
refuri=href)
+ ref['class'] = klass
+
+ text = nodes.Text(converted)
+
+ ref += text
+ listitem = nodes.list_item(list, ref)
+ list += listitem
+ else:
+ href = peg['dir'] + '/' + file
+ ref = nodes.reference(anonymous=1, refuri=href)
+ text = nodes.Text(file)
+
+ ref += text
+ listitem = nodes.list_item(list, ref)
+ list += listitem
+ return entry
+
+pegboard_directive.arguments = ()
+pegboard_directive.options = {}
+pegboard_directive.content = 0
Index: navidoc/navidoc/modules/navbar.py
diff -u navidoc/navidoc/modules/navbar.py:1.1
navidoc/navidoc/modules/navbar.py:1.2
--- navidoc/navidoc/modules/navbar.py:1.1 Wed Mar 19 08:43:16 2003
+++ navidoc/navidoc/modules/navbar.py Wed Mar 19 10:34:02 2003
@@ -1,6 +1,38 @@
+#
+# Copyright (c) 2003 by Benja Fallenstein
+#
+# This file is part of Navidoc.
+#
+# Navidoc is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Navidoc is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General
+# Public License along with Navidoc; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# Written by Benja Fallenstein
+#
+
+__docformat__ = 'reStructuredText'
import re, os
+import config
+
+from navidoc.utils.path import _slashify
+
+dbg = config.dbg.shorthand('navbar')
+
class Tree:
re_title = re.compile("<title>(.*)</title>")
@@ -21,8 +53,8 @@
match = self.re_title.search(contents)
if not match:
- print ("File %s skipped: It does not contain "
- "a <title>.") % filename
+ dbg(("File %s skipped: It does not contain "
+ "a <title>.") % filename)
return
name = match.group(1)
@@ -40,8 +72,8 @@
def prettyprint(self, indent=""):
for el in self.files:
- print "%s%s [%s]" % (indent, el[1],
- os.path.basename(el[0]))
+ dbg("%s%s [%s]" % (indent, el[1],
+ os.path.basename(el[0])))
if len(el) > 2:
el[2].prettyprint(indent+" ")
@@ -54,12 +86,13 @@
def simpleNavbar(tree, indent=""):
s = ""
for el in tree.files:
- s += '%s<a href="%s">%s</a><br>\n' % (indent, el[0], el[1])
+ s += '%s<a href="%s">%s</a><br>\n' % \
+ (indent,
el[0][len(_slashify(config.working_directory)):len(el[0])], el[1])
if len(el) > 2:
s += simpleNavbar(el[2], indent+" ")
return s
-def insertNavbars(tree, bar=None):
+def insertNavbars(tree, bar=None, single_file=None):
if bar is None:
bar = '<hr class="footer"/>'
bar += '<div class="left-bar">\n'
@@ -69,18 +102,29 @@
bar += simpleNavbar(tree)
bar += '</p></div>\n'
- for el in tree.files:
- if len(el) == 2:
- s = open(el[0]).read()
- i = s.find('<hr class="footer"/>')
- s = s[:i] + bar + s[i:]
- open(el[0], 'w').write(s)
- print "Inseted navbar into %s" % el[0]
- else:
- insertNavbars(el[2], bar)
+ if single_file:
+ s = open(filename).read()
+ i = s.find('<hr class="footer"/>')
+ s = s[:i] + bar + s[i:]
+ open(filename, 'w').write(s)
+ dbg("Inserted navbar into %s" % filename)
+
+ else:
+ for el in tree.files:
+ if len(el) == 2:
+ s = open(el[0]).read()
+ i = s.find('<hr class="footer"/>')
+ s = s[:i] + bar + s[i:]
+ open(el[0], 'w').write(s)
+ dbg( "Inserted navbar into %s" % el[0])
+ else:
+ insertNavbars(el[2], bar)
if __name__ == '__main__':
import sys
t = Tree(sys.argv[1])
insertNavbars(t)
-
+
+def postprocess(path):
+ t = Tree(path)
+ insertNavbars(t)
Index: navidoc/navidoc/utils/path.py
diff -u navidoc/navidoc/utils/path.py:1.2 navidoc/navidoc/utils/path.py:1.3
--- navidoc/navidoc/utils/path.py:1.2 Tue Mar 18 11:02:27 2003
+++ navidoc/navidoc/utils/path.py Wed Mar 19 10:34:02 2003
@@ -27,15 +27,17 @@
import os.path
-def _rstFiles(path):
+def _listdir(path, extensions, dirs=0):
"""
- Returns all ".rst" files under path. Nonrecursive.
+ Returns all directories and files with specific
+ extensions under path. Nonrecursive.
"""
- files = [f for f in os.listdir(_slashify(path)) \
- if os.path.isfile(_slashify(path)+f) and not f.startswith('.')
- and '#' not in f and '~' not in f]
- rstfiles = [f for f in files if f.endswith('.rst')]
- return rstfiles
+ files = [f for f in os.listdir(path) if not f.startswith('.')
+ and not f == "CVS" and '#' not in f and '~' not in f]
+ if not dirs:
+ files = [f for f in os.listdir(path) if
os.path.isfile(_slashify(path)+f)]
+ files = [f for f in files if extensions.count(f.split('.')[-1]) > 0]
+ return files
def _slashify(path):
"""
Index: navidoc/rst2any.py
diff -u navidoc/rst2any.py:1.7 navidoc/rst2any.py:1.8
--- navidoc/rst2any.py:1.7 Wed Mar 19 04:23:26 2003
+++ navidoc/rst2any.py Wed Mar 19 10:34:02 2003
@@ -29,16 +29,18 @@
import sys, os, getopt
import docutils.core
-import navidoc
+import navidoc
import config
+from navidoc.utils.path import _slashify, _listdir
+
"""
The main frontend for running Navidoc.
"""
dbg = config.dbg.shorthand('navidoc')
-dbg_path = config.dbg.shorthand('path')
+dbg_config = config.dbg.shorthand('config')
# XXX: figure out, why docutils want locals to be cleaned
import locale
@@ -47,42 +49,36 @@
except:
pass
-def run_docutils(path):
- """
- Selects all ReST files under ``path`` directory (or the single file
- specified by ``path``) and forwards them to conversion method.
- """
- if os.path.isdir(path):
- config.working_directory = os.path.normpath(path)
- rstfiles = _rstFiles(path)
- if os.path.isfile(_slashify(path) + 'docutils.conf'):
- config.docutils = _slashify(path) + 'docutils.conf'
- for rstfile in rstfiles:
- rst2any(_slashify(path)+rstfile)
- elif os.path.isfile(path):
- config.working_directory = os.path.normpath(os.path.dirname(path))
- config.input_filename = os.path.basename(path)
- rst2any(path)
- elif os.path.isfile(path+'.rst'):
- config.working_directory = os.path.normpath(os.path.dirname(path))
- config.input_filename = os.path.basename(path+'.rst')
- rst2any(path+'.rst')
+# catching writer parameters from the command line
+try: sys.argv.remove('--latex'); latex = 1
+except ValueError: latex = 0
+
+# catching writer parameters from the command line
+try: sys.argv.remove('--html'); html = 1
+except ValueError: html = 0
+
+# catching feature parameters from the command line
+try: sys.argv.remove('--metalink'); metalink = 1
+except ValueError: metalink = 0
+
+# catching feature parameters from the command line
+try: sys.argv.remove('--navbar'); navbar = 1
+except ValueError: navbar = 0
def rst2any(input):
"""
Runs docutils for a single file.
"""
- if input.endswith('.rst'): output = input[0:len(input)-4]
- else: output = input
+ output = input.split(".")[0]
- dbg_path("working directory: "+config.working_directory)
- dbg_path("input file: "+config.input_filename)
+ dbg_config("Working directory: "+config.working_directory)
+ dbg_config("Input file: "+config.input_filename)
if html:
dbg('Compiling: '+input)
output = output+".gen.html"
config.output_filename = os.path.basename(output)
- dbg_path("output file: "+config.output_filename)
+ dbg_config("Output file: "+config.output_filename)
args = "--config "+config.docutils+" "+input+' '+output
docutils.core.publish_cmdline(writer_name='html', argv=args.split())
@@ -90,22 +86,51 @@
dbg('Compiling: '+input)
output = output+".gen.latex"
config.output_filename = os.path.basename(output)
- dbg_path("output file: "+config.output_filename)
+ dbg_config("Output file: "+config.output_filename)
args = "--config "+config.docutils+" "+input+' '+output
docutils.core.publish_cmdline(writer_name='latex', argv=args.split())
+ config.output_filename = ""
+
+def postprocess(path):
+ """
+ """
+ if metalink and os.path.isdir(path):
+ import navidoc.modules.metalink
+ config.working_directory = path
+ navidoc.modules.metalink.postprocess(path)
+
+ if navbar and os.path.isdir(path):
+ import navidoc.modules.navbar
+ config.working_directory = path
+ navidoc.modules.navbar.postprocess(path)
+
+def run_docutils(path):
+ """
+ Selects all ReST files under ``path`` directory (or the single file
+ specified by ``path``) and forwards them to conversion method.
+ """
+ if os.path.isdir(path) and not os.path.islink(path):
+ dirlist = _listdir(path,["rst"],dirs=1)
+ if os.path.isfile(_slashify(path) + 'docutils.conf'):
+ config.docutils = _slashify(path) + 'docutils.conf'
+ for entry in dirlist:
+ run_docutils(_slashify(path)+entry)
+ elif os.path.isfile(path):
+ config.working_directory = os.path.normpath(os.path.dirname(path))
+ config.input_filename = os.path.basename(path)
+ rst2any(path)
+
+ elif os.path.isfile(path+'.rst'):
+ config.working_directory = os.path.normpath(os.path.dirname(path))
+ config.input_filename = os.path.basename(path+'.rst')
+ rst2any(path+'.rst')
+ config.input_filename = ""
+
# catching loop parameters from the command line
try: sys.argv.remove('--loop'); loop = 1
except ValueError: loop = 0
-# catching writer parameters from the command line
-try: sys.argv.remove('--latex'); latex = 1
-except ValueError: latex = 0
-
-# catching writer parameters from the command line
-try: sys.argv.remove('--html'); html = 1
-except ValueError: html = 0
-
# catching debug parameters
dbg_names, sys.argv = getopt.getopt(sys.argv[1:], config.dbg.short,
config.dbg.long)
for dbg_name in dbg_names:
@@ -118,6 +143,10 @@
#the first pass, docutils
for path in sys.argv:
run_docutils(path)
+
+ #the second pass, postprocess
+ for path in sys.argv:
+ postprocess(path)
# try:
# run_convert(path)
- [Gzz-commits] navidoc ./rst2any.py navidoc/__init__.py navido...,
Asko Soukka <=