when xsltroot is specified, search logo relativly. Closes #106295

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changesetdf79b499e505
branchdefault
phasepublic
hiddenno
parent revision#f9987b3ce8bf Added the ability to describe a figure with a ReST topic
child revision#f5ecf722a387 Correcting bug in the conversion of ReST tables into XML DocBook tables
files modified by this revision
transformer.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1349108806 -7200
# Mon Oct 01 18:26:46 2012 +0200
# Node ID df79b499e5057ba63ed1b71c52a7d601055cdf4b
# Parent f9987b3ce8bf65427068ddb4bdd6720637d90abd
when xsltroot is specified, search logo relativly. Closes #106295

diff --git a/transformer.py b/transformer.py
@@ -241,11 +241,11 @@
1          ## TODO : Remove all references to xslt root and use id in catalog
2          # xslts location
3          ('xsltroot',
4           {'type': 'string',
5            'metavar' : "<xslt directory>",
6 -          'default' : '/usr/share/sgml/logilab-xml/stylesheet/',
7 +          'default' : None,
8            'help': "directory where logilab's stylesheets are located."
9            }),
10          )
11 
12      def __init__(self):
@@ -260,11 +260,10 @@
13              print '-' * 80
14              print "Transforms %s to %s using %s" % (input_file, output_file,
15                                                      xslt_file)
16          cmd = [self.config.xsltproc, self.config.xsltproc_opts,
17                 "--output ", output_file]
18 -        params = []
19          for name, value in self.config.parameters.items():
20              cmd.append('--param')
21              cmd.append(name)
22              cmd.append("\"'" + value + "'\"")
23          cmd.append(xslt_file)
@@ -338,10 +337,18 @@
24 
25 
26      def transform(self, filename):
27          """run transforms on filename
28          """
29 +        # process xsltroot to get a proper configuration
30 +        if self.config.xsltroot:
31 +            # ~/ in parameters isn't' appreciated
32 +            self.config.xsltroot = expanduser(self.config.xsltroot)
33 +            self.config.parameters.setdefault('logo.dir',
34 +                                              join(self.config.xsltroot, 'logos/'))
35 +        else:
36 +            self.config.xsltroot = '/usr/share/sgml/logilab-xml/stylesheet/'
37          # get transform parameters
38          to_remove = []
39          source_format = self.config.source
40          dest_format = self.config.target
41          preprocess = self.config.preprocess