Page MenuHomePhabricator

VisualEditor should add a space before every pipe character used in a cite template
Closed, InvalidPublic

Description

Currently I think citoid (and all the projects that use it) add citations as as single long string. This is bad. It is hard to read and screws up the text-wrapping in browsers HTML textfields. A space should go before very pipe character used to separate parameters in a cite template.

Event Timeline

Jason_Quinn renamed this task from citoid should add spaces before every pipe used in a cite template to citoid should add a space before every pipe character used in a cite template.Oct 13 2020, 12:56 PM
Mvolz renamed this task from citoid should add a space before every pipe character used in a cite template to VisualEditor should add a space before every pipe character used in a template.Oct 17 2020, 2:53 PM
Mvolz edited projects, added VisualEditor; removed Citoid.
Jason_Quinn renamed this task from VisualEditor should add a space before every pipe character used in a template to VisualEditor should add a space before every pipe character used in a cite template.Oct 19 2020, 11:09 AM

I just posted about this on Talk:Citoid thinking that Citoid handles the output of the citation code to the MediaWiki text editor. An hour later, I stumbled on this ticket, which seems to suggest VisualEditor is responsible for that output?

Personally, I don't need this hard coded in, as Jason requests; I'd be content in simply knowing which file I need to edit. But if we can hard code a space in before each pipe in the generated output, I'd be tickled with that too. But it doesn't immediately solve my problem. It looks like I need to dig around in the VisualEditor code?

The spaces can be customized by editing the "format" specified in TemplateData of each citation template, as described here: https://www.mediawiki.org/wiki/Help:TemplateData#Custom_formats

For example, Polish Wikipedia's universal citation template uses an extra-spacey inline format: https://pl.wikipedia.org/w/index.php?title=Szablon:Cytuj/opis&action=edit&section=9 (specified at the bottom: "format": "{{_ |_ = _}}").

Note that if you want to change this on Wikipedia, or any other large project, you should probably discuss it somewhere with the community. Some people feel very strongly about their spaces. And also note that when the format is changed, it will cause VisualEditor to update the formatting of each citation whenever someone makes changes to it; this can cause annoying dirty diffs and even accidental edit wars with bots that maintain citations.

The spaces can be customized by editing the "format" specified in TemplateData of each citation template, as described here: https://www.mediawiki.org/wiki/Help:TemplateData#Custom_formats

For example, Polish Wikipedia's universal citation template uses an extra-spacey inline format: https://pl.wikipedia.org/w/index.php?title=Szablon:Cytuj/opis&action=edit&section=9 (specified at the bottom: "format": "{{_ |_ = _}}").

Ha HA! That makes sense! I did look at our TemplateData, and even noted the "format": "inline" at the bottom. However, I didn't think to even look at the extension page for TemplateData for more insight. I'll give this a try!

Note that if you want to change this on Wikipedia, or any other large project, you should probably discuss it somewhere with the community. Some people feel very strongly about their spaces. And also note that when the format is changed, it will cause VisualEditor to update the formatting of each citation whenever someone makes changes to it; this can cause annoying dirty diffs and even accidental edit wars with bots that maintain citations.

Perfectly valid point! Fortunately, this is largely a private wiki. I end up doing about 99% of the entry on it.

I'll go test this now and report back.

THANK YOU, matmarex. Your timely post is appreciated heartily! I tip my cap to you.

That said, I feel like I should add this somewhere on the Citoid documentation.

I added a section to the citoid documentation page about this formatting. I reused some of your language, @matmarex . I hope you are not bothered by that.