gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] navidoc ./config.py ./navidoc.conf ./rst2any.py...


From: Asko Soukka
Subject: [Gzz-commits] navidoc ./config.py ./navidoc.conf ./rst2any.py...
Date: Mon, 30 Jun 2003 09:56:11 -0400

CVSROOT:        /cvsroot/navidoc
Module name:    navidoc
Branch:         
Changes by:     Asko Soukka <address@hidden>    03/06/30 09:56:10

Modified files:
        .              : config.py navidoc.conf rst2any.py 
        navidoc        : __init__.py parser.py 
        navidoc/directives: __init__.py mp.py 
        navidoc/link   : __init__.py docxx.py javadoc.py 
        navidoc/modules: imagemap.py 
        navidoc/mp     : __init__.py html.py uml.py vobs.py 
        navidoc/util   : debug.py path.py 

Log message:
        twid

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/config.py.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc.conf.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/rst2any.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/__init__.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/parser.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/__init__.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/mp.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/link/__init__.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/link/docxx.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/link/javadoc.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/imagemap.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/__init__.py.diff?tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/html.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/uml.py.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/vobs.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/util/debug.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/util/path.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: navidoc/config.py
diff -u navidoc/config.py:1.38 navidoc/config.py:1.39
--- navidoc/config.py:1.38      Fri Jun 13 08:00:29 2003
+++ navidoc/config.py   Mon Jun 30 09:56:09 2003
@@ -19,61 +19,77 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: config.py,v 1.38 2003/06/13 12:00:29 humppake Exp $
+# $Id: config.py,v 1.39 2003/06/30 13:56:09 humppake Exp $
+
+#
+# Written by Asko Soukka
+#
 
 __docformat__ = 'reStructuredText'
 
+"""
+Navidoc configuration module.
+"""
+
 dbg = None
 
-import os, navidoc.util.debug, ConfigParser
+import os, ConfigParser
+
+import navidoc.util.debug
 
-# general debug filter
+# General debug filter
 dbg = navidoc.util.debug.DebugFilter()
 
-# system calls
+# System calls
 metapost = 'mpost'
 pnmscale = 'pnmscale'
 pstopnm = 'pstopnm'
 pnmtopng = 'pnmtopng'
 stderr = '/dev/null'
 
-# initializing dynamic settings
-# should be kept up-to-date in code
+# Initializing dynamic settings
+# These should be kept up-to-date in code
 # always when compiling reST or diagrams
 working_directory = '.'
 input_filename = ''
 output_filename = ''
 link_base_directory = None # if different than working_directory
 
-# set the default docutils.conf
+# Set the default docutils.conf
 docutils_conf = './docutils.conf'
 
-# set the default navidoc.conf
+# Set the default navidoc.conf
 navidoc_conf = './navidoc.conf'
 read_navidoc_conf = ''
 
-# holder of packagenames when linking diagrams
+# Holder of packagenames when linking diagrams
 # will be cleaned after every diagram
 linkpackages = {}
 
-# should linked parts of the diagram be emphasized
+# Should linked parts of the diagram be emphasized
 # using colors and rough edge
 link_emphasize = 0
 
-# should diagrams be generated at all
+# Should diagrams be generated at all
 # this is altered to halt image generation
 # temporarily
 mp_generate = 1
 
-# generate only eps-versions of diagrams
-# usable, when compiling reSTs into LaTeX
+# Generate only eps -versions of diagrams
+# Usable, when compiling reSTs into LaTeX
 mp_eps_only = 0
 
-# should context menu be added into diagrams
-# this is latered as UML diagram option
+# Should context menu be added into diagrams
+# this is modifiable later as UML direvtive option
 mp_context_menu = 0
 
 def read_config(module, filepath):
+    """
+    read_config(module, filepath)
+    
+    Reads a config file and updates
+    attributes in module.
+    """
     cp = ConfigParser.ConfigParser()
     cp.read(filepath)
     for section in cp.sections():
Index: navidoc/navidoc.conf
diff -u navidoc/navidoc.conf:1.1 navidoc/navidoc.conf:1.2
--- navidoc/navidoc.conf:1.1    Wed Jun  4 08:19:18 2003
+++ navidoc/navidoc.conf        Mon Jun 30 09:56:09 2003
@@ -19,19 +19,19 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: navidoc.conf,v 1.1 2003/06/04 12:19:18 humppake Exp $
+# $Id: navidoc.conf,v 1.2 2003/06/30 13:56:09 humppake Exp $
 
 [navidoc]
-# base_url, used currently only by texture embedder module
+# Base_url, used currently only by texture embedder module
 base_url = 'http://fenfire.org/'
 
-# midfix for generated files
+# Midfix for generated files
 # e.g. foo.rst => foo.gen.rst
 midfix = '.gen'
 
 [link]
