Extension talk:Cite

From MediaWiki.org
Jump to: navigation, search
Start a new discussion


Thread titleRepliesLast modified
Recent change broke enwp nested ref {{refn}} template123:58, 26 May 2015
use $wgCiteEnablePopups option215:37, 25 April 2015
Extension requires Modules, which Installation instructions say nothing about!109:49, 25 April 2015
Hover-over text003:53, 16 April 2015
How to replace 1.1 1.2 with a b c in reference footnotes010:01, 17 February 2015
Reading variables from the page in Extension:CiteThisPage002:21, 17 February 2015
cite error014:30, 15 January 2015
Popups with references123:02, 29 December 2014
reflist114:47, 29 December 2014
LUA Error With Cite816:00, 24 November 2014
filling references with a template219:25, 20 October 2014
Update extension:cite111:37, 7 July 2014
move page 215:11, 31 March 2014
"Fatal error: Call to undefined function wfmessage()"619:06, 10 February 2014
Solution: Template in refs and refs in templates201:20, 20 November 2013
Customizing009:05, 7 November 2013
the extension cannot run004:46, 12 October 2013
line height322:18, 28 July 2013
Allow defining references not used in page text?323:01, 27 June 2013
HTML5-style syntax?102:04, 10 May 2013
First page
First page
Previous page
Previous page
Last page
Last page

Recent change broke enwp nested ref {{refn}} template

enwp's nested template ({{:en:refn}}) broke with a recent change that we've traced back to "#tag:ref". Could someone help us figure out whether a recent Mediawiki change caused this or what our next steps should be? More information available at en:Template talk:Refn#Refn references getting sent to the bottom of the page? Thanks

– czar19:30, 24 May 2015

Reported bug at phabricator:T100477

– czar23:58, 26 May 2015

use $wgCiteEnablePopups option

I updated to the media wiki 1.24.1 version, pop-up function after the update does not work.

I hope that this function is activated again. How do I?, 19 April 2015

This fetaure was removed in Gerrit change 145023.

Florianschmidtwelzow (talk)13:39, 22 April 2015

How do I use this feature back?

popus using gadgets do not like it., 25 April 2015

Extension requires Modules, which Installation instructions say nothing about!

OK, so I installed this extension and followed the manual install instructions exactly as this page discusses.

However, all the ref citations attempted resulted in script failures.

It looks to me like there was a complete failure to load in or add the Module:Citation/CS1, Date_validator, Whitelist (and maybe one more, I forget).

I wound up adding those by hand by copying code from https://en.wikipedia.org/wiki/Module:Citation/CS1 (etc) which seems just... nasty.

Did I miss something? Did I install the extension incorrectly? Or am I actually supposed to go through and create those Module: files in my wiki? If the latter, it seems to me that the instructions for installing this extension should mention the need to add in the modules, plus pointers so that other folks don't wind up googling their day away to figure this out.


This extension works out of the box as described. There are however wikis like e.g. English Wikipedia that add additional dependencies via custom templates crated on wiki. In your case it requires the Scribunto to be installed as well as adding not just templates but also modules.

[[kgh]] (talk)09:49, 25 April 2015

Hover-over text

Since I upgraded my wiki to 1.24.2, I not longer get a popup when I hover over a citation number. Is there a way to bring this back up?

Varkman (talk)03:53, 16 April 2015

How to replace 1.1 1.2 with a b c in reference footnotes


Can anywody please help to update 1.1, 1.2 number to a b c and ↑ to ^ in reference footnotes I tried this http://www.mediawiki.org/wiki/Extension:Cite#Set_references_to_use_.5E_and_letters_like_Wikipedia but still not working

Thanks, 17 February 2015

Reading variables from the page in Extension:CiteThisPage

A thread, Thread:Extension talk:Cite/Reading variables from the page in Extension:CiteThisPage, was moved from here to Extension talk:CiteThisPage. This move was made by Jdforrester (WMF) (talk | contribs) on 17 February 2015 at 02:21.

cite error

sometimes, a ref generates "cite error", e.g., when you use "name="xxx" with an empty ref, but there is no "real" ref with this name.

