Changeset 965


Ignore:
Timestamp:
Jun 23, 2012 1:56:38 AM (10 years ago)
Author:
jemian
Message:

refs #8, section titles in extended comments now handled properly

Location:
specdomain/src/specdomain/sphinxcontrib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • specdomain/src/specdomain/sphinxcontrib/specdomain.py

    r964 r965  
    4242#from sphinx.util.pycompat import base_exception, class_types
    4343from specmacrofileparser import SpecMacrofileParser
     44from docutils.statemachine import ViewList
    4445
    4546
     
    117118    member_order = 50
    118119    priority = 0
     120    #: true if the generated content may contain titles
     121    titles_allowed = True
    119122
    120123    option_spec = {
     
    133136        Generate reST for the object given by *self.name*, and possibly for
    134137        its members.
    135 
    136         If *more_content* is given, include that content. If *real_modname* is
    137         given, use that module name to find attribute docs. If *check_module* is
    138         True, only generate if the object is defined in the module name it is
    139         imported from. If *all_members* is True, document all members.
    140138        """
    141139        # now, parse the SPEC macro file
     
    143141        spec = SpecMacrofileParser(macrofile)
    144142        extended_comment = spec.ReST()
    145        
    146         # FIXME:
    147         #     Assume all extended comments contain ReST formatted comments,
    148         #     *including initial section titles or transitions*.
    149         '''
    150             cdef-examples.mac:7: SEVERE: Unexpected section title.
    151            
    152             Examples of SPEC cdef macros
    153             ==============================
    154             test-battery.mac:4: SEVERE: Unexpected section title or transition.
    155            
    156             ###############################################################################
    157             test-battery.mac:6: WARNING: Block quote ends without a blank line; unexpected unindent.
    158             test-battery.mac:6: SEVERE: Unexpected section title or transition.
    159            
    160             ###############################################################################
    161             test-battery.mac:19: SEVERE: Unexpected section title.
    162            
    163             common/shutter
    164             ==============
    165         '''
    166 
    167143        rest = prepare_docstring(extended_comment)
    168144
     
    171147        #self.add_directive_header(sig)
    172148       
    173         # TODO: Another step should (like for Python) attach source code and provide
    174         #       links from each to highlighted source code blocks.
     149        # TODO: provide links from each to highlighted source code blocks (like Python documenters).
    175150        # This works for now.
    176151        self.add_line(u'', '<autodoc>')
     
    178153        self.add_line(line, macrofile)
    179154        # TODO: Add each .mac file name to the Index
    180        
     155
    181156        self.add_line(u'', '<autodoc>')
    182157        for linenumber, line in enumerate(rest):
    183158            self.add_line(line, macrofile, linenumber)
     159
    184160        #self.add_content(rest)
    185161        #self.document_members(all_members)
     
    194170       
    195171        :returns: True if if parsing was successful
    196 
    197         .. Note:: The template method from autodoc sets *self.modname*, *self.objpath*, *self.fullname*,
    198             *self.args* and *self.retann*.  This is not done here yet.
    199172        """
    200173        ret = self.name
    201         self.fullname = os.path.abspath(ret)        # TODO: Consider using this
    202         self.fullname = ret                         # TODO: provisional
     174        self.fullname = os.path.abspath(ret)
     175        self.objpath, self.modname = os.path.split(self.fullname)
     176        self.args = None
     177        self.retann = None
    203178        if self.args or self.retann:
    204179            self.directive.warn('signature arguments or return annotation '
  • specdomain/src/specdomain/sphinxcontrib/specmacrofileparser.py

    r963 r965  
    104104    '''
    105105
     106    # consider using:  docutils.statemachine here
    106107    states = (                  # assume SPEC def macros cannot be nested
    107108        'global',               # the level that provides the SPEC command prompt
Note: See TracChangeset for help on using the changeset viewer.