Hello Jerome,
great, thank you!
I've used the refined third solution and now I like it very much. Let
me write a comment in case somebody else would like to reuse it. You wrote:
> You can further refine the solution, by adding the different
> prefixes and suffixes as parameters of the element to make your element
> more flexible.
>
> def format_element(bfo, my_prefix="", my_suffix="", \
> my_acad_prefix="", my_acad_suffix=""):
> [...]
> if out:
> if bfo.field('980__a') in academic_collections:
> return my_acad_prefix + out + my_acad_suffix
> else:
> return my_prefix + out + my_suffix
The small catch is that, as previously noted, bibformat uses a variable
called `prefix' to prefix our output. So, in our
Default_HTML_detailed.bft, the prefix value *must* be empty (otherwise
the output gets both prefixes), and we have to use a different name,
like `other_prefix'. In my case:
<BFE_SERIES
prefix=""
academic_prefix="<br/><span
class='etiqueta'><lang><en>Studies</en><es>Titulación</es><ca>Titulació</ca></lang>:
</span><span class='text'>"
other_prefix="<br/><span
class='etiqueta'><lang><en>Series</en><es>Colección</es><ca>Col·lecció</ca></lang>:
</span><span class='text'>"
suffix="</span>"
/>
And, in my bfe_series.py function, change the definition to recognise
the new parameter, and the return value accordingly:
def format(bfo, academic_prefix="", other_prefix="", separator=" ",
highlight='no'):
[...]
if (bfo.field('980__a') in academic_collections):
return academic_prefix + out
else:
return other_prefix + out
Using your refined solution, the output is magically multilingual (no
if-then-else). Bibformat is really flexible (once you know how to use
it, that is).
Thanks again,
Ferran