-# settings for linking diagrams to generated documentation
-# the search order is ascending with sudden death
+# Settings for linking diagrams to generated documentation
+# The search order is ascending with sudden death
 javadoc_directories = ['../libvob/doc/javadoc',
                        '../storm/doc/javadoc',
                        '../alph/doc/javadoc',
@@ -46,10 +46,10 @@
                      '../loom/doc/docxx',
                      '../navidoc/doc/docxx',
                      ]
-# enables crosslinkin between different projects
+# Enables crosslinkin between different projects
 # e.g. link foo
 #           bar.gen.html
-# links to bar.gen.html in project foo
+# Links to bar.gen.html in project foo
 link_redirection = {'navidoc': '../navidoc/doc',
                     'libvob': '../libvob/doc',
                     'storm': '../storm/doc',
@@ -59,10 +59,10 @@
                     }
 
 [directives]
-# settings for MetaPost directives
-mp_directory = 'diagrams' # path to temporary diagram directory, relative to 
execution directory
+# Settings for MetaPost directives
+mp_directory = 'diagrams' # Path to temporary diagram directory, relative to 
execution directory
 
-# pegs will be sorted after their priority
+# Pegs will be sorted after their priority
 pegboard_priorities = {'Current': 1,
                        'Revising': 2,
                        'Incomplete': 3,
@@ -73,10 +73,10 @@
                        'Irrelevant': 8,
                        }
 
-# status for pegs without rst or with invalid rst
+# Status for pegs without rst or with invalid rst
 pegboard_undefined = 'Undefined'
 
-# authors / stakeholders and their corresponding nicknames
+# Authors / stakeholders and their corresponding nicknames
 pegboard_authors = {'Tuomas Lukka': 'tjl',
                     'Tuomas J. Lukka': 'tjl',
                     'Benja Fallenstein': 'benja',
@@ -95,4 +95,4 @@
                     }
 
 [modules]
-papers_directory = 'papers' # for texture module
+papers_directory = 'papers' # For texture module
Index: navidoc/navidoc/__init__.py
diff -u navidoc/navidoc/__init__.py:1.13 navidoc/navidoc/__init__.py:1.14
--- navidoc/navidoc/__init__.py:1.13    Thu Apr 17 03:38:01 2003
+++ navidoc/navidoc/__init__.py Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: __init__.py,v 1.13 2003/04/17 07:38:01 humppake Exp $
+#$Id: __init__.py,v 1.14 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -31,9 +31,11 @@
 
 import docutils.core
 
-# Because docutils' own relative path has problems with
-# paths beginning with '../', we use our own :-)
 import util.path
+
+# Because Docutils' own relative_path had problems with
+# paths beginning with '../', we had to build our own.
+# Probably we can overwrite our own by Docutils' on some day :-)
 docutils.utils.relative_path = util.path.relative_path
 
 class DocutilsException(Exception):
@@ -46,7 +48,7 @@
 def docutils_system_message(self, level, message, *children, **kwargs):
     """
     See docutils.utils.Reporter.system_message()
-    This modified copy redirects docuils system messages
+    This modified copy redirects Docutils system messages
     to navidoc debug.
     """
     attributes = kwargs.copy()
@@ -88,9 +90,21 @@
     Element with name and linking features.
     """
     def do_contents(self, list):
+        """
+        do_contents(list)
+
+        Default implementation for element to parse and
+        handle its contents.
+        """
         self.link = None
        for element in list:
            self.handle_contained(element)
 
     def handle_contained(self, element):
+        """
+        handle_contained(element)
+
+        Default implementation for element to parse and
+        handle its subelement.
+        """
         config.element_list.add_contained_element(self, element)
Index: navidoc/navidoc/directives/__init__.py
diff -u navidoc/navidoc/directives/__init__.py:1.8 
navidoc/navidoc/directives/__init__.py:1.9
--- navidoc/navidoc/directives/__init__.py:1.8  Fri May 23 09:41:40 2003
+++ navidoc/navidoc/directives/__init__.py      Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: __init__.py,v 1.8 2003/05/23 13:41:40 humppake Exp $
+# $Id: __init__.py,v 1.9 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -27,6 +27,10 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+Module for installing all Navidoc specific directives for Docutils.
+"""
+
 from docutils.parsers.rst import directives
 
 from pegboard import pegboard_directive
@@ -44,7 +48,7 @@
 directives._directives['uml-refer'] = uml_refer_directive
 directives._directives['bibliography'] = bibliography_directive
 
-# some additional options and changes for latex writer
+# Some additional options and changes for latex writer
 from docutils.parsers.rst.directives import images
 
 images.image.options['height'] = directives.unchanged
Index: navidoc/navidoc/directives/mp.py
diff -u navidoc/navidoc/directives/mp.py:1.10 
navidoc/navidoc/directives/mp.py:1.11
--- navidoc/navidoc/directives/mp.py:1.10       Tue Jun 17 08:04:04 2003
+++ navidoc/navidoc/directives/mp.py    Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: mp.py,v 1.10 2003/06/17 12:04:04 humppake Exp $
+# $Id: mp.py,v 1.11 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka, Benja Fallenstein
@@ -27,13 +27,14 @@
 
 __docformat__ = 'reStructuredText'
 
+import config
+
 import docutils.nodes
 from docutils.parsers.rst import directives
 
-import config
+from navidoc.mp import mp2png, create_uml
 
 from navidoc.util.path import *
-from navidoc.mp import mp2png, create_uml
 
 dbg = config.dbg.shorthand('mp')
 dbg_fail = config.dbg.shorthand('mp.fail')
@@ -41,12 +42,15 @@
 def mp_directive(name, arguments, options, content, lineno,
         content_offset, block_text, state, state_machine):
     """
-    Metapost-directive. Writes content into_path metapost sourcefile,
-    add img-tag into docutils document tree and finally executes
+    Metapost-directive. Write content into_path metapost sourcefile,
+    add img-tag into docutils document tree and finally execute
     Metapost.
     """
+
+    # XXX This has not been tested for while :/
+    
     to_tmpdir = relative_path(config.working_directory, config.mp_directory)
-    eps_only = config.mp_eps_only # should no png files be generated
+    eps_only = config.mp_eps_only # Should no png files be generated
 
     attributes = {'name': arguments[0]}
     options['uri'] = slashify(to_tmpdir)+attributes['name']
@@ -60,8 +64,8 @@
         for line in content:
                 temp += line + "\n"
 
-        # XXX fatal error should be made if a diagram with the same name
-        # already exists.
+        # XXX Quite fatal exception should be raised if a picture with
+        # the same name already exists.
 
         mp_filename = slashify(config.mp_directory)+attributes['name']
         mp = open(mp_filename+config.midfix+'.mp.3', 'w')
@@ -79,13 +83,14 @@
 def uml_directive(name, arguments, options, content, lineno,
         content_offset, block_text, state, state_machine):
     """
-    UML-directive gets UML source as its content. At first the content
+    UML-directive get UML source as its content. At first the content
     is split into UML and MP parts. Then those parts are written into
     tmpdir. At last an image node "<img src=...>" is added into
     reST document tree.
     """
+    
     to_tmpdir = relative_path(config.working_directory, config.mp_directory)
-    eps_only = config.mp_eps_only # should no png files be generated
+    eps_only = config.mp_eps_only # Should no png files be generated
 
     attributes = {'name': arguments[0]}
     src = slashify(to_tmpdir)+attributes['name']
@@ -98,24 +103,24 @@
     options['_uml'] = attributes['name']
     uml_node = docutils.nodes.image(src, **options)
 
-    # if we have a caption, we want to make it a figure (or do we?)
+    # If we have a caption, we want to make this as a figure (or do we?)
     if options.has_key('caption') and len(options['caption']) > 0:
         uml_node = docutils.nodes.figure('', uml_node)
         caption = docutils.nodes.caption('', options['caption'], 
label=attributes['name'])
         uml_node += caption
 
-    # should context reference menu be embedded
+    # Should context reference menu be embedded
     if options.has_key('menu'):
         context_menu = options['menu']
     else: context_menu = 1
 
     if content:
-        # splits content into uml and mp parts
+        # Split content into UML and MP parts
         files = ['', '']
         current = 0;
         temp = ''
         for line in content:
-            if line.startswith('---'): # parts are separated with three or 
more "-"
+            if line.startswith('---'): # Part are separated with three or more 
"-"
                 files[current] = temp
                 current += 1
                 temp = ""
@@ -123,10 +128,10 @@
                 temp += line + "\n"
         files[current] = temp
 
-        # XXX fatal error should be made if diagram with the same name
-        # already exists.
+        # XXX Quite fatal exception should be raised if a diagram with
+        # the same name already exists.
 
-        # writes uml and mp sourcefiles and converts them into png and html
+        # Write UML and MP sourcefiles and convert them into png and html
         dir = slashify(config.mp_directory)
         diagram = attributes['name']
 
@@ -157,13 +162,13 @@
 def uml_refer_directive(name, arguments, options, content, lineno,
                         content_offset, block_text, state, state_machine):
     """
-    An image node"<img _uml=...>" is added into
-    reST document tree.
-    Excepts that diagram foo exists or is later generated from some
+    An image node "<img _uml=...>" is added into reST document tree.
+    Except that diagram ``foo`` exists or is  generated later from some
     other reST-document.
     """
