Help:Contributing/citations: Difference between revisions

From Wikibase
Jump to navigation Jump to search
Cite-by-QID help page (issues #24/#25): {{#cite}} / {{#citations:}} parser functions (via create-page on MediaWiki MCP Server)
 
Remove duplicated Copy-internal-citation and See-also sections (botched earlier edit) (via update-page on MediaWiki MCP Server)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Cite a Wikibase item by its QID and the citation renders from the item graph — you never type the bibliographic metadata. Edit the source item once; every page that cites it updates. Every example below is live against real items.


== The two parser functions ==
'''RonzzWikiBase has a custom citation mechanism.''' It is different from those on vanilla wikibase instances, such as Wikipedia.


{| class="wikitable" style="width:100%"
== Why a custom citation mechanism? ==
! Function
 
! What it does
On a vanilla wikibase, citation is cubersome: You need to write citation text manually or generate it via a 3rd-party app, then paste it between <syntaxhighlight lang="html" inline><ref></ref></syntaxhighlight> tags to create a citation item. Therefore, if you cite the same source on multiple pages, the way to go is to copy and paste the citation text multiple times.
! Use it when
|-
| <code>#cite</code>
| Renders one citation for one or more items — inline, or inside a <syntaxhighlight lang="wikitext" inline><ref></syntaxhighlight> footnote.
| Quoting, footnoting.
|-
| <code>#citations:</code>
| Renders the page's bibliography: one entry per distinct source item.
| A "Sources" section.
|}


== Citing with #cite ==
The most scary part comes when you later updates the citation (e.g., because you made a typo). You will need to manually update each one, unless you have a bot account setup and know MediaWiki APIs well enough to do some batch text-op scripting.


Running example: Q95 (a book) and Q96 (a quotation that cites the book). The citation follows the item's class: a content item cites through its <code>source</code> statement, a source item cites itself.
To eliminate all the complexity, we purpose-built our custom entity-based citation mechanism.


{| class="wikitable" style="width:100%"
== A citation starts with a citable entity ==
! You type !! You get
|-
| <syntaxhighlight lang="wikitext">{{#cite:Q95}}</syntaxhighlight>
| {{#cite:Q95}}
|-
| <syntaxhighlight lang="wikitext">{{#cite:Q95|style=vancouver}}</syntaxhighlight>
| {{#cite:Q95|style=vancouver}}
|-
| <syntaxhighlight lang="wikitext">{{#cite:Q96}}</syntaxhighlight>
| {{#cite:Q96}}
|-
| <syntaxhighlight lang="wikitext">{{#cite:Q95|Q96}}</syntaxhighlight>
| {{#cite:Q95|Q96}}
|}


<blockquote>
To create a citation on ronzz-wikibase, you first need a citable entity, which can be a book, a newspaper article, or whatever source you would like to cite.
'''A citation follows the source, not the page.''' Q96's citation is the quotation itself (author, date, text) — its source book shows as the container. Multi-entity <syntaxhighlight lang="wikitext" inline>{{#cite:Q95|Q96}}</syntaxhighlight> puts both citations in one output — one footnote with several sources.
</blockquote>


== Footnotes ==
First search via [[Special:ItemDisambiguation]] page by title if the source you would like to cite exists already as an entity on ronzz-wikibase. If so, note its entity number (the number starting with "Q"). If it does not yet exist, you can [[Special:AddSource|create it]]. The entity number will be shown at the end of the guided creation process. Note it. This magic number represents the citable entity across ronzz-wikibase


Wrap <syntaxhighlight lang="wikitext" inline>{{#cite}}</syntaxhighlight> in the stock Cite extension's <syntaxhighlight lang="wikitext" inline><ref></syntaxhighlight> and list the footnotes with <syntaxhighlight lang="wikitext" inline><references/></syntaxhighlight>:
== A citation is declared with <syntaxhighlight lang="wikitext" inline><ref>{{#cite:Qxx}}</ref></syntaxhighlight> ==


{| class="wikitable" style="width:100%"
{| class="wikitable" style="width:100%"
! You type !! You get
! You type !! You get
|-
|-
| <syntaxhighlight lang="wikitext">Ada was first.<ref>{{#cite:Q96}}</ref></syntaxhighlight>
| <syntaxhighlight lang="wikitext" copy>Ada was first.<ref>{{#cite:Q96}}</ref></syntaxhighlight>
| Ada was first.<ref>{{#cite:Q96}}</ref>
| Ada was first.<ref>{{#cite:Q96}}</ref>
|}
|}


<references/>
That's it. The ronzz-wikibase render engine takes care of everything.
 
<blockquote>
If you ever need to cite multiple sources in one place, simply repeat the entire syntax multiple times. Each source needs its own <syntaxhighlight lang="wikitext" inline><ref></ref></syntaxhighlight> wrapping.
</blockquote>


<blockquote>
<blockquote>
'''Use <syntaxhighlight lang="wikitext" inline><references/></syntaxhighlight>, not <syntaxhighlight lang="wikitext" inline>{{reflist}}</syntaxhighlight>.''' The stock Cite extension on this wiki registers the <syntaxhighlight lang="wikitext" inline><references/></syntaxhighlight> tag; <syntaxhighlight lang="wikitext" inline>{{reflist}}</syntaxhighlight> only works if a <syntaxhighlight lang="wikitext" inline>Template:Reflist</syntaxhighlight> exists.
'''The same source cited several times renders ONE footnote.''' Repeat <syntaxhighlight lang="wikitext" inline><ref>{{#cite:Qxx}}</ref></syntaxhighlight> as often as you need — the render engine recognises duplicate sources and merges the footnotes into a single entry with one ↑ backlink per usage (identical to what a named <syntaxhighlight lang="wikitext" inline><ref name="..."></syntaxhighlight> would give you). No manual de-duplication needed.
</blockquote>
</blockquote>


== The Sources section: #citations: ==
== Create bibliography with <syntaxhighlight lang="wikitext" inline><references/></syntaxhighlight> ==


Collects the distinct source items cited on the page — multiple quotes from one book collapse to one entry:
This part is exactly the same as on vanilla wikibase instances such as wikipedia. You simply type at the end of your article:


{| class="wikitable" style="width:100%"
<syntaxhighlight lang="wikitext" copy>
! You type !! You get
<references/>
|-
</syntaxhighlight>
| <syntaxhighlight lang="wikitext">{{#citations:}}</syntaxhighlight>
 
| {{#citations:}}
and everything you have cited in the article will be automatically included:
|-
| <syntaxhighlight lang="wikitext">{{#citations:Q95|Q96}}</syntaxhighlight>
| {{#citations:Q95|Q96}}
|}


<blockquote>
<blockquote>
'''The trailing colon is required.''' <syntaxhighlight lang="wikitext" inline>{{#citations}}</syntaxhighlight> without the colon renders literally — the wiki reads it as an unknown template:
<references/>
</blockquote>
 
== Copy a formatted citation from the item page ==


{| class="wikitable" style="width:100%"
Every item page (<code>/wiki/Item:Q1</code>) carries a small toolbar under the title. The '''Copy citation''' button copies a ready-to-paste, formatted citation of that item — pick the '''format''' from the selector right next to it first:
! You type !! You get
|-
| <syntaxhighlight lang="wikitext">{{citations}}</syntaxhighlight>
| {{citations}}
|}
</blockquote>


== Arguments ==
* '''APA''' (the default) — author–date style, e.g. ''Lovelace, A. (1843). Notes by the Translator.''
* '''Vancouver''' — numbered style.
* '''BibTeX''' — a <syntaxhighlight lang="text" inline>@book{...}</syntaxhighlight> entry for LaTeX bibliographies.
* '''RIS''' — a tagged record for reference managers (Zotero, EndNote, …).


Both functions accept <code>style</code> and <code>output</code> as named arguments (or positionally, after the QIDs):
The citation text is generated from the item's statements at copy time, so the same source can be copied in any of the four formats. The toolbar also carries '''Copy embed code''' (for quotable content items) and, when the item can be edited with a form, '''Update basic information''' — see [[Help:Contributing/import#Re-editing an imported item]].


{| class="wikitable" style="width:100%"
== Copy the internal citation from a Source: page ==
! Argument !! Values !! Default
|-
| <code>style</code>
| <code>apa</code>, <code>vancouver</code>, <code>json</code>, <code>bibtex</code>, <code>ris</code>
| <code>apa</code>
|-
| <code>output</code>
| <code>html</code>, <code>text</code>
| <code>html</code>
|}


== Keep the items healthy ==
The human-facing page of a source — the <code>Source:</code> page (e.g. <code>Source:Ada Lovelace (Book)</code>) — carries a '''Copy internal citation''' button under its title. Clicking it copies the wikitext snippet


* Sources are items with harvested metadata (DOI, publisher, pages, …) — create them with [[Help:Contributing/import|Special:AddSource]].
<syntaxhighlight lang="wikitext" copy><ref>{{#cite:Q42}}</ref></syntaxhighlight>
* Content items point at their source with a <code>source</code> statement ([[Help:Contributing/entities|items and properties]]).
* For an exact quote location, add a <code>page(s)</code> qualifier on the content item's <code>source</code> statement — it becomes the page number in the citation.
* A missing or unknown item renders an error span, never a broken page.


== How updates propagate ==
with the right Q-number for that source, ready to paste into the article you are writing — exactly the hand-typed syntax described above. The button appears on every <code>Source:</code> page that is linked to its item, and also on the '''Item page of any source item''' (<code>/wiki/Item:Q1</code> — the same toolbar row as Copy citation / Copy embed code). Items of source type therefore offer the internal-citation snippet from both surfaces; this matters most for sources without a <code>Source:</code> page at all (a '''book excerpt''' is part of a book and never gets its own page — its Item page is where you copy its internal citation from).


Editing a cited item re-renders every citing page automatically (through the job queue, usually within a few minutes). A page always renders the current state of its citations — there is no metadata to keep in sync by hand.
The Item-page toolbar's '''Copy embed code''' button (for quotable content items — quotations, code snippets, mathematical expressions) offers a choice when clicked: '''Internal (on-wiki)''' copies the <syntaxhighlight lang="wikitext" inline>{{#content:Q42}}</syntaxhighlight> parser-function wikitext to show the content inline on any wiki page, '''External (iframe)''' copies the <code>&lt;iframe&gt;</code> of <code>Special:Embed</code> for third-party sites. Pick a flavour and it is copied to the clipboard.


== See also ==
== See also ==


* [[Help:Contributing/import]] — creating source items from external authorities
* [[Help:Contributing/entities]] — the semantic data model behind the citation mechanism
* [[Help:Contributing/entities]] — items, properties, statements and qualifiers
* [[Help:Contributing]] — the hub
* [[Help:Contributing/semanticDynamicContent]] — other ways to render item data on a page
* [[Help:Contributing/import]] — creating the citable source items
* [[Help:Contributing/query]] — analyse the data with SPARQL
* [[Help:Contributing]] — contributing to this wiki

Latest revision as of 09:17, 10 September 2026

RonzzWikiBase has a custom citation mechanism. It is different from those on vanilla wikibase instances, such as Wikipedia.

Why a custom citation mechanism?

On a vanilla wikibase, citation is cubersome: You need to write citation text manually or generate it via a 3rd-party app, then paste it between <ref></ref> tags to create a citation item. Therefore, if you cite the same source on multiple pages, the way to go is to copy and paste the citation text multiple times.

The most scary part comes when you later updates the citation (e.g., because you made a typo). You will need to manually update each one, unless you have a bot account setup and know MediaWiki APIs well enough to do some batch text-op scripting.

To eliminate all the complexity, we purpose-built our custom entity-based citation mechanism.

A citation starts with a citable entity

To create a citation on ronzz-wikibase, you first need a citable entity, which can be a book, a newspaper article, or whatever source you would like to cite.

First search via Special:ItemDisambiguation page by title if the source you would like to cite exists already as an entity on ronzz-wikibase. If so, note its entity number (the number starting with "Q"). If it does not yet exist, you can create it. The entity number will be shown at the end of the guided creation process. Note it. This magic number represents the citable entity across ronzz-wikibase

A citation is declared with <ref>{{#cite:Qxx}}</ref>

You type You get
Ada was first.<ref>{{#cite:Q96}}</ref>
Ada was first.[1]

That's it. The ronzz-wikibase render engine takes care of everything.

If you ever need to cite multiple sources in one place, simply repeat the entire syntax multiple times. Each source needs its own <ref></ref> wrapping.

The same source cited several times renders ONE footnote. Repeat <ref>{{#cite:Qxx}}</ref> as often as you need — the render engine recognises duplicate sources and merges the footnotes into a single entry with one ↑ backlink per usage (identical to what a named <ref name="..."> would give you). No manual de-duplication needed.

Create bibliography with <references/>

This part is exactly the same as on vanilla wikibase instances such as wikipedia. You simply type at the end of your article:

<references/>

and everything you have cited in the article will be automatically included:

  1. ↑ Lovelace, A. (1843). The Analytical Engine has no pretensions whatever to originate anything. In Notes by the Translator. R. & J. E. Taylor. https://doi.org/10.1000/notes

Copy a formatted citation from the item page

Every item page (/wiki/Item:Q1) carries a small toolbar under the title. The Copy citation button copies a ready-to-paste, formatted citation of that item — pick the format from the selector right next to it first:

  • APA (the default) — author–date style, e.g. Lovelace, A. (1843). Notes by the Translator.
  • Vancouver — numbered style.
  • BibTeX — a @book{...} entry for LaTeX bibliographies.
  • RIS — a tagged record for reference managers (Zotero, EndNote, …).

The citation text is generated from the item's statements at copy time, so the same source can be copied in any of the four formats. The toolbar also carries Copy embed code (for quotable content items) and, when the item can be edited with a form, Update basic information — see Help:Contributing/import#Re-editing an imported item.

Copy the internal citation from a Source: page

The human-facing page of a source — the Source: page (e.g. Source:Ada Lovelace (Book)) — carries a Copy internal citation button under its title. Clicking it copies the wikitext snippet

<ref>{{#cite:Q42}}</ref>

with the right Q-number for that source, ready to paste into the article you are writing — exactly the hand-typed syntax described above. The button appears on every Source: page that is linked to its item, and also on the Item page of any source item (/wiki/Item:Q1 — the same toolbar row as Copy citation / Copy embed code). Items of source type therefore offer the internal-citation snippet from both surfaces; this matters most for sources without a Source: page at all (a book excerpt is part of a book and never gets its own page — its Item page is where you copy its internal citation from).

The Item-page toolbar's Copy embed code button (for quotable content items — quotations, code snippets, mathematical expressions) offers a choice when clicked: Internal (on-wiki) copies the {{#content:Q42}} parser-function wikitext to show the content inline on any wiki page, External (iframe) copies the <iframe> of Special:Embed for third-party sites. Pick a flavour and it is copied to the clipboard.

See also