Exemple #1
0
 def node_section(self, node):
     name = node.get('id', None)
     tnode = get_children(node)[0]
     title = tnode.astext()
     if name is None:
         name = '-'.join(title.lower().split())
         if name[0] in '0123456789':
             name = '_' + name
         for i in "':?!/,;.&()[]":
             name = name.replace(i, '-')
     yield self.sectionTag[self.sectionLevel](id=name)[T.a(
         name=name)[self.children(tnode)]]
     self.sectionLevel += 1
     yield T.div(_class='section-%i' %
                 self.sectionLevel)[self.children(node)]
     self.sectionLevel -= 1
Exemple #2
0
 def render(self):
     yield T.raw(
         """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"""
     )
     yield T.html(xmlns="http://www.w3.org/1999/xhtml")[T.head[
         T.title[self.getTitle()],
         T.
         link(rel="stylesheet", type="text/css", href=self.getStylesheet()),
         T.meta(content="text/html; charset=UTF-8",
                **{'http-equiv': "Content-type"})], T.body[T.div(
                    id="page"
                )[T.div(id="header"
                        )[T.div(class_="menu-global"
                                )[self.getGlobalMenu()],
                          T
                          .div(class_="menu-local"
                               )[self.getLocalMenu(
                               )]],
                  T.div(id="content")[self.getContent(
                  )],
                  T.div(id="footer")[T.div(
                      class_="links"
                  )[T.
                    a(
                        href="http://ibiblio.org/"
                    )[T
                      .img(width="88",
                           src="http://www.ibiblio.org/images/ibiblio_logo.gif",
                           height="31",
                           alt="iBiblio")],
                    T.a(
                        href="http://sourceforge.net/projects/kgi"
                    )[T.
                      img(width="88",
                          src=
                          "http://sourceforge.net/sflogo.php?group_id=3788",
                          height="31",
                          alt="Sourceforge")]]], ]]]
Exemple #3
0
 def node_block_quote(self, node):
     return T.div(_class='blockquote')[self.children(node)]
Exemple #4
0
 def node_docinfo(self, node):
     return T.div(_class='docinfo')[T.table[self.children(node)]]
Exemple #5
0
 def node_tip(self, node):
     return T.div(_class='admonition-tip')[T.div(
         _class='admonition-title')['Tip'],
                                           self.children(node)]
Exemple #6
0
 def node_important(self, node):
     return T.div(_class='admonition-important')[T.div(
         _class='admonition-title')['Important'],
                                                 self.children(node)]
Exemple #7
0
 def node_note(self, node):
     return T.div(_class='admonition-note')[T.div(
         _class='admonition-title')['Note'],
                                            self.children(node)]
Exemple #8
0
 def unknown(self, node):
     print "*>> unknown node '%s'" % node.tagname
     if self.skipUnknownNodes:
         return
     yield T.div(style='border: 2px solid red; padding: .5em;')[
         self._unknown_node(node)]