+    
     to_tmpdir = relative_path(config.working_directory, config.mp_directory)
-    eps_only = config.mp_eps_only # should no png files be generated
+    eps_only = config.mp_eps_only # Should no png files be generated
 
     attributes = {'name': arguments[0]}
     src = slashify(to_tmpdir)+attributes['name']
@@ -185,7 +190,8 @@
 
 def add_refer(diagram, to_top = 0):
     """
-    Add reference information for a spesific diagram.
+    Add reference information for a spesific diagram. Later, context
+    menus are generated from the reference information.
     """
     refer = slashify(config.working_directory)+config.output_filename
     refers_filepath = 
slashify(config.mp_directory)+diagram+config.midfix+".refers"
Index: navidoc/navidoc/link/__init__.py
diff -u navidoc/navidoc/link/__init__.py:1.24 
navidoc/navidoc/link/__init__.py:1.25
--- navidoc/navidoc/link/__init__.py:1.24       Tue Jun 17 05:07:30 2003
+++ navidoc/navidoc/link/__init__.py    Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: __init__.py,v 1.24 2003/06/17 09:07:30 humppake Exp $
+#$Id: __init__.py,v 1.25 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -27,11 +27,17 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+Module contain the default link elements and basic methods for
+checking the existence of a target file.
+"""
+
 import config
 
-import navidoc
 import os.path, re
 
+import navidoc
+
 from navidoc.util.path import *
 
 dbg = config.dbg.shorthand('link')
@@ -47,9 +53,6 @@
     target = '' #None
 
     def __init__(self, var, toks, list):
-        """
-        Initilizes link.
-        """
        dbg("link: %s %s %s" % (var, toks,list))
 
         self.var = var or toks[0]
@@ -61,7 +64,7 @@
 
         if (len(toks) > 1):
             """
-            The 'link' may be followed by an attribute, which is
+            The ``link`` may be followed by an attribute, which is
             interpreted as keyword for one of the redirections mapped
             in config.
             """
@@ -95,7 +98,9 @@
 
     def set_status(self, set_title=0):
         """
-        Checks if the link target exists. Checks if the target
+        set_status(set_title=0)
+        
+        Check if the link target exists. Check if the target
         file is the current file. Could also parse
         <title> from the file and set it to title.
         """
@@ -129,6 +134,6 @@
 
     def draw_code(self):
         """
-        This should be overwritten elsewhere.
+        This should be overwritten by drawing implementation.
         """
         return ''
Index: navidoc/navidoc/link/docxx.py
diff -u navidoc/navidoc/link/docxx.py:1.7 navidoc/navidoc/link/docxx.py:1.8
--- navidoc/navidoc/link/docxx.py:1.7   Fri Jun 13 09:30:26 2003
+++ navidoc/navidoc/link/docxx.py       Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: docxx.py,v 1.7 2003/06/13 13:30:26 humppake Exp $
+#$Id: docxx.py,v 1.8 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -27,6 +27,10 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+Doc++ link element.
+"""
+
 import config
 
 import navidoc
@@ -83,7 +87,7 @@
 
     def set_target(self):
          """
-         Set the Doc++ -target.
+         Set the doc++ target.
          """
          parts = self.target.split('.')
          self.target = '::'.join(parts);
Index: navidoc/navidoc/link/javadoc.py
diff -u navidoc/navidoc/link/javadoc.py:1.11 
navidoc/navidoc/link/javadoc.py:1.12
--- navidoc/navidoc/link/javadoc.py:1.11        Fri Jun 13 09:30:26 2003
+++ navidoc/navidoc/link/javadoc.py     Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: javadoc.py,v 1.11 2003/06/13 13:30:26 humppake Exp $
+#$Id: javadoc.py,v 1.12 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -27,6 +27,11 @@
 
 __docformat__ = 'reStructuredText'
 
+
+"""
+Javadoc link element.
+"""
+
 import config
 
 import navidoc
@@ -60,7 +65,7 @@
 
         if not self.target or self.error:
             self.error = 0
-            # Case 1: explicit package link
+
             if len(list) > 0 and len(list[0][0][0]) > 0:
                 self.target = list[0][0][0]
             else: self.target = toks[0]
@@ -73,7 +78,7 @@
 
     def set_target(self):
          """
-         Set the Javadoc -target.
+         Set the javadoc target.
          """
          parts = self.target.split('.')
          self.target = '/'.join(parts);