it would be useful to be able to find all pages with such errors.

mw contains a mechanism to track such things, called Special:TrackingCategories. there may be a better way to find all pages with cite errors - i'll be happy to learn.

if no such way exists, i suggest to track those through the special page meant for it.


קיפודנחש (talk)14:30, 15 January 2015

Popups with references

How do you make it so that references function as popups like on Wikipedia? You used to be able to do that with just the cite extension, but they took it away.

Xina78 (talk)16:16, 17 December 2014

if you mean enwiki when you say "like on wikipedia", it's done via gadget, namely en:MediaWiki:Gadget-ReferenceTooltips.js, which is explained in Reference Tooltips. there are some other options, specifically one lighter with less features: he:Mediawikiי:Gadget-CiteTooltip.


קיפודנחש (talk)23:00, 29 December 2014

I assume that the existing reflist has a <references /> baked into it. Otherwise, this update is going to break a lot of articles. I like <references /> and use it all the time when checking out a citation, but others simply use reflist.

Ancheta Wis (talk)14:52, 23 December 2014

What update?

Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7)14:47, 29 December 2014

LUA Error With Cite

I have copied the templates and the error occurs in the references section Lua error in Module:Citation/CS1 at line 2058: attempt to call method 'getTitle' (a nil value).

Backtrace: (tail call): ? Module:Citation/CS1:2058: in function "chunk" mw.lua:553: ? (tail call): ? [C]: in function "xpcall" MWServer.lua:73: in function "handleCall" MWServer.lua:266: in function "dispatch" MWServer.lua:33: in function "execute" mw_main.lua:7: in main chunk [C]: ?

not sure how to fix this would be appreciate it, if someone could help

RaneMstSage (talk)19:08, 11 April 2014

I have this problem too.

Billreid (talk)09:31, 2 May 2014

BTW, the script error Module:Authority_control:358: in function "chunk" also displays with identical discription of the full error in first post above.

Billreid (talk)11:43, 2 May 2014

I'm getting this problem too when using the Citation Template. Any potential fixes?, 14 May 2014

Me too. Any fixes?

Dnaslave (talk)18:06, 28 May 2014

I'm getting this error as well. See no help on google.

Vapblack (talk)15:13, 28 June 2014

Anyone found a solution to this?

A3vdMerwe (talk)08:56, 24 October 2014

Hi I had this problem. I 'solved' it by commenting out the section of code.

I edited the wiki page module:Authority_control.

