Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Private Attributes
MoinMoin.support.htmlmarkup.Fragment Class Reference
Inheritance diagram for MoinMoin.support.htmlmarkup.Fragment:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def append
def __call__
def serialize
def __unicode__
def __str__
def __add__

Public Attributes

 children

Static Private Attributes

list __slots__ = ['children']

Detailed Description

Definition at line 287 of file htmlmarkup.py.


Constructor & Destructor Documentation

Definition at line 290 of file htmlmarkup.py.

00290 
00291     def __init__(self):
00292         self.children = []


Member Function Documentation

def MoinMoin.support.htmlmarkup.Fragment.__add__ (   self,
  other 
)

Definition at line 327 of file htmlmarkup.py.

00327 
00328     def __add__(self, other):
00329         return Fragment()(self, other)
00330 

Definition at line 308 of file htmlmarkup.py.

00308 
00309     def __call__(self, *args):
00310         for arg in args:
00311             self.append(arg)
00312         return self

Here is the call graph for this function:

Definition at line 324 of file htmlmarkup.py.

00324 
00325     def __str__(self):
00326         return ''.join(self.serialize())

Here is the call graph for this function:

Definition at line 321 of file htmlmarkup.py.

00321 
00322     def __unicode__(self):
00323         return u''.join(self.serialize())

Here is the call graph for this function:

def MoinMoin.support.htmlmarkup.Fragment.append (   self,
  node 
)
Append an element or string as child node.

Reimplemented in MoinMoin.support.htmlmarkup.Element.

Definition at line 293 of file htmlmarkup.py.

00293 
00294     def append(self, node):
00295         """Append an element or string as child node."""
00296         if isinstance(node, (Element, Markup, basestring, int, float, long)):
00297             # For objects of a known/primitive type, we avoid the check for
00298             # whether it is iterable for better performance
00299             self.children.append(node)
00300         elif isinstance(node, Fragment):
00301             self.children += node.children
00302         elif node is not None:
00303             try:
00304                 for child in node:
00305                     self.append(child)
00306             except TypeError:
00307                 self.children.append(node)

Here is the call graph for this function:

Here is the caller graph for this function:

Generator that yield tags and text nodes as strings.

Reimplemented in MoinMoin.support.htmlmarkup.Element.

Definition at line 313 of file htmlmarkup.py.

00313 
00314     def serialize(self):
00315         """Generator that yield tags and text nodes as strings."""
00316         for child in self.children:
00317             if isinstance(child, Fragment):
00318                 yield unicode(child)
00319             else:
00320                 yield escape(child, quotes=False)

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in MoinMoin.support.htmlmarkup.Element.

Definition at line 288 of file htmlmarkup.py.

Definition at line 291 of file htmlmarkup.py.


The documentation for this class was generated from the following file: