~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/lore/howto/listings/lore/spitters.py-2

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from twisted.lore import latex
 
2
from twisted.lore.latex import processFile
 
3
import os.path
 
4
 
 
5
# 2. Create a new mixin that does what the old MyLatexSpitter used to do:
 
6
# process the new classes we defined
 
7
class MySpitterMixin:
 
8
    def visitNode_span_productname(self, node):
 
9
        self.writer('\\underline{')
 
10
        self.visitNodeDefault(node) 
 
11
        self.writer('}')
 
12
 
 
13
    def visitNode_span_marketinglie(self, node):
 
14
        self.writer('\\begin{bf}\\begin{Large}')
 
15
        self.visitNodeDefault(node)
 
16
        self.writer('\\end{Large}\\end{bf}')
 
17
 
 
18
# 3. inherit from the mixin class for each of the three sub-spitters
 
19
class MyLatexSpitter(MySpitterMixin, latex.LatexSpitter):
 
20
    pass
 
21
    
 
22
class MySectionLatexSpitter(MySpitterMixin, latex.SectionLatexSpitter):
 
23
    pass
 
24
 
 
25
class MyChapterLatexSpitter(MySpitterMixin, latex.ChapterLatexSpitter):
 
26
    pass