Commits

Christian Boos  committed a842955

ApiDoc: document `trac.util.presentation` module.

  • Participants
  • Parent commits 520bef9
  • Branches trunk

Comments (0)

Files changed (3)

File doc/api/trac_util.rst

 utilities.  If a category contains enough code in itself, it earns a
 sub-module on its own, like the following ones:
 
- - :doc:`trac_util_datefmt`
+.. toctree::
+   :maxdepth: 1
+   :glob:
+
+   trac_util_*
 
 
 Otherwise, the functions are direct members of the `trac.util` package

File doc/api/trac_util_presentation.rst

+:mod:`trac.util.presentation` -- Utilities for dynamic content generation
+=========================================================================
+
+.. module :: trac.util.presentation
+
+The following utilities are all available within Genshi templates.
+
+.. autofunction :: classes
+.. autofunction :: first_last
+.. autofunction :: group
+.. autofunction :: istext
+.. autofunction :: paginate
+.. autofunction :: separated
+.. autofunction :: to_json

File trac/util/presentation.py

     return u' '.join(classes)
 
 def first_last(idx, seq):
+    """Generate ``first`` or ``last`` or both, according to the
+    position `idx` in sequence `seq`.
+    """
     return classes(first=idx == 0, last=idx == len(seq) - 1)
 
 
 
 
 def istext(text):
+    """`True` for text (`unicode` and `str`), but `False` for `Markup`."""
     from genshi.core import Markup
     return isinstance(text, basestring) and not isinstance(text, Markup)