Can I select a Character style from XHTML chunk?

Asked by Luc Saffre

When using the "do text from xhtml()" clause, I want to get certain parts of a paragraph in a different font (e.g. Times Roman while the default font is Arial).

The documentation says:

pod uses the styles found in the pod template and tries to make a correspondence between style information in the XHTML chunk and styles present in the pod template. By default, when pod encounters a XHTML element: * it checks if a "class" attribute is defined on this element. If yes, and if a style with the same "display name" is found in the OpenDocument template, this style will be used. The "display name" of an OpenDocument style is the name of the style as it appears in OpenOffice, for example;

Now I tried the following:

<p class="MyStyle">Foo <font class="VariableText">bar</font></p>

on a template with a paragraph style named "MyStyle" and a Character style named "VariableText".
The paragraph style is being applied, but the character style not.

What am I doing wrong?

Luc

Question information

Language:
English Edit question
Status:
Solved
For:
Appy Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Gaëtan Delannay (gaetan-delannay) said :
#1

Hi Luc,
The "font" tag may not be supported by pod. Could you try with a "span" tag instead?
Thanks!
Gaetan

Revision history for this message
Luc Saffre (luc-saffre) said :
#2

I tried, but that didn't change anything.

Here is a zip file (temporary location) with my example files:
http://lino-framework.org/dl/tmp/appy_256313.zip

* Default.odt : appy pod template (containing the character style "VariableText")
* aids.IncomeConfirmation-6.odt : result file (The text "JJ//124/6" should be in Times Roman (as defined by VariableText), but is in Arial and has no character style attributed.
* certificate.body.html : Jinja2 template which is used to generate the xhtml (where you can see the <span> tag.

Luc

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Gaëtan Delannay (gaetan-delannay) said :
#4

Hi Luc,
I have committed a patch for this problem. Now, styles applied on "span" tags shoud work.
Could you retry ?
Thanks!
Gaetan

Revision history for this message
Fabio Leimgruber (fabio-leimgruber) said :
#5

Hi Gaetan,

did this change make it to the 0.9.2 release on PyPI? I would like to contribute a test for this feature. Could you also link to the revision of the commit?

Thanks!
Fabio