Extension talk:Cite

About this board

Nomination for deletion of Template:Footnote group

2
Summary by Thiemo Kreuz (WMDE)

Misplaced on mediawiki.org.

Manabimasu (talkcontribs)
Dinoguy1000 (talkcontribs)

What is the point to reposting this notice here? These templates do not appear to exist on MediaWiki.org, and even if they did, their deletion on Wikipedia would not affect their use here.

Summary by Thiemo Kreuz (WMDE)

Duplicate question, see Topic:W636cdc70qyw5a8f.

Juandev (talkcontribs)

Does site format references regarding any standard? Is there a way to change standards of references how they display?

Dinoguy1000 (talkcontribs)

Cite doesn't format references itself, and it doesn't care about how they're formatted, so you can do whatever you like.

Juandev (talkcontribs)

Does the output follows any citation standard? Is there a possibility to switch between citation standards?

Thiemo Kreuz (WMDE) (talkcontribs)
Juandev (talkcontribs)

Well, on the side of Wikipedia you can modify how the references look in References paragraph via template. But can you modife it in the text? E.g. insted of having anchors lik [1], use somethig like (Peters, 2015)?

Thiemo Kreuz (WMDE) (talkcontribs)
Reply to "Citation standard"
Ktfeenan (talkcontribs)

I'm trying to get this extension to work but it appears there are 1000 dependencies in terms of templates that also need to be installed in order to get this to work and zero documentation on how to exactly do that.

I'm getting a pile of #invoke:citation/CS1|citation|CitationClass=web and other errors

Have been googling for a month now on how / why this is occuring with no results.

Why are all these components missing from the extension and where do I find documentation on how we can enable these things to get the extension configured correctly?

Dinoguy1000 (talkcontribs)

It sounds like you copied a citation template from Wikipedia or elsewhere. This extension only provides the <ref></ref>/<references/> functionality.

To be able to use the templates properly, you'll have to export them from the wiki you originally copied them from: go to Special:Export on that wiki, and add the name of the template(s) (including the Template: namespace) in the "Add pages manually" inputbox, one per line, then check the "Include templates" checkbox and click "Export".

This will give you an XML file that you can upload on your wiki via Special:Import (though you'll need to be an administrator to do so): click "Browse" and select the XML file you got from the export, add a short name for the source wiki in the "Interwiki prefix" textbox (e.g. "wikipedia" if you exported from Wikipedia; if you have an interwiki prefix set up for that wiki, just use it), optionally check "Assign edits to local users where the named user exists locally", add a comment, and click "Upload file". For more information on exporting and importing, see Help:Export and Help:Import .

Be aware that if you're importing Wikipedia's citation templates, you'll get a fairly large number of templates and modules, at least some of which will only be used in the citation templates' documentation. You also won't get any CSS or Javascript which might be required and which is saved on the wiki's global CSS/JS files (though at least for Wikipedia, I think all of that has been migrated to TemplateStyles for the citation templates).

Dinoguy1000 (talkcontribs)

(It is possible to copy everything manually - I've done so myself, in the days before I realized I could do it much more quickly and easily via the export/import method - but it's a royal pain and you'll have to comply with the terms of the source wiki's content license yourself.)

Ktfeenan (talkcontribs)

Which is all well and good - I've gone through all those pages already in terms of what is 'supposed' to work however the the interwiki prefix is confusing as I see in one place it says to export from Wikipedia and then use 'en' (I have no idea if I'm supposed to include the quotes or not) as the interwiki and then other places it saying to use the full uri (subing $1 for the last bit). And in the meantime regardless when I try to do the import I keep getting a gateway timeout even after I've bumped the memory and timeout limits to something well beyond what should be required for a 960Kb file.

We managed to finally get cite to work without any imports by ensuring the following were turned on in the LocalSettings.php.

wfLoadExtension( 'Cite' );

wfLoadExtension( 'ParserFunctions' );

