Discussion:
[Docutils-develop] [docutils:bugs] #276 ODT Writer strips classes from inline character markup when more than one class
Jeffrey C. Jacobs
2015-04-13 19:12:12 UTC
Permalink
---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Mon Apr 13, 2015 07:12 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Jeffrey C. Jacobs
2015-04-14 18:18:59 UTC
Permalink
Patch to address the problem. I have write-access to the repository so if this looks good I can check it in myself; I know the checkin will be reviewed anyway so if it's okay I can just commit it now. 1 test, it passes. I don't think needs to be documented as the behaviour is intuitive and is a rare-enough use-case that existing code should be fine and any code that may be changed should still work as expected. The only rare case where this would be an issue would be when the user defines an element with class x and class y then generates some text with rst-x and rst-y style and those styles are distinctive then the text should now have elements of both styles not just x as before, but if x and y contradict, x will override (if I understand the OpenOffice specification) because x is the innermost style.


Attachment: docutils-276.patch (3.4 kB; text/x-patch)


---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Mon Apr 13, 2015 07:12 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Günter Milde
2015-05-11 15:28:02 UTC
Permalink
the only rare case where this would be an issue ...
I am not sure, whether I fully understand, but

* in the rST specification, the order of class arguments does not matter (just like in HTML/CSS).

* in ODT, the innermost style "wins".

* The case of contradictory styles is undefined by the pure definition.

If the new code nests multiple styles in a way, so that the "winning" inner style is the one that was the only applied style before the change,
changes to existing documents due to this patch would be minimized.


---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Tue Apr 14, 2015 06:20 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Jeffrey C. Jacobs
2015-04-14 18:20:11 UTC
Permalink
This is the expected odt file, attached separately because it isn't included in the patch since it's binary (a zip file).


Attachment: odt_nested_class.odt (9.1 kB; application/vnd.oasis.opendocument.text)


---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Tue Apr 14, 2015 06:18 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Jeffrey C. Jacobs
2015-05-11 18:02:16 UTC
Permalink
The code is written so that the first class/style listed is the innermost (which is the reason for the call to ``reversed``). The previous behavior was to just use the first class so this would have the same behavior with existing code that defined two classes with conflicting styling. The only place where this would manifest differently and strictly more correctly with respect to HTML would be when the two classes/styles are orthogonal in so far as maybe one defining strictly a font size and the other strictly how heavy the font ("boldness"). The goal however is to generate the document in a strictly conformant way and blame the renderer (LibreOffice/OpenOffice/Word) for rendering it incorrectly when properly styled.


---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Tue Apr 14, 2015 06:20 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Jeffrey C. Jacobs
2015-05-11 18:04:07 UTC
Permalink
Wait, no, I do have it backwards. I'm removing the reversed as the nesting order is correct with the forward processing of classes. Thanks for catching that.



---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Mon May 11, 2015 06:02 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Jeffrey C. Jacobs
2015-05-11 18:14:09 UTC
Permalink
Oh, carp, I see why I had reversed. Because the class list is reversed relative to their definition in RST. So to achieve the default behavior we should not reverse the order *but* the default behavior is currently to ignore all but the last style/class specified in the RST. Is this our desired behavior? In a sense, it seems logical as last trumps all prior settings. So I propose keeping it in forward order and following the last-is-innermost paradigm.


---

** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**

**Status:** open
**Group:** Default
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Mon May 11, 2015 06:04 PM UTC
**Owner:** Jeffrey C. Jacobs

For the given RST markup:

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.

The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/

The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Guenter Milde
2015-05-11 19:27:55 UTC
Permalink
[-- Type: text/plain, Encoding: 7bit --]
Oh, carp, I see why I had reversed. Because the class list is reversed
relative to their definition in RST. So to achieve the default
behavior we should not reverse the order *but* the default behavior is
currently to ignore all but the last style/class specified in the RST.
Is this our desired behavior?
I's a bit tricky: per definitionem, order should not matter:

<inline classes="wof wuf"> == <inline classes="wuf wof">

In HTML/CSS, this is true for the input: the above is transformed to

<span classes="wof wuf"> rsp. <span classes="wuf wof">

but the order of CSS rules matters, e.g.

span.wof {color=blue;}
span.wuf {color=red;}

paints both role's content red.

However, in LaTeX as well as ODF, there is no provision for "same-level
classes": we must nest.

"latex2e" currently exports ``<inline classes="wof wuf">`` to
``\DUrole{wof}{\DUrole{wuf}{test}}``, with the inner function "winning"
in case of non-orthogonal layout definitions.
In a sense, it seems logical as last trumps all prior settings. So I
propose keeping it in forward order and following the last-is-innermost
paradigm.
The more important thing (at least IMO) is backwards compatibility.
However, as your stated this coincides with the LaTeX behaviour and with
your proposal and everything is fine.

Günter


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply t
Dave Kuhlman
2017-06-29 21:41:07 UTC
Permalink
I can work on bugs # 306, 282, and 276 on Monday.

Dave
--
Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Dave Kuhlman
2017-07-03 22:04:53 UTC
Permalink
I added this content to my test document (thanks for supplying it)::

.. role:: action
:class: action parenthetical

Hello... `(beat)`:action: ...there!

The ODT writer generated the following in content.xml inside the
resulting ODT file (after pretty printing it with ``tidy``)::

<text:p text:style-name="rststyle-textbody">Hello...
<text:span text:style-name="rststyle-action">
<text:span text:style-name="rststyle-parenthetical">
(beat)</text:span>
</text:span>...there!</text:p>

So, it does seem like the ODT writer is generating both styles, and,
like the bug reporter suggests, one style is nested inside the
other.

Can someone suggest how I can reproduce this problem. What is it
that I do not understand here?

Or, did someone fix this before I got here?

Dave K
- **labels**: --> ODT Writer
---
** [bugs:#276] ODT Writer strips classes from inline character markup when more than one class**
**Status:** open
**Group:** Default
**Labels:** ODT Writer
**Created:** Mon Apr 13, 2015 07:12 PM UTC by Jeffrey C. Jacobs
**Last Updated:** Mon May 11, 2015 06:14 PM UTC
**Owner:** Jeffrey C. Jacobs
.. role:: action
:class: action parenthetical
Hello... `(beat)`:action: ...there!
The generated ODT will only assign one style to the inline markup text "(beat)", rst-action. rst-parenthetical is not generated.
The Open Document Format allows multiple, nested text markup and the ODT writer should use this to mark up text when multiple classes are specified. http://ask.libreoffice.org/en/question/21875/writer-clarification-needed-about-character-attributes/
The fix shouldn't be too hard and is localized so I will consider making the change and posting a patch.
---
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
https://lists.sourceforge.net/lists/listinfo/docutils-develop
Please use "Reply All" to reply to the list.
--
Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Loading...