Last modified: 2010-05-17 02:41:07 UTC
Created attachment 6100 [details] mediawiki markup showing the problem I am attempting to build a template that uses <ref> and <references/> from the Cite extension. There is a known problem for which a workaround is given in http://en.wikipedia.org/wiki/Help:Cite_errors#Templates. This workaround works on my local mediawiki installation, but does not on the current version of Wikibooks. The respective pertinent versions are: My MediaWiki version = 1.14.0, Wikibooks MediaWiki version = 1.15alpha (r48811); My Cite extension version = r44056, Wikibooks Cite extension version = r47190. To reproduce the problem that appears on wikibooks, you can use the mediawiki markup in the attached file. The file is divided into two sections. In the first section (titled Second Sandbox) is wikimarkup using a template defined in the second section (titled Third Sandbox). You will have to load the markup in the first section into one sandbox and the markup in the second section into a different sandbox. Then you will have to change the template call {{User:Dnessett/Sandboxes/Third Sandbox}} in the second sandbox section to reference the sandbox holding the third sandbox section markup (obviously, the titles Second Sandbox and Third Sandbox including the underlining should not go into either of the test sandboxes). According to the workaround referenced above, when previewing the second sandbox, there should be no error. As I state above, there is no error on my local mediawiki wiki. However, the error : "Cite error: <ref> tags exist, but no <references/> tag was found" appears when I preview or save the second sandbox on Wikibooks. This is the error that the workaround supposedly eliminates. Note the Platform and OS information in this bug report specifies the platform for my local wiki. The platform and OS of the wikibooks wiki is unknown to me. My local wiki uses PHP, Apache and MySQL installed using MAMP.
============================================== <div style="display: none"> {{User:Dnessett/Sandboxes/Third Sandbox}} </div> Some text <ref name="Knuth1968"> {{reflist}} ============================================== Should be ============================================== <div style="display: none"> {{User:Dnessett/Sandboxes/Third Sandbox}} </div> Some text <ref name="Knuth1968"/> {{reflist}} ============================================== Or that second ref tag is unclosed and 'eats' the rest of the page content. There *is* a rendering difference between enwiki and other WMF wikis (I tested on enwikibooks and testwiki, both display the cite error, while enwiki doesn't), but that is probably due to the unusual things enwiki has done to its cite error messages.
(In reply to comment #1) > ============================================== > <div style="display: none"> > > {{User:Dnessett/Sandboxes/Third Sandbox}} > > </div> > > Some text <ref name="Knuth1968"> > > {{reflist}} > ============================================== > > Should be > > ============================================== > <div style="display: none"> > > {{User:Dnessett/Sandboxes/Third Sandbox}} > > </div> > > Some text <ref name="Knuth1968"/> > > {{reflist}} > ============================================== > > Or that second ref tag is unclosed and 'eats' the rest of the page content. > There *is* a rendering difference between enwiki and other WMF wikis (I tested > on enwikibooks and testwiki, both display the cite error, while enwiki > doesn't), but that is probably due to the unusual things enwiki has done to its > cite error messages. > I didn't get the second sandbox markup correct in the attachment (my apologies). It should have been (correcting the unclosed second ref tag) ================================================ <div style="display: none"> {{User:Dnessett/Sandboxes/Third Sandbox}} </div> Some text <ref name="Knuth1968"/> ================================================ This works on my local wiki and not in wikibooks. I am replying rather than reopening the bug, since if I am doing something else wrong, I don't want to ping/pong bug opening unnecessarily.
Why WONTFIX?? The bug as presented was invalid. The new bug is also invalid: your markup boils down to: ================================================ <ref name=foo>Ref text</ref> <ref>Ref text</ref> <references/> Some more text <ref name=foo/> ================================================ You are adding a <ref> tag after the final <references/> tag on a page, hence there is nowhere to render the reference, hence you get an error. This is expected behaviour. If you do not get this behaviour on your test wiki, *that* is the bug.
(In reply to comment #3) > Why WONTFIX?? The bug as presented was invalid. The new bug is also invalid: > your markup boils down to: > > ================================================ > > <ref name=foo>Ref text</ref> > <ref>Ref text</ref> > > <references/> > > Some more text <ref name=foo/> > > ================================================ > > You are adding a <ref> tag after the final <references/> tag on a page, hence > there is nowhere to render the reference, hence you get an error. This is > expected behaviour. If you do not get this behaviour on your test wiki, *that* > is the bug. > I agree this is not a mediawikia software bug. It appears to be a configuration "bug" on either enwiki or enwikibooks. One works one way, the other works the other way. Also, the workaround (admittedly for enwiki, not enwikibooks) doesn't work. Authors are encouraged to use Wikipedia content in Wikibooks, so this configuration difference is important. After looking through the "contact us" information on wikibooks, there doesn't appear to be any place to report configuration issues. If you can point me in the right direction, I would be grateful.
The error renders as expected on enwikibooks; and also on enwiki in the main namespace (the cite error messages have been customised on enwiki to not display the error outside the mainspace). You are simply using incorrect markup. The workaround is for the problem of the error message appearing on the *template* page because there are ref tags in the template but no <references/> tag on the template page. A <references/> tag is still needed on the page where the template is transcluded, to render the references visibly. I think you've misunderstood what the 'workaround' is supposed to accomplish.
(In reply to comment #5) > The error renders as expected on enwikibooks; and also on enwiki in the main > namespace (the cite error messages have been customised on enwiki to not > display the error outside the mainspace). You are simply using incorrect > markup. The workaround is for the problem of the error message appearing on > the *template* page because there are ref tags in the template but no > <references/> tag on the template page. A <references/> tag is still needed on > the page where the template is transcluded, to render the references visibly. > I think you've misunderstood what the 'workaround' is supposed to accomplish. > OK, perhaps I am asking that enwiki and enwikibooks work the same, whether or not the workaround is aimed at the problem I face. I don't want to get into details, because I am sure you aren't interested. But, in summary, books generally put references at the end and books can be very long. So, assuming <references/> will be on the same page as all of the <ref> citations is a bad assumption for a book. The simple answer is to put all the <ref> markup on a separate page and transclude it (with display:none markup around it) at the beginning of each book section. Named <ref> tags can then be used to reference the appropriate citation. The page also can be transcluded in a References chapter at the end of the book and <references/> called. Yes, this is pretty inefficient, but I don't see any other way of handling book citations properly with Cite. If it would be possible to just turn off the error message by passing <ref> a parameter, there would be no problem. I understand that a new <ref> parameter is an enhancement to the cite extension, which is a "boiling the ocean" approach to the issue. However, if enwikibook worked like enwiki, there would be a workaround that worked without changing Cite. Is there a way to ask for a configuration change to enwikibook? It isn't a mediawiki software bug, but it is a enwikibooks configuration issue (if I can't call it a bug).
I see what you are attempting to accomplish; in fact it is a fairly elegant way to achieve the desired effect. You could even use the References chapter *as* the ref page, using <onlyinclude> to only transclude the actual references. This is a good solution to the problem at hand. One way or another, you just need to ensure that each book page ends with a <references/> tag, preferably hidden. You could do something like this: ================================================ Template:HideCiteErrors: ============= <div style="display:none;"><references/></div> ================================================ ================================================ SomeBook/SomeChapter ============= {{SomeBook/References}} Blah blah blah<ref name=foo/> blah blah {{HideCiteErrors}} ================================================ ================================================ SomeBook/References ============ Blah blah blah header blurb <onlyinclude><includeonly> *<ref name=foo>Ref text</ref> *<ref name=bar>More ref text</ref> </includeonly></onlyinclude> <references/> ================================================ Does that make sense? Essentially, the 'workaround' from enwiki suppresses errors from refs *above* it on the page. So to ensure that all errors are avoided, you need to put the 'workaround' code at the bottom of each page. Alternatively, enwikibooks could suppress or entirely disable the cite error message like enwiki has. You'd need to discuss that on the appropriate wikibooks forum; it can be done by editing the [[MediaWiki:Cite error]] family of messages.
(In reply to comment #7) > I see what you are attempting to accomplish; in fact it is a fairly elegant way > to achieve the desired effect. You could even use the References chapter *as* > the ref page, using <onlyinclude> to only transclude the actual references. > This is a good solution to the problem at hand. One way or another, you just > need to ensure that each book page ends with a <references/> tag, preferably > hidden. You could do something like this: > > ================================================ > Template:HideCiteErrors: > ============= > > <div style="display:none;"><references/></div> > > ================================================ > ================================================ > SomeBook/SomeChapter > ============= > > {{SomeBook/References}} > > Blah blah blah<ref name=foo/> blah blah > > {{HideCiteErrors}} > > ================================================ > ================================================ > SomeBook/References > ============ > > Blah blah blah header blurb > <onlyinclude><includeonly> > *<ref name=foo>Ref text</ref> > *<ref name=bar>More ref text</ref> > </includeonly></onlyinclude> > <references/> > > ================================================ > > Does that make sense? Essentially, the 'workaround' from enwiki suppresses > errors from refs *above* it on the page. So to ensure that all errors are > avoided, you need to put the 'workaround' code at the bottom of each page. > > Alternatively, enwikibooks could suppress or entirely disable the cite error > message like enwiki has. You'd need to discuss that on the appropriate > wikibooks forum; it can be done by editing the [[MediaWiki:Cite error]] family > of messages. > Let me try out your suggestion. If it works, you deserve an "attaboy". I'll let you know what happens. Thanks
(In reply to comment #7) > I see what you are attempting to accomplish; in fact it is a fairly elegant way > to achieve the desired effect. You could even use the References chapter *as* > the ref page, using <onlyinclude> to only transclude the actual references. > This is a good solution to the problem at hand. One way or another, you just > need to ensure that each book page ends with a <references/> tag, preferably > hidden. You could do something like this: > > ================================================ > Template:HideCiteErrors: > ============= > > <div style="display:none;"><references/></div> > > ================================================ > ================================================ > SomeBook/SomeChapter > ============= > > {{SomeBook/References}} > > Blah blah blah<ref name=foo/> blah blah > > {{HideCiteErrors}} > > ================================================ > ================================================ > SomeBook/References > ============ > > Blah blah blah header blurb > <onlyinclude><includeonly> > *<ref name=foo>Ref text</ref> > *<ref name=bar>More ref text</ref> > </includeonly></onlyinclude> > <references/> > > ================================================ > > Does that make sense? Essentially, the 'workaround' from enwiki suppresses > errors from refs *above* it on the page. So to ensure that all errors are > avoided, you need to put the 'workaround' code at the bottom of each page. > > Alternatively, enwikibooks could suppress or entirely disable the cite error > message like enwiki has. You'd need to discuss that on the appropriate > wikibooks forum; it can be done by editing the [[MediaWiki:Cite error]] family > of messages. > Your idea almost works. The one remaining problem is the call to {{SomeBook/References}} on the SomeBook/SomeChapter page leaves orphan numbers where the transcluded <ref>s reside. In other words, at the top of the SomeBook/SomeChapter page is the text "[1] [2]", etc, one number for each transcluded <ref> entry. I ran across this before and now forget how I got rid of it. However, the error message no longer is a problem. I just need to remember how I got rid of the extraneous square-bracket numbers at the top. I'll let you know if I succeed.
Just wrap it in another <div style="display:none;">...</div>
(In reply to comment #10) > Just wrap it in another <div style="display:none;">...</div> > Yep. I figured that out before coming here to leave a comment. So the SomeBook/References page looks like: SomeBook/References ============ Blah blah blah header blurb <onlyinclude><includeonly> <div style="display:none;"> <ref name=foo>Ref text</ref> <ref name=bar>More ref text</ref> </div> </includeonly></onlyinclude> <references/> ================= Now all I have to do is come up with some templates to make things look pretty. Thanks for your help. Cheers, Dan Nessett
(In reply to comment #10) > Just wrap it in another <div style="display:none;">...</div> > I just noticed: One thing that happens when you wrap the <ref>s up in <div style="display:none;">...</div> - the <references/> tag no longer produces a list (the page renders to nothing). I suspect the "display:none" hides the <ref>s from <references/>. That's OK. It just means you have to put all of the references on one page wrapped by <onlyinclude><includeonly>...</includeonly></onlyinclude> and followed by a {{HideCiteErrors}}. Then you transclude that page into the middle of the SomeBook/References page without either <div style="display:none;">...</div> or onlyinclude><includeonly>...</includeonly></onlyinclude>,and transclude it into the middle of a template (using a template parameter that specifies the name of the page with the <ref>s) wrapped for use on book pages. Its a little more fussy, but it should work. I should be able to design some templates that will hide all of the messiness from book editors.
See template {{reflist hide}} on enwiki.