~ubuntu-branches/ubuntu/wily/dblatex/wily

« back to all changes in this revision

Viewing changes to lib/dbtexmf/core/xsltproc.py

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Hoenen
  • Date: 2008-08-11 20:28:56 UTC
  • mfrom: (4.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080811202856-d2qjg24ut53mgufx
Tags: 0.2.9-3
* Improve CJK (Chinese/Japanese/Korean) support:
  + Let XSL configuration parameter cjk.font default to gkai (instead of the
    cyberbit font not included in Debian).
  + Add Suggests dependency on latex-cjk-all for the gkai fonts.
  + Fix the db2latex style not to collide with the CJKutf8.sty file.
  Thanks to W. Martin Borgert for reporting and hints.
  Closes: #482857, #492350
* Fix a name clash with TeXLive for spanish documents in native style.
  Thanks to W. Martin Borgert for reporting.  Closes: #492304
* Support underscore characters in xreflabel attributes.  Thanks to
  Sébastien Villemot for reporting.  Closes: #492959

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Basic wrapper for xsltproc. Maybe we should directly use the lixslt Python
3
 
# API.
4
 
#
5
 
import os
6
 
 
7
 
class XsltProc:
8
 
    def __init__(self):
9
 
        self.verbose = 0
10
 
        self.catalogs = os.getenv("SGML_CATALOG_FILES")
11
 
        self.use_catalogs = 1
12
 
 
13
 
    def run(self, xslfile, xmlfile, outfile, opts=None, params=None):
14
 
        cmd = "xsltproc --xinclude -o %s " % outfile
15
 
        if self.use_catalogs and self.catalogs:
16
 
            cmd += " --catalogs "
17
 
        if params:
18
 
            for param in params:
19
 
                cmd += "--param %s \"'%s'\" " % (param[0], param[1])
20
 
        if opts:
21
 
            cmd += " ".join(opts) + " "
22
 
        cmd += "%s \"%s\"" % (xslfile, xmlfile)
23
 
        self.system(cmd)
24
 
 
25
 
    def system(self, cmd):
26
 
        if self.verbose: print cmd
27
 
        rc = os.system(cmd)
28
 
        if rc != 0:
29
 
            raise ValueError("xsltproc failed")
30