Index: navidoc/navidoc/modules/imagemap.py
diff -u navidoc/navidoc/modules/imagemap.py:1.11 
navidoc/navidoc/modules/imagemap.py:1.12
--- navidoc/navidoc/modules/imagemap.py:1.11    Tue Jun 17 08:04:04 2003
+++ navidoc/navidoc/modules/imagemap.py Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: imagemap.py,v 1.11 2003/06/17 12:04:04 humppake Exp $
+#$Id: imagemap.py,v 1.12 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -27,11 +27,18 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+The postprocessing module, which creates imagemaps
+for linked diagrams and embeds focused and imagemapped
+diagrams also into target documents.
+"""
+
 import config
 
 import os.path, re
 
 from navidoc.mp import create_uml, MPLink, psbbox
+
 from navidoc.util.path import *
 
 dbg = config.dbg.shorthand('imagemap')
@@ -39,7 +46,7 @@
 
 def postprocess(path):
     """
-    HTML postprocessing function.
+    HTML postprocessing function called from rst2any.py.
     """
 
     dirlist = []
Index: navidoc/navidoc/mp/__init__.py
diff -u navidoc/navidoc/mp/__init__.py:1.42 navidoc/navidoc/mp/__init__.py:1.43
--- navidoc/navidoc/mp/__init__.py:1.42 Fri Jun 27 09:17:00 2003
+++ navidoc/navidoc/mp/__init__.py      Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: __init__.py,v 1.42 2003/06/27 13:17:00 humppake Exp $
+# $Id: __init__.py,v 1.43 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -27,6 +27,10 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+Metapost module.
+"""
+
 import config
 
 import os, os.path, re
@@ -42,6 +46,9 @@
 rough_edges = []
 
 def link_draw_code(self):
+    """
+    Metapost implementation of navidoc.link.draw_code.
+    """
     if config.mp_eps_only: return ''
     if not config.link_emphasize: return 'showlinksize("'+self.target+'", 
"'+self.title+'", ('+self.bbox+'));'
     if self.error: return 'showlinkerror("'+self.target+'", "'+self.title+'", 
('+self.bbox+'));'
@@ -126,7 +133,7 @@
         refers = refers_file.readlines()
         refers_file.close()
 
-        # Removing white spaces, just for case
+        # Remove white spaces, just for case
         for index in range(len(refers)):
             refers[index] = refers[index].strip()
         while refers.count(''): refers.remove('')
@@ -281,7 +288,7 @@
            links.append(MPLink(els))
     dbg(bbox)
 
-    # scales the bounding box and prepares it for pstopnm
+    # Scale the bounding box and prepares it for pstopnm
     if (bbox):
         bbox = psbbox(bbox[2:])
         list = bbox.pstopnm(scaling)
Index: navidoc/navidoc/mp/html.py
diff -u navidoc/navidoc/mp/html.py:1.4 navidoc/navidoc/mp/html.py:1.5
--- navidoc/navidoc/mp/html.py:1.4      Wed Jun 11 03:49:34 2003
+++ navidoc/navidoc/mp/html.py  Mon Jun 30 09:56:10 2003
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2002, 2003 Tuomas Lukka, Asko Soukka
+# Copyright (c) 2003 by Asko Soukka
 # 
 # This file is part of Navidoc.
 # 
@@ -19,10 +19,10 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: html.py,v 1.4 2003/06/11 07:49:34 humppake Exp $
+# $Id: html.py,v 1.5 2003/06/30 13:56:10 humppake Exp $
 
 #
-# Written by Tuomas Lukka, Asko Soukka
+# Written by Asko Soukka
 #
 
 __docformat__ = 'reStructuredText'
@@ -45,7 +45,7 @@
         self.name = var
         self.title = ' '.join(toks)
 
-        # Removing possible quotes
+        # Remove possible quotes
         if self.title.startswith('"') and self.title.endswith('"'):
             self.title = self.title[1:len(self.title)-1]
 
@@ -71,7 +71,7 @@
            picmeasurements(%%);
             """
        return self.repl(s)
-    def draw_code(self):#
+    def draw_code(self):
        s = """
            drawmeasuredpic(%%);
            draw bboxmeasuredpic(%%);
Index: navidoc/navidoc/mp/uml.py
diff -u navidoc/navidoc/mp/uml.py:1.21 navidoc/navidoc/mp/uml.py:1.22
--- navidoc/navidoc/mp/uml.py:1.21      Thu Jun 26 11:19:59 2003
+++ navidoc/navidoc/mp/uml.py   Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: uml.py,v 1.21 2003/06/26 15:19:59 humppake Exp $
+# $Id: uml.py,v 1.22 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -396,10 +396,6 @@
     def draw_code(self):
         s = ''
         if self.elements:
-#            elements_sw_x = '(xpart llcorner(' + '.pict), xpart 
llcorner('.join(self.elements) + '.pict))'
-#            elements_sw_y = '(ypart llcorner(' + '.pict), ypart 
llcorner('.join(self.elements) + '.pict))'
-#            elements_ne_x = '(xpart urcorner(' + '.pict), xpart 
urcorner('.join(self.elements) + '.pict))'
-#            elements_ne_y = '(ypart urcorner(' + '.pict), ypart 
urcorenr('.join(self.elements) + '.pict))'
             elements_sw_x = 'xpart ' + '.sw, xpart '.join(self.elements) + 
