1
# Twisted, the Framework of Your Internet
2
# Copyright (C) 2001-2002 Matthew W. Lefkowitz
4
# This library is free software; you can redistribute it and/or
5
# modify it under the terms of version 2.1 of the GNU Lesser General Public
6
# License as published by the Free Software Foundation.
8
# This library is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# Lesser General Public License for more details.
13
# You should have received a copy of the GNU Lesser General Public
14
# License along with this library; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
from twisted.lore import latex
20
from twisted.python import usage
22
class Options(usage.Options):
24
optFlags = [['section', 's', 'Generate a section, not an article']]
26
optParameters = [['dir', 'd', None, 'Directory relative to which references'
29
def parseArgs(self, *files):
36
klass = latex.SectionLatexSpitter
38
klass = latex.LatexSpitter
39
for file in opt['files']:
41
fout = open(os.path.splitext(file)[0]+'.tex', 'w')
42
dir = opt['dir'] or os.path.dirname(file)
43
spitter = klass(fout.write, dir)
44
spitter.makeConnection(None)
45
spitter.dataReceived(fin.read())