Topic on Extension talk:Cite/Flow archive

Is there a technical reason for why the tag name cannot be a simple integer?

11
Elominius (talkcontribs)

For example, <ref name=2022>test</ref> results in "Cite error: The <ref> tag name cannot be a simple integer."

I don't mind this restriction, but I am just asking out of curiosity.

Ancheta Wis (talkcontribs)

The explanation looks something like "the object should be symbolic in nature, and not a number (in C programming, a symbol is like a string; a symbol does not begin with a number -- that would fool the parser into thinking the object being parsed is some kind of number)".

Jdforrester (WMF) (talkcontribs)

I believe this restriction comes from the HTML specification. If you want to use a number-like value as the name, you should quote it (which ideally you should do anyway), i.e. <ref name="2022">test</ref> or similar.

MasterQuestionable (talkcontribs)

Typically most (if not all) parsers make no distinction of strings and numbers in this context. ("everything is string" likely)

Ancheta Wis (talkcontribs)

<ref name= a12345 >test</ref> works perfectly well.

Jdforrester (WMF) (talkcontribs)

It "works" because people are lazy and write it without quotes, but, as I said, properly you should quote it.

Thiemo Kreuz (WMDE) (talkcontribs)

It's not about the quotes. The original reason is that <ref> tags without a name=… are automatically named – with numbers. While there would be a way to allow both (e.g. by prepending two different prefixes) the original authors of this extension found it easier and less confusing for everybody to reserve numbers for internal use.

I hope this helps.

This post was hidden by MasterQuestionable (history)