wfLoadExtension( 'Scribunto' );

$wgScribuntoEngineConf['luastandalone']['memoryLimit'] = 209715200;

$wgMaxShellMemory = 204800;

wfLoadExtension( 'TemplateData' );

wfLoadExtension( 'TemplateStyles' );

I still need a couple of other templates but even with debuging turned on I'm getting squat in the way of information that is telling me why I'm getting the gateway timeout. I have no idea if it is a problem with the Interwiki value I'm using or if there are other extensions that need to be enabled before the import will work.

This is the essence of the problem I have with much of the documentation for mediawiki. There was nothing indicating that I needed those other 4 extensions and the scribunto configuration variables in order to get it to work short of random searching for other people running into the same problem before one of the other people working with me on this happened to come by that information as a potential solution.

So, while I've sort of solved one problem, I'm still unable to figure out why Special:Import isn't working in that I've tried all the recommendations for modifing the php timeouts and memory limits and I'm still getting a gateway timeout.

Dinoguy1000 (talkcontribs)

the interwiki prefix is confusing as I see in one place it says to export from Wikipedia and then use 'en' (I have no idea if I'm supposed to include the quotes or not) as the interwiki

The interwiki prefix is, ultimately, just a label to identify the source wiki. If you already have an actual interwiki prefix set up on your wiki for the source wiki, use that; otherwise, just pick something single-word and reasonably descriptive. If you're following guidance that has quotes around a suggested name, ignore the quotes (I don't actually know what would happen if you tried to include them, but considering that, if you're importing, there's no way to change it afterwards, I wouldn't really recommend testing on a live wiki).

other places it saying to use the full uri (subing $1 for the last bit)

This is if you're actually adding an interwiki prefix to use in links. To do this you would need Extension:Interwiki installed on your wiki, and you'd go to Special:Interwiki on your wiki to actually add/manage prefixes. But you don't actually need to add a prefix like this to use the prefix during an import: if the prefix is actually there, imported usernames will link to the source wiki; otherwise they'll just be unlinked (AFAIK that's the only difference here).

And in the meantime regardless when I try to do the import I keep getting a gateway timeout even after I've bumped the memory and timeout limits to something well beyond what should be required for a 960Kb file.

Unfortunately imports do tend to time out when you're attempting to import larger files. I've had to resort to actually opening the XML file and deleting revisions that have already been imported on my wiki to get the size small enough to not time out (though I only recommend doing this if you're comfortable editing XML in general, since XML is not fault-tolerant, and I have no idea how careful the import process is in checking for correctness before adding stuff to the database).

There was nothing indicating that I needed those other 4 extensions and the scribunto configuration variables in order to get it to work

That's because, for the Cite extension itself, you don't need any of that other stuff. Open a random page on your wiki, without any references, and type or copy-paste the following code exactly, then preview:

This is some text.<ref>This is a reference.</ref> <references />

It should work just fine. The reason you've needed to enable all the other stuff and copy so much from another wiki (I'm guessing Wikipedia, though you've never outright said which wiki) is because you originally copied one or more of Wikipedia's citation templates, which bring in a huge number of dependencies, as you've unfortunately found out first-hand. (All that being said, I will absolutely agree that the documentation here isn't as good as it could be. I've made improvements here myself, and all I can really suggest is that you also do so, if you have the time and interest.)

Ktfeenan (talkcontribs)

The system here doesn't let me put in the URLs for the two pages I'm trying to get to match otherwise this would be much easier to demonstrate what I'm trying to do. I went to do that originally but it flagged the post as spam so I had to remove all links and therefore be a bit vague.

Essentially one of our folks (vallibrarian) wrote a wikipedia article (Libraries_in_Virtual_Worlds) awhile back including reference to several sources. We are trying to set-up a new library wiki that will focus primarily on Virtual Worlds - our test system is over at (dev urockcliffe net) and we are trying to get the two pages to match including all the associated extensions we need as our test case before we start creating new articles.

I copied the page over and we've been having nothing but problems trying to get these extensions to work ever since. I had hoped all I needed to do was uncomment wfLoadExtension( 'Cite' ); and everything would just work the same way it does on Wikipedia but apparently not.

Certainly will add to the base article here if that is allowed once I have this figured out. Thank you very much for the help.

Dinoguy1000 (talkcontribs)

Aah, if you're explicitly trying to copy Wikipedia, that's a whole different beast. If you aren't already aware of it, the page to look at is w:Special:Version, which lists all extensions that are installed and enabled on Wikipedia, though you should also keep in mind that if you're only copying content, you won't need many of them. But if you copy something that doesn't work correctly, and you're sure you've got all the templates and modules it needs, that's a good starting point for figuring out what else you might need to install.

Reply to "Extremely Confused"

What is the purpose of <div class="references-small"></div>?

2
79.241.202.95 (talkcontribs)

Just out of curiosity, did <div class="references-small"></div> once have a purpose?

I could not find it documented anywhere.

Dinoguy1000 (talkcontribs)

Once upon a time it was a class used to make references smaller (as you might've guessed from the name). It was never a feature of Ext:Cite; rather, it was a site-specific class. I don't know about its history here on MediaWiki.org, but on English Wikipedia, the class was removed in 2010 (see here), and I'd imagine it hasn't worked here for a similar period of time. Basically, you can remove this class when you see it.

Reply to "What is the purpose of <div class="references-small"></div>?"

Remove numbering from id/href when reference name is defined

12
Jiou7 (talkcontribs)

I would like my references/notes to have permalinks, i.e. links which do not change when new references are added. So I was wondering whether there is a possibility to remove the number in id and href when references have name attributes.

Behavior I expect:

- <ref>...</ref> gives href="#cite-note-1" (which is the current behavior)

- <ref name="foo">...</ref> gives href="#cite-note-foo" (instead of href="#cite-note-foo-1" with the current behavior)


This numbering is hardcoded in ReferencesFormatter.php and FootnoteMarkFormatter.php using $val['key'] and $ref['key'] and I do not see any hook or system message able to change that.

Is there a clean way to do this, i.e. without changing Mediawiki core code?

Ancheta Wis (talkcontribs)

The footnote numbering is in order of appearance of the article. You can define a single reference in wikitext thus:

<ref name= foo >[https:theURLhere Your foo content here]</ref> at a single ref occurrence anywhere in the article. Your foo content obeys the rules of wikitext, such as bold, italic, indent, bullet etc. All the other occurrences of that ref content foo are of the form

<ref name= foo /> and the footnotes renumber automatically.

You can then position other copies of ref foo with the wikitext <ref name= foo /> where ever you need in the article. (I use NavPops to check the ref foo content but I have learned that the numbers themselves do not need to be maintained.) Each occurrence of that single foo is distinguished with alphabetical labels. But its footnote number is under program control. Only the name foo is under your control.

I have learned that name= foo works just as well as name="foo" and that camelCaseServesToDistinguish each ref foo namespace.

Thiemo Kreuz (WMDE) (talkcontribs)

What is the purpose of this permalink? What do you want to use it for?

One suggestion I have is to do something like this: <ref><span id="custom_anchor">…</span></ref>. The Wikipedias use templates for this, i.e. Template:Anchor.

Jiou7 (talkcontribs)

Thank you for your answers

@Ancheta Wis I want to keep the seconday numbering you mention when a reference name is used multiple times, but the first numbering seems useless as a given name cannot be used for different references but only to refer to the same reference multiple times. So to be more precise, let us imagine we have the successive ref tags:

- First <ref>...</ref> => gives id ="cite-ref-1"; href="#cite-note-1" . Ok for me

- Then <ref name="foo">...</ref> => gives id="cite-ref-foo_2-0"; href="#cite-note-foo-2" (I would like to have id="cite-ref-foo-0"; href="#cite-note-foo" instead)

- Then <ref name="foo" /> => gives id="cite-ref-foo_2-1"; href="#cite-note-foo-2" (I would like to have id="cite-ref-foo-1"; href="#cite-note-foo" instead)


@Thiemo Kreuz (WMDE) My notes will be used to store additional information which are not just references so I want readers and contributors to be able to share a link to a specific note to share its valuable content.

I want this "permalink" to be created automatically for each named reference. I also want an anchor in the text (where the reference/note will be cited) so I need the second numberig mentionned above. (which is not so doable with templates) The Cite extension already does a lot of the work, so the solution consisting in creating an anchor is not ideal for me.

In fact, I do not understand why the numbering is kept in named references as you cannot use the same name for a different reference so it will necessary be uniue. A secondary numbering is used in the case of multiplle uses of a given reference as mentioned above and it seems sufficient.

Thiemo Kreuz (WMDE) (talkcontribs)

The way the Cite extension works (most notably: the behavior of each element heavily depends on it's position on the page) is quite a beast that's hard to tame. These additional sequence numbers help. I don't know if they are strictly necessary in all situations. Maybe they aren't. But even if, this is impossible to change 15 years and millions of pages later. Sorry. My suggestion is to use a template, e.g. <ref>{{refid|foo|Content of the reference here…}}</ref>.

Jiou7 (talkcontribs)

Thank you for your suggestion. I understand it is impossible to change the default behavior of the Cite extension. But wouldn't it be possible to create hooks or system message to make it parameterizable? For instance, you can alter a reference link with cite_reference_link_key_with_num but unfortunately not enough for my case.

Thiemo Kreuz (WMDE) (talkcontribs)

I had a closer look. Unfortunately, what you want to achieve is currently only possibly by patching the code:

  • In FootnoteMarkFormatter.php change the line with the code snippet $subkey = to $subkey = '';
  • In ReferencesFormatter.php change the line with the code snippet $key . '-' . ( $val['key'] ?? '' ) to $this->anchorFormatter->getReferencesKey( $key ),
Jiou7 (talkcontribs)

Indeed, I modified the core code of Mediawiki but I was looking for a solution which would not imply I have to redo the same modification at each upgrade.

Thank you for your time!

Ancheta Wis (talkcontribs)

My experience is with Wikipedia.en; in this wikipedia, I can define a more slowly varying ref with

<ref name= foo25 group= Bah >The noted [https: Your fooBahContent] </ref>

where each note has a distinguishing name foo1, foo2, .. foo25 etc.

which renders these slowly varying ref foo as [Bah 1], [Bah 2], etc in the body of the article in their own ref list.

Copies of the annotation get referenced as before: <ref name= foo25 group= Bah /> etc. You can intermix [Bah 1] and other refs [1]

But I also have to define a destination at the bottom

{{reflist| name = "Bah"}}

to display the notes at the bottom



Bahs

  1. The noted Your fooBahContent
  2. More note Their fooBahContent

References

1.

2.



I don't use visual editor, but I guess I'm learning a little usage here on this mediaWiki talk page.

  1. Your fooBah here

For example, it was not obvious to me that I did not need a reflist template location here. On Wikipedia you have to explicitly position the Bahs to see them.

  1. Ordinary foo
Jiou7 (talkcontribs)

I am not sure I understand how it can solve my problem of primary numbering that I want get rid of. Indeed, the primary numbering is still present in the href and id of notes in your example. Am I missing something?

This post was hidden by Ancheta Wis (history)
Ancheta Wis (talkcontribs)

The visual editor is getting in the way, so I deleted my reply, which had an example. Sorry

Reply to "Remove numbering from id/href when reference name is defined"

Include reference text as text

2
C holtermann (talkcontribs)

I'm looking for a way to include the text of a reference in the text of the page. I'd like to have something like:


This is a text from [1].


These are some of the books referenced on this page:

  • Some author, Some book [<- This is what I'd like to achieve, identical to what is shown in References]


References

[1] Some author, Some book


Is there a possibility to achieve that?

Thiemo Kreuz (WMDE) (talkcontribs)

Not with this extension, sorry. You can link to the same reference twice, but it can't be displayed in two different places.

Reply to "Include reference text as text"

referencing footnote at main page in subpage

2
Gfsamo (talkcontribs)

Hi,


I have a wiki with several sub-pages. In all sub-pages I need to cite via <ref name="bla" />. I would like to have all cited references (footnotes) only at the main page. Is there any possibility to achieve this.

Thanks

Adamw (talkcontribs)

Interesting challenge! Perhaps you could put the <references> block in its own subpage, and transclude that into each of the other pages?

Reply to "referencing footnote at main page in subpage"

Why can ref names not be purely numerical?

2
79.249.149.73 (talkcontribs)

Not that it bothers me, but is there any technical reason for said restriction?

Thiemo Kreuz (WMDE) (talkcontribs)

As far as I can tell from the code, the reason is that refs without a name are automatically numbered, starting from 1. We want to avoid confusion between such automatically numbered and manually named refs.

An additional argument might have been that the (classic) HTML and CSS standards don't allow names, ids and such to start with a number either. It's typically a good idea to follow well-established standards.

Reply to "Why can ref names not be purely numerical?"

count / parse is possible?

6
Gunnar.offel (talkcontribs)

76/5000 I'm looking for a way to use <references> in the parser like

{{#if:<references />| exist | empty }}

i also tried {{#tag:references|}} but it didn't work (i seen working templates here:Editing Template:Reflist ). i tested also to fill in a var and check these, sadly also with no success.

Maybe theres a option to solve this?

Thiemo Kreuz (WMDE) (talkcontribs)

I'm afraid this isn't possible. I can identify 2 problems, and there are probably more:

  1. It's not possible to use the same <references /> tag twice. All later ones will be empty.
  2. The moment the #if is executed, the references block is not filled in yet. There is just a placeholder (called a "marker" in the parser) to be replaced later. This is the same for both {{#if:<references />|… as well as {{#if:{{#tag:references}}|….

I'm not sure what you are referring to in template:reflist. There is, as far as I can tell, no conditional that uses the references tag as a condition.

Gunnar.offel (talkcontribs)

As i said, i tried to use {{#tag:references... like in the linked template for this topic, without success, as you described as point 2.

Then i have to find another solution to hide the Box (a div/table with styles) for the references if it is empty, but with no conditions that sadly wouldn't be that simple.

Thiemo Kreuz (WMDE) (talkcontribs)

What "box"? I think it's better to use CSS for this. You can use <references responsive />, which will give you an extra <div class="mw-references-wrap"> wrapper, which you can style.

Gunnar.offel (talkcontribs)

I know, maybe i can use this to replicate the style. i use <references responsive /> already since it also creates multiple colomns. :)

Since ::before ::after can't inject HTML-elements over CSS it needs a way with js or another idea too, and it isn't useable for templates. For example a unready page in an none-closed project it groups the references in the same boxes like the other infoboxes, that template is used, maybe i can find a way to check the length of the content in these box, to hide the whole if it's empty.

Thiemo Kreuz (WMDE) (talkcontribs)

Ah, what a nice design. Love it!

I found one CSS hack that works. Let's say your wikitext looks like this:

<div class="box">
==Sources==
<references />
</div>

In case there are no references, the references tag will not render anything, which means the headline will be the last element in the box. We can use this knowledge:

.box h2:last-child {
	opacity: 0.3;
}

You could as well use the empty box to mark pages that need sources. ;-)

Reply to "count / parse is possible?"
Return to "Cite" page.