On Sun, Apr 17, 2005 at 01:24:07PM +0200, Jordi Vilalta wrote:
Well, my idea was to be able to reuse the options. Once po4aweb is
defined
(in the example above), there can be lots of documents using this "alias".
Maybe we could do a mix between both approaches: common options defined as
module aliases, and file-specific options defined in the file line.
OK, I was only thinking about the -o options.
So here is another implementation.
I was able to use:
[type:man] ../../chage.1 fr:fr/chage.1 add_fr:addendums/fr/chage.1.fr.add modopt:-L UTF-8
-v
[type:man] ../../chfn.1 fr:fr/chfn.1 add_fr:addendums/fr/addendum.fr modopt:-L latin-1
[type:man] ../../chpasswd.8 fr:fr/chpasswd.8 add_fr:addendums/fr/chpasswd.8.fr.add
modopt:-o debug=postrans
[type:man] ../../chsh.1 fr:fr/chsh.1 add_fr:addendums/fr/chsh.1.fr.add modopt:-o debug=0
[type:man] ../../dpasswd.8 fr:fr/dpasswd.8 add_fr:addendums/fr/addendum.fr
[type:man] ../../lastlog.8 fr:fr/lastlog.8 add_fr:addendums/fr/addendum.fr modopt:-k 0
However, I had to do a little modification on the initialize subroutine
from the man module:
As the man module uses a static variable to keep the options, this static
variable needs to be reset in initialize (other modules probably needs the
same correction). Otherwise, if you use -o debug=postrans, then all the
next files will inherit from this option without any way to disable it
Also, I had to add the verbose option to the man module in order to use
po4a -v <file>
(This is already in the CVS, but maybe some other modules need to be
fixed)
The main bug of this implementation is that it doesn't allow option
parameter with space to be set from the file. The handling of quotes
should be added later. BTW, if you know of any library which do that, it
may be interesting.
Also, I don't tested how options are overridden when they are set on the
command line and on the file.
We could use the same syntax (modopt and others) while defining the
module
aliases, being able to do something like:
[po4a_alias: po4aweb] xml modopt:inline="<a>" opt:"-k 0" \
opt_fr:"-L iso-8859-1" opt_zh:"-L utf-8"
[type: po4aweb] index.xml $lang:index.xml.$lang
[type: po4aweb] features.xml $lang:features.xml.$lang modopt:inline="<b>"
The attached implementation only allows a (or some) "modopt:" parameter.
However, it should be very simple to implement what you want (it is just a
matter of keeping the options, and appending all the relevant (the one
from the module, the one from the file and the one from the language)
options when needed.
Just let me know if it seems OK, and if I should commit it (after some
cleanups) before the release (it may need some testing).
Regards,
--
Nekral