Changeset 987


Ignore:
Timestamp:
Jul 2, 2012 7:23:59 AM (11 years ago)
Author:
jemian
Message:

refs #8, add .mac files to the index

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

Legend:

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

    r970 r987  
    3131from sphinx.domains import Domain, ObjType, Index       #@UnusedImport
    3232from sphinx.util.compat import Directive                #@UnusedImport
    33 from sphinx.util.nodes import make_refnode, nested_parse_with_titles
     33from sphinx.util.nodes import make_refnode, nested_parse_with_titles    #@UnusedImport
    3434from sphinx.util.docfields import Field, TypedField
    3535from sphinx.util.docstrings import prepare_docstring    #@UnusedImport
     
    4242#from sphinx.util.pycompat import base_exception, class_types
    4343from specmacrofileparser import SpecMacrofileParser
    44 from docutils.statemachine import ViewList
     44from docutils.statemachine import ViewList    #@UnusedImport
    4545
    4646
     
    5151word_match                  = r'((?:[a-z_]\w*))'
    5252cdef_match                  = r'(cdef)'
    53 extended_comment_flag       = r'\"\"\"'
    5453
    5554
     
    6564spec_cdef_name_sig_re = re.compile(double_quote_string_match,
    6665                                   re.IGNORECASE|re.DOTALL)
    67 
    68 
    69 spec_extended_comment_flag_sig_re = re.compile(extended_comment_flag,
    70                                                re.IGNORECASE|re.DOTALL)
    71 spec_extended_comment_start_sig_re = re.compile(r'^'
    72                                                 + non_greedy_filler
    73                                                 + extended_comment_flag,
    74                                                 re.IGNORECASE|re.DOTALL)
    75 spec_extended_comment_block_sig_re = re.compile(r'^'
    76                                                 + non_greedy_filler
    77                                                 + extended_comment_flag
    78                                                 + r'(' + non_greedy_filler + r')'
    79                                                 + extended_comment_flag
    80                                                 + non_greedy_filler
    81                                                 + r'$',
    82                                                 re.IGNORECASE|re.DOTALL|re.MULTILINE)
    8366
    8467
     
    150133        # This works for now.
    151134        self.add_line(u'', '<autodoc>')
     135        self.add_line(u'.. index:: SPEC macro file; %s' % macrofile, '<autodoc>')
     136        self.add_line(u'', '<autodoc>')
    152137        line = 'source code:  :download:`%s <%s>`' % (macrofile, macrofile)
    153138        self.add_line(line, macrofile)
    154         # TODO: Add each .mac file name to the Index
    155139
    156140        self.add_line(u'', '<autodoc>')
  • specdomain/trunk/src/specdomain/sphinxcontrib/specmacrofileparser.py

    r986 r987  
    369369        if not self.state == 'parsed':
    370370            raise RuntimeWarning, "state = %s, should be 'parsed'" % self.filename
     371        return self._simple_ReST_renderer()
     372
     373    def _simple_ReST_renderer(self):
     374        """create a simple ReStructured Text rendition of the findings"""
     375        if not self.state == 'parsed':
     376            raise RuntimeWarning, "state = %s, should be 'parsed'" % self.filename
    371377           
    372         s = []
    373378        declarations = []       # variables and constants
    374379        macros = []             # def, cdef, and rdef macros
    375380        functions = []          # def and rdef function macros
     381        title = 'Extended Comments'
     382        s = ['', title, '='*len(title), ]
    376383        for r in self.findings:
    377384            if r['objtype'] == 'extended comment':
Note: See TracChangeset for help on using the changeset viewer.