Page MenuHomePhabricator

Replace colons by em spaces at the beginning of verses inside poem tag
Closed, ResolvedPublic

Description

Author: zaran.krleza

Description:
Patch to add colon replacement at the beginning of verses

In wikisource where the poem extension is mainly used, it has become common practice to use one or several colons at the beginning of indented verses. This is the most practical solution to get em spaces (the typographic rule is to indent shortest verses by one em space for each missing foot compared to the longest verse). However, the html generated code is really ugly in those cases : sometimes up to 5 or 6 nested definition lists.

My solution : inside the poem tag, replace the colons at the beginning of each line by em spaces: &amps;emsp;. The result will be the same for the reader, but the underlying html code will be much cleaner.

Patch enclosed.


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz31146

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:51 PM
bzimport set Reference to bz31146.
bzimport added a subscriber: Unknown Object (MLST).

This would render very differently in the case of line wrapping: when using the standard wiki indentation (implemented with dl/dd) a wrapped line's second line will also be indented, whereas when implementing by putting non-collapsable spaces at the beginning of the line, no such indentation will be carried on to the wrapped line.

What would be the actual intended case for how that should look and behave?

(Appearance and behavior is what's important, not the attractiveness of the HTML, though it's nice to have clean code and nicer to have cleanly stylable code.)

zaran.krleza wrote:

The problem of line-wrapping is indeed a legitimate concern, however, please note that i only intend to change the behavior of colons inside the poem tag. In this case, it's hard to tell what should be the correct indentation after a line-wrap: if you carry on the indentation, the wrapped line might be mistaken for a new verse.

In wikisource, verses are sometimes indented using simple spaces. This also does not indent the second part of wrapped verses.

I don't think that the appearance of the HTML code is important. My concern is about accessibility and is twofold:

  • the current solution is semantically incorrect: an indented verse is not a definition list, it's just a verse which is indented. Furthermore, when the indentation starts, the preceding paragraph is closed and a definition list starts, as if it was a break in the stanza
  • screen readers for visually impaired persons: nested definition lists is not easily understandable for such readers

I propose a second patch which has the same visual effect as definition lists, without the downside of nesting them and semantically more correct (it just encapsulate the indented verse inside a span tag).

You can find a comparison between the normal behavior and my two patches on my user page: http://fr.wikisource.org/wiki/Utilisateur:Zaran/Po%C3%A8me

Finally, note that there is no firm rule stating how wrapped verses should be rendered. The best solution is always to chose a sufficient text width. In this case, both of my patches are improvements to the current situation.

zaran.krleza wrote:

second proposal for the colon problem

Attached:

Just noting that bug 4521 asks more generally for making the :-as-indentation more semantically nice; I don't seem much of a difference between the general and the <poem> case.

sumanah wrote:

Thanks for the patch, Zaran. It seems to me that it still awaits code review, so I am marking this bug as such. But do you perhaps have a response to Brion's comment 4 ?

zaran.krleza wrote:

Thanks Sumana for the feedback. I wasn't aware of bug 4521 until Brion's comment. I think bug 4521 is an interesting discussion which could hopefully lead to a solution to a more general problem : colons are often use inappropriately, which results in a heavy inaccessible code. While I wholeheartedly support bug 4521, I still reckon that the poem extension needs an easy way to insert em spaces at the beginning of verses, the same way that spaces at the beginning of verses at converting into non-breaking spaces. Maybe a character other than colons should be used for em spaces. I suggest using > (greater than). If you think that is a good idea, I will adapt the patch.

sumanah wrote:

Zaran, I don't know -- maybe you should ask other users of the Poem extension, via a few of the Village Pumps?

Zaran: Is it OK it list your email address publicly in the file header?

So, should the content after the line-wrap be indented as well or not?

Generally when reading professional text, I see that only the first line of the paragraph is indented. I don't know if this is the same grammatical context or not. But having an answer to that would make reviewing the change easier I suppose.

I imagine that an editor using a colon to indent a section is going to expect the regular behavior of a colon—in which line-wrapped content is also indented. An editor that wants only the non-wrapped content indented can use spaces.