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


Author: zaran.krleza

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: poem-colons.patch

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz31146.
bzimport created this task.Via LegacySep 24 2011, 11:41 PM
brion added a comment.Via ConduitSep 26 2011, 6:10 PM

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.)

bzimport added a comment.Via ConduitOct 1 2011, 10:04 AM

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:

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.

bzimport added a comment.Via ConduitOct 1 2011, 10:05 AM

zaran.krleza wrote:

second proposal for the colon problem

Attached: poem-colons2.patch

brion added a comment.Via ConduitOct 5 2011, 10:17 PM

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.

bzimport added a comment.Via ConduitNov 14 2011, 4:55 PM

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 ?

bzimport added a comment.Via ConduitNov 16 2011, 1:16 AM

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.

bzimport added a comment.Via ConduitJun 11 2012, 6:44 PM

sumanah wrote:

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

kaldari added a comment.Via ConduitJun 29 2012, 8:53 PM

Patch checked in as Awaiting code review.

kaldari added a comment.Via ConduitJun 29 2012, 9:05 PM

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

Krinkle added a comment.Via ConduitJun 30 2012, 4:29 AM

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.

kaldari added a comment.Via ConduitJun 30 2012, 4:37 AM

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.

kaldari added a comment.Via ConduitSep 10 2012, 5:15 PM

Merged on sept. 8.

Ricordisamoa added a subscriber: Ricordisamoa.Via WebJan 20 2015, 12:24 AM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.