/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Attributes
DybDbi::vld::sphinx_util::Style Class Reference

List of all members.

Public Member Functions

def roles
def body
def __str__
def __call__
def IntegerMap

Static Public Attributes

string head
string tail
tuple IntegerMap = classmethod(IntegerMap)

Detailed Description

Prepare an rst raw html style element and custom role declaration.
When this is included on an rst sourced Sphinx html page, text spans can be 
styled with::

  :r:`Get the r styling`  

Usage::

   s = Style(r="color: red;",g="background: grey;")
   s['g'] = "color: green;"
   print s("i want to be green","g")

Definition at line 35 of file sphinx_util.py.


Member Function Documentation

def DybDbi::vld::sphinx_util::Style::roles (   self)

Definition at line 62 of file sphinx_util.py.

00063                    :
00064         role = """.. role:: %(key)s"""
        return "\n".join([role % locals() for key in self]) + "\n\n"
def DybDbi::vld::sphinx_util::Style::body (   self)

Definition at line 65 of file sphinx_util.py.

00065                   : 
00066         body = """       span.%(key)s { %(val)s }"""
00067         return "\n".join([body % locals() for key,val in self.items()]) 
def DybDbi::vld::sphinx_util::Style::__str__ (   self)

Definition at line 68 of file sphinx_util.py.

00069                      :
00070         return self.head + self.body() + self.tail + self.roles()  

def DybDbi::vld::sphinx_util::Style::__call__ (   self,
  txt,
  key 
)

Definition at line 71 of file sphinx_util.py.

00072                                  :
00073         assert key in self, "style key %s not in %s " % ( key, self )
00074         return ':%(key)s:`%(txt)s`' % locals()

def DybDbi::vld::sphinx_util::Style::IntegerMap (   cls,
  ints,
  cmap = 'Spectral',
  att = 'background' 
)

Definition at line 75 of file sphinx_util.py.

00076                                                                   :
00077         """
00078         """
00079         mi = min(ints)
00080         mx = max(ints)
00081         norm = lambda i:float(i-mi)/float(mx-mi) + 0.0                   
00082         mp = CMap(cmap)
00083         sty = cls()
00084         for i in ints:
00085            sty["s%s"%i] = "%s: %s;" % (att, mp(norm(i)) )
        return sty 

Member Data Documentation

Initial value:
"""
.. raw:: html

<style type="text/css">
"""

Definition at line 50 of file sphinx_util.py.

Initial value:
"""
</style>


"""

Definition at line 55 of file sphinx_util.py.

Definition at line 86 of file sphinx_util.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:57:25 for DybDbi by doxygen 1.7.4