'.sw'
             elements_sw_y = 'ypart ' + '.sw, ypart '.join(self.elements) + 
'.sw'
             elements_ne_x = 'xpart ' + '.ne, xpart '.join(self.elements) + 
'.ne'
Index: navidoc/navidoc/mp/vobs.py
diff -u navidoc/navidoc/mp/vobs.py:1.1 navidoc/navidoc/mp/vobs.py:1.2
--- navidoc/navidoc/mp/vobs.py:1.1      Thu Jun 12 05:07:50 2003
+++ navidoc/navidoc/mp/vobs.py  Mon Jun 30 09:56:10 2003
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2002, 2003 Tuomas Lukka, Asko Soukka
+# Copyright (c) 2002, 2003 by Tuomas Lukka
 # 
 # This file is part of Navidoc.
 # 
@@ -19,10 +19,10 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: vobs.py,v 1.1 2003/06/12 09:07:50 humppake Exp $
+# $Id: vobs.py,v 1.2 2003/06/30 13:56:10 humppake Exp $
 
 #
-# Written by Tuomas Lukka, Asko Soukka
+# Written by Tuomas Lukka
 #
 
 __docformat__ = 'reStructuredText'
Index: navidoc/navidoc/parser.py
diff -u navidoc/navidoc/parser.py:1.19 navidoc/navidoc/parser.py:1.20
--- navidoc/navidoc/parser.py:1.19      Thu Jun 26 11:19:59 2003
+++ navidoc/navidoc/parser.py   Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-# $Id: parser.py,v 1.19 2003/06/26 15:19:59 humppake Exp $
+# $Id: parser.py,v 1.20 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Tuomas Lukka, Asko Soukka
@@ -30,20 +30,21 @@
 import config
 
 import mp, link
-from util.parser import *
 
+from util.parser import *
 
 dbg = config.dbg.shorthand('parser')
 
 class ElementFactor:
     """
-    Gather available linktypes from modules.
+    Factor to build elements imported from 'navidoc.mp' and navidoc.link'.
     """
 
-    top_class = navidoc.Element
+    top_class = navidoc.Element # Elements must be inherited from the top_class
 
     def __init__(self, module_paths):
         self.types = {}
+        # Gathers elements from modules.
         for module_path in module_paths:
             dbg ("Checking module: "+str(module_path))
             self.types.update(keys_for_classes(module_path, self.top_class))
@@ -51,7 +52,7 @@
                 if module not in ['os', 're']: module = getattr(module_path, 
module)
                 if type(module) == type(navidoc):
                     dbg ("Checking module: "+str(module))
-                    # XXX Needs check and exception for conflicting element 
types
+                    # XXX Needs check for conflicting element types and raise 
an exception
                     self.types.update(keys_for_classes(module, self.top_class))
         dbg("Collected: "+str(self.types))
 
@@ -59,13 +60,23 @@
         
     def get_type(self, key):
         """
-        Return an element type class reference for key.
+        get_type(key)
+
+        Return a class reference for correct element type referred by
+        the key.
         """
         if self.types.has_key(key):
             return self.types[key]
        else: raise ParserException("Unknown element key: "+key)
 
     def create_new(self, key, var, s, list):
+        """
+        create_new(key, var, s, list)
+
+        Create and return a new element of given type. ``Var`` is name
+        identifier of the new element, ``s`` parameters for it and
+        ``list`` contains all its subelements.
+        """
         type = self.get_type(key)
         dbg("Found element: "+str(type))
         new = type(var, s, list)
@@ -73,8 +84,8 @@
 
 class ElementList:
     """
-    Container class for parsed elements and collecting all
-    the generated rendering code for them.
+    Container class for parsed elements. Provide the interface
+    to generate all rendering code for its elements.
     """
     def __init__(self, list):
         """
@@ -90,7 +101,7 @@
         for element in list:
             element = self.parse_element(element)
             # Borders of linked elements should be drawn before element itself.
-            # Moves link border element from ``extras`` stack into ``elements``
+            # Move link border element from ``extras`` stack into ``elements``
             # in front of the linked element.
             if len(self.extras) > 0 and \
                    isinstance(self.extras[0], navidoc.link.Link):
@@ -100,19 +111,22 @@
 
     def add_contained_element(self, super, elements):
         """
