Jump to content


From Meta, a Wikimedia project coordination wiki

Proposal for adding Contextual Citations to MediaWiki[edit]

(This is a rough draft to get the discussion started about my contextual citations idea, not a finished proposal)

I'd like to explore whether contextual citations from my open-source project could be added to the MediaWiki editor and if so what the syntax should be for their markup?

What are Contextual Citations?[edit]

Contextual citations are quotations in which:

  • the URL of the cited source has been supplied by the author in a way that can be processed programmatically.
  • the authoring software -- in this case MediaWiki -- recognizes that a URL has been supplied with a quote
  • the authoring software makes a call to a web service, which looks up the cited URL and determines whether the quote has been accurately cited
  • if the quote exists as cited, the web service calculates the (500) characters of context surrounding the quotation
  • the web service extracts the contextual data into a JSON file, which is saved to a CDN.
  • the authoring software (MediaWiki) uses javascript to load the JSON file(s) and displays the context to the reader when the reader clicks on the arrows above and below the quote, or when the reader clicks on the popup link.

View Video & Example[edit]

Watch: 3 minute Video[edit]

Demo: 2 Examples[edit]

  1. blockquote example
  2. inline popup example

Sample Article: (draft: proof-of-concept)[edit]

Benefits & Implementation[edit]

The Benefits of Contextual Citations[edit]

The benefit of contextual citations are that:

  • readers can learn more about the context of a citation, gaining a better understanding of the source.
  • readers can gain trust in the integrity of the citation, verify that a quote wasn't manufactured or cherry-picked.

Implementation: 2 Quote Types[edit]

The webservice looks up the citation's original source using a python web service and javascript is used to show/hide contextual data stored in a JSON file.

This JSON data is displayed by two different html elements:

  1. <blockqoute>: click on arrows above and below the quote to expand the JSON context around a quote block
  2. <q> (inline popup): click on the link for inline quotes to see a popup with JSON data containing the surrounding 500 characters of context

Proposed Syntax for MediaWiki contextual citations[edit]

For contextual citations to be implemented for Wikipedia, MediaWiki syntax must support the specification of a URL when marking up a quote.

I've done a basic search into Mediawiki editor syntax, but I'm not an expert.

I'm interested in getting feedback on what the proper syntax should be if the proposed features are to be adopted.

I'm not tied to this particular syntax. I'm throwing out proposals just to get things started.

1) Blockquotes[edit]

HTML: <blockquote cite="http://avalon.law.yale.edu/19th_century/jeffauto.asp">Nothing is more certainly written in the book of fate than that these people are to be free.</blockquote>

Proposed Syntax: Mediawiki Syntax[edit]

>> add "url" field

   url=https://avalon.law.yale.edu/19th_century/jeffauto.asp |
   text=Nothing is more certainly written in the book of fate than that these people are to be free.|
   sign=Thomas Jefferson|
   source=Jefferson's Autobiography, January 6, 1821 

>>View Live Demo: Blockquote with expanding arrows | JSON file

2) Inline Popup[edit]

HTML: Suppose you were writing an essay and quoted Harvard Professor Laurel Thatcher Ulrich‘s recently popularized quip that <q cite="https://dash.harvard.edu/bitstream/handle/1/14123819/Vertuous%20Women%20Found.pdf">Well-behaved women seldom make history</q>?

Proposed Syntax (This is just a proposal to get things started)[edit]

>> add "context=popup" option

   Well-behaved women seldom make history | 

>> View Live Demo: Inline Contextual Popup | JSON file

Meta-data: custome data elements[edit]

I would like to see librarians provide input into how meta data could be embeded in citations.

I've written up one option for handling meta-data in Html custom data elements:

 <blockquote cite="https://gimletmedia.com/shows/reply-all/o2hx34/127-the-crime-machine-part-i"
   data-citeit-citing-tags='reply-all-podcast, police, crime, crime-history, new-york-city, comsats, jack-maple'
   data-citeit-cited-title='The Crime Machine, Part I, Episode 127'
   data-citeit-cited-authors_names='PJ Vogt'
   data-citeit-cited-authors_entities_urls = "https://en.wikipedia.org/wiki/Reply_All_(podcast)"
   data-citeit-cited-series = 'Reply-All'
   data-citeit-cited-embed-url = 'https://player.gimletmedia.com:443/o2hx34'

Ideally, the definition of the Html elements could be synchronized with the MediaWiki editor syntax.

Status: Alpha Software[edit]

Though I am proposing this for Wikipedia, the supporting software I've developed is still under development.

I am hoping that if the Wikipedia community sees potential in this app, people will collaborate with me to improve it so that it can mature into something that is eventually production-ready.

(I expect that it will need to run in production on a wide variety of smaller sites before it is ready for production use on Wikipedia.)

Test-Drive the WordPress Plugin and Python Webservice[edit]

Test-drive the App on the CiteIt.net demo site. This will allow you to experience for yourself what it is like to create a contextual citation.

(The software has bugs in it and can be improved, but it should give you an idea what is possible.)

Wikipedia Discussion[edit]

More information[edit]

Developer Sample Code[edit]

Open Source License: MIT[edit]


- Tim Langeman: (contact info)