I commented out the section called --Wikidata fallback if requested

   --Wikidata fallback if requested
   --[[    local item = mw.wikibase.getEntity()
    if item ~= nil and item.claims ~= nil then
      for _, params in pairs( conf ) do
          if params[3] ~= 0 then
              local val = parentArgs[params[1]]
              if not val or val ==  then
                       local canUseWikidata = nil
                   if reqs[params[1]] ~= nil then
                       canUseWikidata = matchesWikidataRequirements( item, reqs[params[1]] )
                       canUseWikidata = true
                   if canUseWikidata then
                       local wikidataIds = getIdsFromWikidata( item, 'p' .. params[3] )
                       if wikidataIds[1] then
                           parentArgs[params[1]] = wikidataIds[1]

Which basically just comments it out. It took a few minutes to work (caching?) but eventually got there. I'm not sure what other effects this will have.

2A00:1068:0:205:1137:E3A1:E067:393D17:18, 20 November 2014

That didn't come out correctly. Here is the correct version.

  --Wikidata fallback if requested
 --    local item = mw.wikibase.getEntity()
 --    if item ~= nil and item.claims ~= nil then
 --       for _, params in pairs( conf ) do
 --           if params[3] ~= 0 then
 --               local val = parentArgs[params[1]]
 --                      local canUseWikidata = nil
 --               if not val or val ==  then
 --                    if reqs[params[1]] ~= nil then
 --                        canUseWikidata = matchesWikidataRequirements( item, reqs[params[1]] )
 --                    else
 --                        canUseWikidata = true
 --                    end
 --                    if canUseWikidata then
 --                        local wikidataIds = getIdsFromWikidata( item, 'p' .. params[3] )
 --                        if wikidataIds[1] then
 --                           parentArgs[params[1]] = wikidataIds[1]
 --                       end
 --                    end
 --                end
 --            end
 --        end
 --    end
2A00:1068:0:205:9017:BBEB:3CDB:355A16:00, 24 November 2014

filling references with a template

Hello, within a template I have fields for filling the references, which look like this: <ref>Source: {{{Source Spanish|}}}</ref>. In the same template there is also the <references /> tag. Now, when using the template, I simply fill |Source Spanish=http://www.example.com. But under references, the URL won't show, it's only 1. ↑ Source: , without the template field value.

  • It's not related to the URL, any other text won't show either.
  • The position of <references /> is irrelevant, same outcome everywhere.

What am I missing?

Zabien (talk)18:55, 14 October 2014

i believe you should use the #tag: magic word if you want to use "ref" tag from inside a template.

see Help:Magic_words#Miscellaneous.

as to the "references" tag: it does not sound right to have this tag in the same template - this will place "references" once per each reference, instead of once for the whole page.

also, afair, if you use modern-enough version of the code, you can completely omit the "references" tag, to display the references at the end of the page. don't remember when was this introduced, and TBH, i am not 100% sure this is correct...


קיפודנחש (talk)21:50, 16 October 2014

Thank you very much! That hint did it! Works brilliantly with the #tag magic word and "ref". I do not yet see a problem with the <references /> tag, though. At the moment, the references passed via the form as well as manually added <ref>…</ref>s all neatly show up under references. I still need the tag to show them, I tried on 1.21.2 and 1.23.1 and it's demanded there. Not tried on 1.24 though.

Zabien (talk)19:25, 20 October 2014

Update extension:cite

Hi could we update Extension:cite please and move away from jquery.tooltip.js to jquery.ui.tooltip.js please because the author of jquery.tooltip recommends moving away from it because has not been updated since 2008 and he was the author of jquery.ui.tooltip.js., 5 July 2014

bug 67282 was created to address this issue.

[[kgh]] (talk)11:37, 7 July 2014

move page

hi I propose we move this page to extension:cite please. reson because extension cite page is the extension and we doint need to have cite.php extension page., 30 March 2014

Just because Cite.php is on a separate page does not mean that Extension:Cite needs to be expanded. What about Special:Cite.php?

[[kgh]] (talk)08:00, 31 March 2014

Oh ok but I thought that is included in extension:cite and is not a seperate extension., 31 March 2014

"Fatal error: Call to undefined function wfmessage()"

Fatal error: Call to undefined function wfmessage() in /home/wikimultiple/wikimultiple/extensions/Cite/Cite_body.php on line 1007

This happens on any page with citations. I am a rank beginner at these things. Could someone explain?

Astraea (talk)20:37, 2 September 2012

What version of MediaWiki do you use (check Special:Version), and where did you download the Cite extension exactly (what version).

Krinkle (talk)04:14, 3 September 2012

I got the same error. I'm using MW 1.16.2 and tried several snapshots of this extension, always the same error. This error can be fixed by replacing wfmessage() by wfMsg() but other errors appears after that.

Plalemand (talk)19:54, 17 January 2013

wfMessage() cannot be replaced by wfMsg(). wfMessage(), a global function referencing the Message class was introduced in MediaWiki 1.17. We strongly suggest you update to a supported version of MediaWiki or use an older version of Cite.

siebrand (talk)13:40, 18 January 2013

it would be nice to have somewhere a list of links to "sanctioned" versions of the extension per mediawiki version.

i guess it's enough to have links to specific git commits (just to demonstrate what i mean - something like this), because the gitweb/gerrit thingy already has a "snapshot" link that gets you the tarball ready to eat.


קיפודנחש (talk)21:45, 18 January 2013

How does one get an "older" version of cite? I want pre-Rel 19., 10 February 2014

don't know about "pre rel". here is a link to the rel-19 sources in source control. at the top of the page there are buttons for tarballs in various compression formats.



קיפודנחש (talk)19:06, 10 February 2014

Solution: Template in refs and refs in templates

This may be handy for others. I wanted to create a ref template to add a reference and a refs template to create the footer automatically unless there were no refs. Usage:

 per ref: {{ref|http://...|linktext}}
 footer: {{refs}}

The idea was to collect the references and set a variable refs which enables the footer. This requires Extension:ParserFunctions and Extension:Variables.

The following 2 templates - first attempt - did not work:

ref template:

<includeonly><ref>[{{{1}}} {{{2}}}]</ref>{{#vardefine:refs|1}}</includeonly>

refs template:

{{#if: {{#var:refs|}} | <span class="mw-headline"> <h2>References</h2> </span> <references /> }}

This fails because everything between the ref tags is collected until the references tag is called, and at this moment there are no more template arguments.

The following solution works - unfolded for better readability:

ref template:

[{{#var:link{{#var:i|0}}}} {{#var:text{{#var:i|0}}}}]

refs template:

{{#if:{{#var:refs|}} |  
<span class="mw-headline"> 
<references /> 

The ref template increments a variable i to define variables link0, text0, and on next call link1, text1, and sets the refs variable.
The part within the ref tags contains a second loop counter for i for the references invocation and expands the variables correctly.
The refs template just needs to reset the loop counter before the references tag is called.

This solution is template proof etc since the variables are defined at ref tag time.

Hope this is helpful for someone.

Hippie2000 (talk)02:28, 16 November 2013

Thanks, that sounds useful. I will give it a whirl.

Cavila (MW 1.19.7, MySQL 5.1.72-2, Php 5.3.3-7, SMW, SF 2.5.2)21:01, 18 November 2013

I noticed one side effect of this solution. URLs containing ?name=value don't pass as anonymous args. This is not specific to my solution but a side effect of passing anonymous template args.

In this case the reference is printed non clickable. What helps is numbering the arguments then:

Hippie2000 (talk)01:20, 20 November 2013


This is a very useful extension. But… I am not able to get the customization suggest on the main page (Set reference and reference number highlighting like Wikipedia). I followed the instructions (added the code to Common.css) but it is not working. The same with the suggestion here with line height code.

Emilio Speciale (talk)09:05, 7 November 2013

the extension cannot run

I already have the "extensions/Cite" directory, and the files are all no problem in the directory. But when I opened the "Special:Version" of my wiki, I found nothing listed in "Installed extensions".

I was also trying to add "require_once("$IP/extensions/Cite/Cite.php");" to the LocalSettings.php, but a 500 Internal Error happened.

My site's URL is


And my server provider is iPage.

Anyone could solve this problem? Thanks in advance!

Betoseha (talk)04:45, 12 October 2013

line height

I'm having a cosmetic / style problem with this application on my own wiki. I've noticed that the reference markers tend to mess with line height of the text. it's particularly a problem if the reference marker comes in the middle of a paragraph - the gap that the ref marker causes between that line of text and the line of text above it is comparable to the gap between normal paragraphs. This makes the text difficult to read, since it's hard discern where actual paragraph breaks are.

there has to be some kind of solution for this - I've noticed that reference markers don't alter the line height of the text at all in wikipedia, for example. any advice? I'm new to wiki platforms.

(if this needs to be somewhere else, please let me know - I just couldn't figure out where to go to ask for help), 28 July 2013

The usual trick is to use CSS to lower everything in superscript position (and/or possibly, to increase line spacing?). You could add something like the following to your CSS page (MediaWiki:Common.css or the css page of your user skin).

/* keep superscript and subscript text from breaking the line-spacing */
#bodyContent sup {
    font-size: smaller;
    vertical-align: baseline;
    position: relative;
    bottom: 0.33em;
#bodyContent sub {
    font-size: smaller;
    vertical-align: baseline;
    position: relative;
    bottom: -0.25em;;

See also [1]

Cavila (MW 1.19.7, MySQL 5.1.66, Php 5.3.3-7, SMW 1.8, SF 1.5.2}19:40, 28 July 2013

I'll try this out - thank you!, 28 July 2013
  • perfect* - this was driving me nuts, thanks so much!, 28 July 2013

Allow defining references not used in page text?

Edited by author.
Last edit: 04:48, 24 June 2013


Noone has responded to this question for months, so let me try rephrasing it without superfluous information:

Question: Is there a need in Ext:Cite to allow for adding references that would appear in the references list using <refereces/> or {{reflist}}, but without corresponding footnote marks inside the text?

I need this functionality in an extension I'm writing, and as I'm thinking of hacking my own local version of Cite to allow for it, I'm wondering if this can be of wider use. Original message below.

Thank you!

I have recently upgraded to MediaWiki 1.20 and noticed that an extension I wrote to keep track of bibliographies (Miranche/BiblioTex) was partly broken. The extension adds functionality to Extension:Cite to use BibTex bibliographic information, both provided in wiki text or stored on the local file system. The references are included in wiki text via <cite>...</cite> tags, which basically just unwrap into corresponding <ref>...</ref> tags. These parallel LaTeX usage, and accordingly I have also added <nocite>...</nocite> tags for references that I want to appear in the reference list but not in the text. Using a previous version of Ext:Cite, probably over 2 years old now, this worked no problem. Now, I get cite_error_references_missing_key.

The way I would deal with this locally would be to hack Ext:Cite to add an option, say $wgCiteAllowMissingKey, to allow for such references. I wanted to check, though,

  • Is there a relevant past discussion on why references in the text are now required?
  • Would an option to relax this requirement be useful in the public version of the Cite extension?

Thank you!

Miranche T C06:48, 26 February 2013

No replies for 4 months, replying to myself to bump the thread up.

Miranche T C04:46, 24 June 2013

it seems that your actual question is not really what you mean.

you asked "Is there a need in Ext:Cite to allow for adding references that would appear in the references list using <refereces/> or {{reflist}}, but without corresponding footnote marks inside the text?"

but it seems that what you really mean is not "is there a need" but rather "is it possible".

if the question is indeed "is there a need", then the answer (at least my answer) is "probably not".

if you ask "is it possible", i think the answer is still "probably not", but it should not be all that difficult to hack the extension to add "no cite mark" option, e.g. by adding a new attribute to the "ref" tag which will cause it to not display the link inside the text. (so some of the references will look like so: <ref nomark="true"> or somesuch) however, this requirement seems somewhat redundant: if you want to maintain a bibliographic list at the bottom of the page, why even use the "Cite" extension? you can just add such a list using standard wiki code, no?


קיפודנחש (talk)16:06, 24 June 2013

קיפודנחש, thanks for the reply.

Clarification: "if you want to maintain a bibliographic list at the bottom of the page, why even use the "Cite" extension?" Good question. Most of the refs in bibliographies I'm using are linked in the text, but not all. In other words, I want to be able to intersperse entries with refs in text and those without.

I know that this is possible in principle because it used to work a couple of years ago. The extension I wrote piggybacks on Cite -- it unwraps a <cite> tag into a <ref> tag in the text, and adds the ref given in <nocite> into Cite's internal list of refs without affecting the wiki text. All citations then used to show up in {{reflist}} in the order they were specified in original wiki text, with those supplied via <nocite> without back links. This worked fine with Cite as it was in late 2010/ early 2011, but is now impossible due to stricter error testing.

I'll go ahead & modify my copy of the extension so the syntax will work, and I'll try to do so via method overloading in derived classes so there's no intervention in Cite itself. On first inspection, though, this doesn't seem to be straightforward. My question is, then, if I end up changing Cite itself, would this functionality be useful in the larger world, whether through <ref nomark="true"> or similar syntax as you suggested, or through an API function that can be used in extensions, such as mine, that build upon Cite? I gather the answer to this is, probably not.

Peace, indeed.

Miranche T C20:16, 27 June 2013

HTML5-style syntax?

Cite.php syntax is not compatible with HTML5; this is an issue for consistently using HTML5 in MediaWiki – see mw:HTML5.

Cite.php uses XML-style syntax for “empty/void elements” – <ref name="foo" /> and <references /> – in a way that is not compatible with HTML5; the XML-style is from XHTML 1.0. This is not necessarily a problem per se, as these are Tag extensions, not actual HTML/XML tags, but as the web moves to HTML5, this will be a cause of inconsistency and confusion to users unless corrected. Further, it requires the MediaWiki software to support inconsistent syntax.

The easiest solution is probably to use templates to insulate users from the details of the tag syntax; this is detailed below.

Issue[edit | edit source]

The issue is that in HTML5, the minimized tag sytax <foo/> is invalid for non-void elements, and is generally interpreted simply as a tag – <foo> – the trailing slash (/) is stripped, rather than interpreted as a terminator. As the Cite.php tags are non-void (they can have content), this is interpreted as a bare opening tag, without a closing tag.

Thus instead of XHTML <ref name="foo" /> and

<references />

in HTML5 one would need <ref name=foo></ref name=foo> and


(note that HTML5 allows unquoted attribute values).

Because the ref and references tags are very widely used (notably on English Wikipedia), this issue has very broad scope, even if the impact is minor.

Background[edit | edit source]

The details are confusing; here is some background.

XML allows minimized tag syntax <foo/> for empty elements (see XML: Tags for Empty Elements and XHTML1: Empty elements). In XML, “empty element” means “has no content, whether or not element type declared with keyword EMPTY (meaning ‘cannot have content’)”, so it refers both to elements that cannot have content, such as <br> (usually serialized as <br/> where the slash is a terminator, but can be serialized as <br></br>) and elements that can have content, but do not, like an empty paragraph: <p></p>.

Per HTML5 “Elements” documentation: HTML5 “void element“ means “cannot have content”; it corresponds to XML’s EMPTY keyword. Further, trailing / are dropped (formally the slash is actually forbidden for non-void elements). This changes behavior for empty non-void elements. Void elements only have a single tag, where the / is optional, as in <br> though <br/> is also valid. Empty non-void elements, like empty paragraphs, need a closing tag (though this may be implied in some cases). For example, <p/> in HTML5 does not behave like <p></p> (an empty paragraph) as in XHTML, but it’s invalid syntax, and generally instead acts as bare opening tag: <p>.

Proposal[edit | edit source]

The <ref name="foo" /> syntax is tricky, but the <references /> should be easy to handle. The use of the {{reflist}} template – which always (can?) output <references>...</references> – means that users are insulated from this. Further, <references></references> has the same behavior whether it has content or not: it includes any references in its content and lists pending inline refs.

The <ref name="foo" /> syntax is trickier because there are two behaviors for the <ref name="foo"> tag: create a new named ref (which is non-void), or refer to an existing ref (which is void, or handled by “if empty, then…”). At the tag level, clearer is to separate these, say by <ref name="foo">...</ref> followed by <ref2 name="foo"> to create and then refer to a named reference.

This would be easier if this issue were isolated from users via a template. At English Wikipedia {{ref}} is already used for a separate type of referencing, but {{fn}} (for “footnote”) is an almost unused template, so it could be used, and would be consistent with the {{sfn}} and {{efn}} template names. Using this, users could write {{fn|name=foo|...}} and then {{fn|name=foo}} later.

In more technical detail, the existing XML-style tags could be supported indefinitely, or deprecated then removed, with an automated migration tool. The tool would:

  • Replace <ref name="foo" /> by <ref2 name="foo"> (leave quotes as they are allowed) – or even by {{fn|name=foo}} and
  • Replace <references /> by <refererences></refererences> – or even by {{reflist}}

Summary[edit | edit source]

In summary:

  • Authors should use templates: {{fn}} and {{reflist}}
  • Behind the scenes, add <ref2> tag and migrate existing usage.

How does this overall approach sound?

Nils von Barth (talk)10:30, 23 February 2013

I've already elaborated on HTML5#HTML in wikitext why HTML5 is irrelevant to stuff inside the Parser.

Daniel Friesen (Dantman) (talk)02:04, 10 May 2013
First page
First page
Previous page
Previous page
Last page
Last page