Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: third_party/twisted_8_1/twisted/lore/default.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 #
5 from __future__ import nested_scopes
6
7 from twisted.lore import tree, latex, lint, process
8 from twisted.web import sux, microdom
9
10 htmlDefault = {'template': 'template.tpl', 'baseurl': '%s', 'ext': '.html'}
11
12 class ProcessingFunctionFactory:
13
14 def getDoFile(self):
15 return tree.doFile
16
17 def generate_html(self, options, filenameGenerator=tree.getOutputFileName):
18 n = htmlDefault.copy()
19 n.update(options)
20 options = n
21 try:
22 fp = open(options['template'])
23 templ = microdom.parse(fp)
24 except IOError, e:
25 raise process.NoProcessorError(e.filename+": "+e.strerror)
26 except sux.ParseError, e:
27 raise process.NoProcessorError(str(e))
28 df = lambda file, linkrel: self.getDoFile()(file, linkrel, options['ext' ],
29 options['baseurl'], templ, o ptions, filenameGenerator)
30 return df
31
32 latexSpitters = {None: latex.LatexSpitter,
33 'section': latex.SectionLatexSpitter,
34 'chapter': latex.ChapterLatexSpitter,
35 'book': latex.BookLatexSpitter,
36 }
37
38 def generate_latex(self, options, filenameGenerator=None):
39 spitter = self.latexSpitters[None]
40 for (key, value) in self.latexSpitters.items():
41 if key and options.get(key):
42 spitter = value
43 df = lambda file, linkrel: latex.convertFile(file, spitter)
44 return df
45
46 def getLintChecker(self):
47 return lint.getDefaultChecker()
48
49 def generate_lint(self, options, filenameGenerator=None):
50 checker = self.getLintChecker()
51 return lambda file, linkrel: lint.doFile(file, checker)
52
53 factory = ProcessingFunctionFactory()
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/lore/_version.py ('k') | third_party/twisted_8_1/twisted/lore/docbook.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698