Changeset 1027
- Timestamp:
- Jul 15, 2012 11:41:05 PM (11 years ago)
- Location:
- specdomain/trunk/src/specdomain
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
specdomain/trunk/src/specdomain/doc/bugs.rst
r1017 r1027 1 1 .. $Id$ 2 3 .. _bugs: 2 4 3 5 =========== -
specdomain/trunk/src/specdomain/doc/conventions.rst
r1007 r1027 10 10 These are not requirements. 11 11 12 extended comments 12 .. index:: ! extended comment 13 14 extended comment 13 15 ----------------- 14 16 … … 25 27 It is assumed to be the summary. 26 28 If the first paragraph starts with a ":", no summary text will be assumed. 29 30 .. index:: ! descriptive comment 31 .. _descriptive comment: 27 32 28 33 descriptive comment … … 49 54 50 55 .. spec:global:: tth #: two-theta, the scattering angle 56 57 58 .. index:: ! hidden object 51 59 52 60 hidden objects -
specdomain/trunk/src/specdomain/doc/howto-markup.rst
r1026 r1027 39 39 40 40 Make a project directory and change directory into it. 41 (On my development system, this directory is called ``../markup_example``.) 41 42 Copy the file above into this directory with the name *hkl_ioc.mac*. 42 43 Then run:: … … 83 84 * :ref:`search` 84 85 85 Edit *conf.py* and make th is change:86 Edit *conf.py* and make these changes: 86 87 87 88 =================================================== ============================== 88 89 change directions 89 90 =================================================== ============================== 91 ``sys.path.insert(0, os.path.abspath('..'))`` *replace* line 19 90 92 ``extensions.append( 'sphinxcontrib.specdomain' )`` insert *after* line 28 91 93 =================================================== ============================== 92 94 93 The result should look like this file: :download:`../markup_example/conf.py`. 95 The revised file should look like this file: :download:`../markup_example/conf.py`. 96 97 Now, build the documentation by typing:: 98 99 make html 100 firefox _build/html/index.html & 101 102 You should expect a page that looks like this figure: 103 104 .. figure:: example1.png 105 :alt: view of original hkl_ioc.mac HTML documentation 106 107 Documentation of the original **hkl_ioc.mac** file. 108 94 109 95 110 Apply Markup … … 409 424 Do the same thing for the *ioc_put_HKL* macro definition. 410 425 411 412 426 Document the global variable 427 ---------------------------------- 428 429 On line 45 (in the original file), there is a global variable declaration: ``global SIOC_PV``. 430 The description for this variable has been deduced from its usage in this file with EPICS. [#]_ 431 It is possible to document :spec:global:`SIOC_PV` using a :ref:`descriptive comment`. 432 Insert the line containing ``global SIOC_PV`` with this one:: 433 434 global SIOC_PV ;#: soft IOC PV name 435 436 The semicolon is used to ensure that the spec command is finished. It might be unnecessary. 437 The descriptive comment can be used *in-line* to define the item on that line. 438 439 Similarly, add another :ref:`descriptive comment` to document line 38 (original file) by inserting this 440 line *before* the line that reads ``cdef("user_save_HKL","","ioc_HKL")``:: 441 442 #: preload check/setting here 443 444 Here the descriptive comment appearing on one line will provide a summary 445 for the item defined on the next line only. 446 447 Final Results 448 ================= 449 450 Rebuild the completed :download:`../markup_example/hkl_ioc.mac` documentation with:: 451 452 make html 453 454 .. note:: Don't be concerned about the warnings of 455 ``SEVERE: Duplicate ID: "cdef-user_save_HKL".`` 456 These messages are only informative. 457 This :ref:`bug <bugs>` should be resolved in a future version of ``specdomain``. 458 459 After refreshing the page in the WWW browser, it should like this: 460 461 .. figure:: example2.png 462 :alt: view of marked-up hkl_ioc.mac HTML documentation 463 464 Documentation of the marked-up **hkl_ioc.mac** file. 465 466 and the index will look like: 467 468 .. figure:: example3.png 469 :alt: index of marked-up hkl_ioc.mac HTML documentation 470 471 Index of the marked-up **hkl_ioc.mac** file. 472 473 .. note:: It is :ref:`planned for the future <todo>` to provide options for sorting the output alphabetically 474 and to provide other features. 413 475 414 476 ----------------- … … 426 488 .. [#] definition list: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#definition-lists 427 489 .. [#] table: http://sphinx.pocoo.org/rest.html#tables 490 .. [#] EPICS: http://www.aps.anl.gov/epics -
specdomain/trunk/src/specdomain/doc/todo.rst
r1013 r1027 1 1 .. $Id$ 2 3 .. _todo: 2 4 3 5 ============= -
specdomain/trunk/src/specdomain/markup_example/conf.py
r1022 r1027 17 17 # add these directories to sys.path here. If the directory is relative to the 18 18 # documentation root, use os.path.abspath to make it absolute, like shown here. 19 #sys.path.insert(0, os.path.abspath('.'))19 sys.path.insert(0, os.path.abspath('..')) 20 20 21 21 # -- General configuration ----------------------------------------------------- -
specdomain/trunk/src/specdomain/markup_example/hkl_ioc.mac
r1025 r1027 49 49 #=============================================================================== 50 50 if( unset("SIOC_PV") ) { 51 #: soft IOC PV prefix 52 global SIOC_PV 51 global SIOC_PV ;#: soft IOC PV name 53 52 local foo tmp[] 54 53 SIOC_PREFIX="4id" … … 70 69 71 70 if(("$1" == "on")) { 72 cdef("user_save_HKL","ioc_put_HKL","ioc_HKL","0x20") 71 cdef("user_save_HKL","ioc_put_HKL","ioc_HKL","0x20") ;#: turn on the save to shared memory 73 72 print "Now put HKL to softioc." 74 73 exit 75 74 } 76 75 if(("$1" == "off")) { 77 cdef("user_save_HKL","","ioc_HKL","delete") 76 cdef("user_save_HKL","","ioc_HKL","delete") ;#: turn off the save to shared memory 78 77 print "Stop put HKL to softioc." 79 78 exit -
specdomain/trunk/src/specdomain/sphinxcontrib/specmacrofileparser.py
r1017 r1027 441 441 #------------------------ reporting section below ---------------------------------- 442 442 443 def ReST(self):444 """create the ReStructured Text from what has been found"""445 return self._simple_ReST_renderer()446 447 443 def _simple_ReST_renderer(self): 448 444 """create a simple ReStructured Text rendition of the findings""" … … 452 448 s = [] 453 449 for r in self.findings: 450 # TODO: need to define subsections such as these: 451 # Summary (if present) 452 # Documentation (if present) 453 # Declarations 454 # Tables 454 455 if r['objtype'] == 'extended comment': 455 456 # TODO: apply rules to suppress reporting under certain circumstances … … 462 463 s.append(r['text']) 463 464 s.append( '' ) 465 # s.append( '-'*10 ) 466 # s.append( '' ) 464 467 elif r['objtype'] in ('def', 'rdef', 'cdef', ): 465 468 # TODO: apply rules to suppress reporting under certain circumstances … … 518 521 s.append( '' ) 519 522 523 # s.append( '-'*10 ) 524 # s.append( '' ) 525 520 526 s += _report_table('Variable Declarations (%s)' % self.filename, declarations, 521 527 ('objtype', 'name', 'start_line', 'summary', )) … … 527 533 528 534 return '\n'.join(s) 535 536 def ReST(self, style = 'simple'): 537 """create the ReStructured Text from what has been found""" 538 539 # allow for additional renderers, selectable by options 540 renderer_dict = {'simple': self._simple_ReST_renderer,} 541 if style not in renderer_dict: 542 raise RuntimeWarning, "%s renderer not found, using `simple`" % style 543 return renderer_dict[style]() 529 544 530 545
Note: See TracChangeset
for help on using the changeset viewer.