Changeset 942


Ignore:
Timestamp:
Jun 18, 2012 6:19:12 PM (10 years ago)
Author:
jemian
Message:

refs #8, apply ANL's short-form license, starting to understand how to get content added, try additional test case SPEC macro file

Location:
specdomain/src/specdomain
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • specdomain/src/specdomain/LICENSE

    r912 r942  
    1 If not otherwise noted, the extensions in this package are licensed
    2 under the following license.
     1Copyright (c) 2011-2012, UChicago Argonne, LLC
    32
    4 Copyright (c) 2010 by the contributors (see AUTHORS file).
    5 All rights reserved.
     3All Rights Reserved
    64
    7 Redistribution and use in source and binary forms, with or without
    8 modification, are permitted provided that the following conditions are
    9 met:
     5specdomain
    106
    11 * Redistributions of source code must retain the above copyright
    12   notice, this list of conditions and the following disclaimer.
     7BCDA, Advanced Photon Source, Argonne National Laboratory
    138
    14 * Redistributions in binary form must reproduce the above copyright
    15   notice, this list of conditions and the following disclaimer in the
    16   documentation and/or other materials provided with the distribution.
    179
    18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     10OPEN SOURCE LICENSE
     11
     12Redistribution and use in source and binary forms, with or without
     13modification, are permitted provided that the following conditions are met:
     14
     151. Redistributions of source code must retain the above copyright notice,
     16   this list of conditions and the following disclaimer.  Software changes,
     17   modifications, or derivative works, should be noted with comments and
     18   the author and organization's name.
     19
     202. Redistributions in binary form must reproduce the above copyright notice,
     21   this list of conditions and the following disclaimer in the documentation
     22   and/or other materials provided with the distribution.
     23
     243. Neither the names of UChicago Argonne, LLC or the Department of Energy
     25   nor the names of its contributors may be used to endorse or promote
     26   products derived from this software without specific prior written
     27   permission.
     28
     294. The software and the end-user documentation included with the
     30   redistribution, if any, must include the following acknowledgment:
     31
     32   "This product includes software produced by UChicago Argonne, LLC
     33   under Contract No. DE-AC02-06CH11357 with the Department of Energy."
     34
     35****************************************************************************
     36
     37DISCLAIMER
     38
     39THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND.
     40
     41Neither the United States GOVERNMENT, nor the United States Department
     42of Energy, NOR uchicago argonne, LLC, nor any of their employees, makes
     43any warranty, express or implied, or assumes any legal liability or
     44responsibility for the accuracy, completeness, or usefulness of any
     45information, data, apparatus, product, or process disclosed, or
     46represents that its use would not infringe privately owned rights.
     47
     48****************************************************************************
  • specdomain/src/specdomain/sphinxcontrib/specdomain.py

    r941 r942  
    44    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    55
    6     SPEC domain.
    7 
    8     :copyright: Copyright 2012 by Pete Jemian
    9     :license: BSD, see LICENSE for details.
     6    :synopsis: SPEC domain for Sphinx
     7   
     8    Automatically insert ReST-formatted extended comments
     9    from SPEC files for macro definitions and variable declarations into
     10    the Sphinx doctree, thus avoiding duplication between docstrings and documentation
     11    for those who like elaborate docstrings.
     12
     13    :copyright: Copyright 2012 by BCDA, Advanced Photon Source, Argonne National Laboratory
     14    :license: ANL Open Source License, see LICENSE for details.
    1015"""
    1116
     
    2530from sphinx.domains import Domain, ObjType, Index       #@UnusedImport
    2631from sphinx.util.compat import Directive                #@UnusedImport
    27 from sphinx.util.nodes import make_refnode
     32from sphinx.util.nodes import make_refnode, nested_parse_with_titles
    2833from sphinx.util.docfields import Field, TypedField
    2934from sphinx.util.docstrings import prepare_docstring    #@UnusedImport
     35
     36from docutils.statemachine import ViewList, string2lines
     37import sphinx.util.nodes
     38
    3039
    3140match_all                   = r'.*'
     
    199208        '''
    200209        extended_comments_list = self.parse_macro_file(sig)
     210        view = ViewList([u'TODO: recognize the ReST formatting in the following extended comment and it needs to be cleaned up'])
     211        node = nodes.paragraph()
     212        node.document = self.state.document
     213        self.state.nested_parse(view, 0, signode)
     214        # TODO: recognize the ReST formatting in the following extended comment and it needs to be cleaned up
    201215        for extended_comment in extended_comments_list:
    202             linenumber = -1                 # FIXME:
    203             #for line in prepare_docstring(extended_comment, ignore=1):
    204             #    self.result.append(self.indent + line, sig, linenumber)     # FIXME:
     216            for line in string2lines(extended_comment):
     217                view = ViewList([line])
     218                nested_parse_with_titles(self.state, view, signode)
    205219        return sig
    206220   
     
    227241            #e = node.end()
    228242            #t = buf[s:e]
    229             results.append(node.groups())            # TODO: can we get line number also?
     243            results.append(node.groups()[0])            # TODO: can we get line number also?
    230244        return results
    231245
  • specdomain/src/specdomain/test/test_doc.rst

    r940 r942  
    147147..  This should document the Python module supporting the specdomain
    148148
     149.. py:function:: test.testdoc.radius(x, y)
     150       
     151        :param float x: ordinate
     152        :param float y: abcissa
     153        :returns float: hypotenuse
     154       
     155        return math.sqrt(x*x + y*y)
     156
    149157:class:`SpecVariableObject` (Python Module)
    150158^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
    160168
    161169
    162 SPEC macro source file
    163 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     170SPEC macro source file: ``cdef-examples.mac``
     171^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    164172
    165173.. spec:macrofile:: cdef-examples.mac
     174
     175
     176SPEC macro source file: ``test-battery.mac``
     177^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     178
     179.. spec:macrofile:: test-battery.mac
Note: See TracChangeset for help on using the changeset viewer.