El dv., 13 de set. 2019, 1:27, Kevin Brubeck Unhammer <unham...@fsfe.org>
va escriure:

> So it seems the python script
> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx
> lets you do <def-macro> with templates like {{pfoo}}:
> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L5
> that the caller can replace:
> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L3223
> Perhaps
> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx-to-lrx.in
> should call both the XSLT and the python script? It seems they should be
> compatible, doing nothing if the special features aren't used. (If so,
> scripts/apertium-metalrx should probably be named somethingelse.py.)

Yes, I built that python script as a quick hack to see if that could be
done, and never really improved or documented it. My bad.

Originally, I tried extending somehow the xslt, but I after spending too
much time figuring it out, I decided to go with a simple python script.

It's compatible with the xslt: if I remember correctly, it needs to be
applied before, but that's about it in terms of requirements.

Personally, I'd also bundle xslt logic into the same script. I think python
is way more readable than xslt, but didn't do that either for several
* xslt "was already there". It existed in the past, and whoever implemented
that in xslt had (probably) a good reason to
* new python dependency: didn't want to introduce python dependency to all
packages that used to use the xslt script
* consistency across pairs: if python was not added everywhere, the
alternative would be to have some pairs with that logic being done via the
xslt script and some others via the python one

But I think now it's a good opportunity to consolidate, decide where we
want to go (I'd vote for python helper scripts), and try to document it.

Xavi Ivars
< http://xavi.ivars.me >
Apertium-stuff mailing list

Reply via email to