I’ve proposed that Wikipedia upgrade its quotes to contextual citations.
Summary:
This article describes what changes need to be undertaken to upgrade a Wikipedia page’s citations:
- add the javascript and css to the head
- wrap the quotes in <q> or <blockquote> tags
- call the jQuery plugin in the footer
- generate the contextual json data by calling the webservice
1) Add Javascript to the <head>:
2) Wrap the quotes in <q> or <blockquote> tags:
Note: This step requires extracting the source’s URL from the reference. I’m not sure the best way to do this programmatically. I would start by trying pywikibot.
Code:
who imagines herself susceptible to attacks of tremors and palpitations (her "<q cite="https://www.gutenberg.org/files/1342/1342-h/1342-h.htm">poor nerves</q>") whenever things are not going her way
Screenshot:
View Sample html: Pride and Prejudice
3) Call jQuery plugin in the footer:
Code:
<!-- ##### Begin: CiteIt.net Dependencies ##### -->
<div id='citeit_container'><!-- CiteIt-quote-context.js injects data returned from lookup in this hidden div --></div>
<script>
// Call CiteIt.net plugin on all q-tags and blockquotes:
$( document ).ready(function() {
jQuery('q, blockquote').quoteContext();
});
</script>
<!-- ##### End: CiteIt.net Dependencies ##### -->
4) Generate the contextual JSON data by calling the webservice
- You can run your own instance of the webservice, or
- Call the public webservice, as demonstrated by the sample code.
More Information:
- You can view this example’s Pride & Prejudice sample code: before and after files.
- GitHub code: 8 Sample Wikipedia articles
- Sample code: view | download