+        add_contained_element(super, elements)
+        
         Add a subelement.
         """
        toks = elements[0]
         key = toks[0]
         toks.remove(key)
 
-        # XXX why no explicit var is given?
+        # XXX Why no explicit var is given?
         if super.var != None: toks.insert(0, super.var)
         else: toks.insert(0, super.name)
         element = self.factor.create_new(key, None, toks, elements[1:])
 
         if isinstance(element, navidoc.link.Link):
-            # mpclass may have different var and name, links should be based 
on name :/
+            # mpclass may have different var and name, links should be based 
on name
+            # and need special handling :/
             if isinstance(element, navidoc.link.Link) and super.var != 
super.name:
                 toks[0] = super.name
                 element = self.factor.create_new(key, None, toks, elements[1:])
@@ -122,23 +136,26 @@
             
     def parse_element(self, element):
         """
+        parse_element(element)
+        
         Parse a single element.
         """
 
        init = element[0]
         name = None
 
-        # catching explicit variable name from "element (foo) foo1"
+        # Catch explicit variable name from "element (foo) foo1"
         for tok in init:
             mat = re.match('^\((.*)\)$', tok)
             if mat:
                 name = mat.group(1)
                 init.remove(tok)
 
-        # catching explicit variable name from "foo = element foo1"
+        # Catch explicit variable name from "foo = element foo1"
         if init.count('='):
             if init.index('=') != 1:
-                raise ParserException('Variable preceding "=" cannot contain 
any whitespaces in "%s".' % ' '.join(init))
+                raise ParserException('Variable preceding "=" cannot ' \
+                                      +'contain any whitespaces in "%s".' % ' 
'.join(init))
             if len(init) < 3:
                 raise ParserException('Missing element name in "%s".' % ' 
'.join(init))
             name = init[0]
@@ -163,11 +180,15 @@
         return element
 
     def setup_code(self):
-       "Return the code to set up the objects for user geometry code"
+       """
+        Return the code to set up the objects for user geometry code.
+        """
        return "\n".join([element.setup_code() for element in self.list]) + "\n"
 
     def draw_code(self):
-       "Return code to draw the objects after the user code"
+       """
+        Return code to draw the objects after the user code.
+        """
        code = "\n".join([element.draw_code() for element in self.list]) + "\n"
        return code
 
Index: navidoc/navidoc/util/debug.py
diff -u navidoc/navidoc/util/debug.py:1.2 navidoc/navidoc/util/debug.py:1.3
--- navidoc/navidoc/util/debug.py:1.2   Wed Jun 11 03:49:34 2003
+++ navidoc/navidoc/util/debug.py       Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: debug.py,v 1.2 2003/06/11 07:49:34 humppake Exp $
+#$Id: debug.py,v 1.3 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -27,6 +27,10 @@
 
 __docformat__ = 'reStructuredText'
 
+"""
+Navidoc debug.
+"""
+
 class DebugFilter:
     """
     Navidoc debug stream handler class.
@@ -46,7 +50,7 @@
         """
         enable(self, dbg_name)
         
-        Enables output of a named debug stream.
+        Enable output of a named debug stream.
         """
         self.output_enabled[dbg_name] = 1
 
@@ -54,7 +58,7 @@
         """
         mute(self, dbg_name)
         
-        Mutes output of a named debug stream.
+        Mute output of a named debug stream.
         """
         self.output_enabled[dbg_name] = 0
 
@@ -63,7 +67,7 @@
         out(self, dbg_name, dbg_str)
 
         Print string to a named debug stream.
-        If the debug stream is muted, adds string into
+        If the debug stream is muted, add string into
         its buffer.
         """
         if self.output_enabled.has_key(dbg_name) \
Index: navidoc/navidoc/util/path.py
diff -u navidoc/navidoc/util/path.py:1.3 navidoc/navidoc/util/path.py:1.4
--- navidoc/navidoc/util/path.py:1.3    Mon Jun  2 09:58:14 2003
+++ navidoc/navidoc/util/path.py        Mon Jun 30 09:56:10 2003
@@ -19,7 +19,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: path.py,v 1.3 2003/06/02 13:58:14 humppake Exp $
+#$Id: path.py,v 1.4 2003/06/30 13:56:10 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -33,7 +33,7 @@
     """
     listdir(path, extensions, dirs=0)
 
-    Quite specialized listdir, which returns all directories and files
+    Quite specialized listdir, which return all directories and files
     with specific extensions under given path. Nonrecursive.
 
     Skipping files starting with '.' or including some of 'CVS', '#', '~'.
@@ -52,7 +52,7 @@
     """
     slashify(path)
 
-    Ends path with a trailing slash, if still necessary.
+    End path with a trailing slash, if still necessary.
     """
     if len(path) > 0:
         return (path+'/').replace('//','/')
@@ -62,7 +62,7 @@
     """
     relative_path(source, target)
 
-    Returns a relative filepath from the source filepath to the target
+    Return a relative filepath from the source filepath to the target
     filepath.
     """
     import config
