Allow refs to be hidden
Closed, DeclinedPublic


Author: thomas.dalton

A patch to add a parameter to ref tags. <ref name="foo" hidden="true">text</ref> won't appear inline and won't be linked back to, it allows the text to be defined down the bottom (the first instance of a ref can't be hidden, so the text needs to be defined at the bottom, not the top - makes it much simpler to code and I can't see why anyone would want to define it at the top). It seems other people have written code to do much the same thing, but I haven't seen any approach quite this simple (apart from the code to handle a new parameter, it's just the addition of one if statement).

Version: unspecified
Severity: enhancement


bzimport set Reference to bz15724.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Sep 25 2008, 4:06 PM

thomas.dalton wrote:


Attached: hiddenrefs.patch

ayg wrote:

I don't like this syntax much. It's both unduly general (you only want to hide things in very limited contexts, so the generality is confusing) and unduly verbose (repetitive extra 'hidden="true"' even on top of the extra <ref> tag). A nicer syntax, which has been proposed elsewhere before, would be something like:

<ref name="a" />

<ref name="a">...contents...</ref>

This forces the references without backlinks to be defined in a nice, consistent, expected place. It also adds no new keywords, just adapts existing ones. There are probably other nice syntaxes too.

thomas.dalton wrote:

Sure, that's just more difficult to code! Also, if you're doing it that way, I would use a new tag, <ref> should do the same thing everywhere, having it context dependant seems a bad idea to me.

ayg wrote:

A matter of taste, I guess. I don't think it does something very different there, its behavior is only slightly altered (to not display the note).

Please test and confirm this works, and has no regressions. If I get positive responses, I will commit.

Anomie added a comment.Nov 3 2008, 1:10 AM

I have to say, I agree with Aryeh Gregor in comment #2. That syntax would make much more sense.

The patch does not actually work as advertised on my local installation; the first instance of any named ref is shown, "hidden" or not. If this is corrected, it still doesn't always hide the linkbacks from the <references/> tag and still includes refs in <references/> that are never actually displayed at all in the article.

thomas.dalton wrote:

That's the correct behaviour and is as advertised in the first comment on this bug. The method I used makes it difficult to hide the first instance, it could be done but would make the patch significantly more complicated. I don't see why people would be hiding the first instance anyway, so I didn't bother - it makes much more sense to put the text at the bottom of the article than top. Are there times it doesn't hide linkbacks other than with the first instance? If so, could you give details? I don't see how refs could be included in <references/> without being displayed in the article since the first instance is always displayed, could you explain further?

Anomie added a comment.Nov 3 2008, 1:41 AM

Ok, I stand corrected. It does work as designed, it's just broken as designed. Why have a general parameter that is ignored on the "first" instance of the reference on the page? Much better to use Aryeh Gregor's syntax that doesn't have such confusion.

thomas.dalton wrote:

As I said, I implemented it that way because it is far simpler (which reduces the chance of un-noticed bugs) and will almost never be an issue.

The alternative described in comment #2 has now been implemented and is live on Wikipedia. A community discussion (around last June) generally disfavored the creation of a "hide" syntax. Since the now existing approach already covers most use cases, I'm closing this version as WONTFIX.

Add Comment