@@ -70,10 +70,6 @@
 
     if source == None or len(source) == 0: return target
 
-    ## Condition removed because because of docutils sending
-    # relative and absolute paths mixed.
-    # 
-    # if source.startswith('../') or target.startswith('../'):
     source = os.path.normpath(os.path.abspath(source))
     target = os.path.normpath(os.path.abspath(target))
 
Index: navidoc/rst2any.py
diff -u navidoc/rst2any.py:1.32 navidoc/rst2any.py:1.33
--- navidoc/rst2any.py:1.32     Wed Jun 11 03:49:34 2003
+++ navidoc/rst2any.py  Mon Jun 30 09:56:09 2003
@@ -21,7 +21,7 @@
 # MA  02111-1307  USA
 # 
 
-#$Id: rst2any.py,v 1.32 2003/06/11 07:49:34 humppake Exp $
+#$Id: rst2any.py,v 1.33 2003/06/30 13:56:09 humppake Exp $
 
 #
 # Written by Asko Soukka
@@ -35,7 +35,6 @@
 import sys, os, getopt
 import docutils.core
 
-
 import navidoc.directives
 import navidoc.writers
 import navidoc.languages
@@ -44,7 +43,7 @@
 
 from navidoc.util.path import *
 
-# imports parser "plugins"
+# Import parser "plugins" from 'navidoc/link' and 'navidoc/mp'
 config.mp_includes = listdir('navidoc/mp',['mp'],dirs=0)
 dirlist = listdir('navidoc/mp',['py'],dirs=0)
 for module in dirlist:
@@ -61,40 +60,40 @@
 dbg = config.dbg.shorthand('navidoc')
 dbg_config = config.dbg.shorthand('config')
 
-# XXX: figure out, why docutils want locals to be cleaned
+# Docutils wants locales to be cleaned
 import locale
 try:
     locale.setlocale(locale.LC_ALL, '')
 except:
     pass
 
-# catching writer parameters from the command line
+# Catch actions from the command line
 try: sys.argv.remove('--imagemap'); imagemap = 1
 except ValueError: imagemap = 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 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
 
-# catching feature parameters from the command line
 try: sys.argv.remove('--texture'); texture = 1
 except ValueError: texture = 0
 
+try: sys.argv.remove('--loop'); loop = 1
+except ValueError: loop = 0
+
 def rst2any(input):
     """
-    Runs docutils for a single file.
+    rst2any(input)
+    
+    Run docutils for a single file.
     """
     last_dot = input.replace("../", "__/").rfind('.')
     if last_dot != -1: output = input[:last_dot]
@@ -133,6 +132,9 @@
 
 def postprocess(path):
     """
+    postprocess(path)
+    
+    Run selected postprocessing modules.
     """
     if metalink and os.path.isdir(path):
         import navidoc.modules.metalink
@@ -166,8 +168,10 @@
 
 def run_docutils(path):
     """
-    Selects all reST files under ``path`` directory (or the single file
-    specified by ``path``) and forwards them to conversion method.
+    run_docutils(path)
+
+    Select all reST files under ``path`` directory (or the single file
+    specified by ``path``) and forward them to conversion method.
     """
     if os.path.isdir(path) and not os.path.islink(path):
        dirlist = listdir(path,['rst'],dirs=1)
@@ -197,20 +201,16 @@
         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 debug parameters
+# Catch debug parameters
 dbg_names, sys.argv = getopt.getopt(sys.argv[1:], config.dbg.short, 
config.dbg.long)
 for dbg_name in dbg_names:
     config.dbg.enable(dbg_name[1])
     print 'Enabling debug output for:', dbg_name[1]
 
-# conversion loop
+# Conversion loop
 while 1:
     
-    #the first pass, docutils
+    # The first pass; Docutils with Navidoc directives
     for filepath in sys.argv:
         try: 
             run_docutils(filepath)
@@ -226,7 +226,8 @@
         except navidoc.mp.uml.UMLException, e:
             dbg("Fatal, UMLException: "+e.value)
             break
-    #the second pass, postprocess
+
+    # The second pass; Postprovessing modules
     for filepath in sys.argv:
         try:
             postprocess(filepath)
@@ -244,8 +245,8 @@
             break
 
     if not loop: break
-    print "\n\n"+'Navidoc finished. Press Enter to recompile.'+"\n"+ \
-          'Enter any other key to exit loop and quit.'
+    print "\n\n"+'Navidoc has finished. Press Enter to recompile.'+"\n"+ \
+          'Enter any other key to exit the loop and quit Navidoc.'
     if  raw_input().lower() != '':
         break
     print 'Rerunning Navidoc...'




reply via email to

[Prev in Thread] Current Thread [Next in Thread]