Jump to content

User:PerfektesChaos/js/citoidWikitext/software

From Wikipedia, the free encyclopedia

Software issues related to citoidWikitext.

Data model extension

[edit]

The default Zotero data collection (format=zotero) is improved as follows:

component type, constants meaning
authors undefined
Array
If defined, every element is an object with components:
  • type – mandatory, see below
  • family – family name of a person
  • given – given name of a person
  • name – name of an institution
  • extra – unidentified components

This Array will contain any person characterized as type: author, bookAuthor, reviewedAuthor, interviewee, interviewer, artist, attorneyAgent, cartographer, castMember, commenter, composer, cosponsor, counsel, director, guest, inventor, performer, podcaster, presenter, producer, programmer, recipient, scriptwriter, sponsor, wordsBy. Please help yourself.

contributors undefined
Array
Like authors. Contains type: contributor.
date undefined
string
National formats will be converted to ISO 8631 YYYY-MM-DD or YYYY-MM.
doi undefined
string
DOI if detected.
domain string Top levels: example.org
(extended to 3rd level for .ac. or .co. or .gv. second levels).
editors undefined
Array
Like authors. Contains type: editor.
ISBN false
Array
First element hyphenized.
ISBN-invalid undefined
true
ISBN checksum mismatch in ISBN[0].
ISBN-type undefined
10 13
Number of digits in ISBN[0].
language undefined
string
Human naming will be converted to ISO 639 two-letter code, three letters or xx-YY code.
pmid undefined
string
PubMed ID if detected.
seriesEditors undefined
Array
Like authors. Contains type: seriesEditor.
title string Always defined.
url string
false
Always defined, but disabled if URL is not significant for the publication, or should be replaced by some ID.
urlQuery undefined
string
Defined, if url is not meaningful, and preserves citoid server query.
year undefined
number
Number of year.

General procedure

[edit]

Users are supposed to load the scout script, if in source code edit mode.

That will decide upon further steps and will load required resources, when needed.

When something has been selected, API is used for contacting WMF citoid service. The result is polished by the opus module. This project independent data is forwarded to a project specific module which creates the appropriate template string. That string is inserted at cursor position.

Further wiki projects

[edit]

Any number of wiki projects might be registered.

For each wiki a plug-in is required, which gets the ID wgDBname and will provide at least one function wgDBname.fire() which receives the aggregated Citoid data and returns an Array of template name and parameters.

See here for interface details.

The dewiki plug-in is an example.

Codes

[edit]
Source code Purpose for load() human readable version
Scout for triggering main action: r.js d.js
core – core issues, GUI, API: core/r.js core/d.js
opus – post processing of content: opus/r.js opus/d.js
prego – preferences (not yet in effect): prego/r.js prego/d.js
dewiki – template interfaces for German Wikipedia: dewiki/r.js dewiki/d.js
ResourceLoader
Namespaces main space; own user subpages; sandbox; bib templates
Cookies

sessionStorage:

  • Item: citoidWikitext
  • Content: project sandbox specification

localStorage:

  • anonymous users only:
  • Item: preferencesGadgetOptions
  • Content: user preferences
mw.libs citoidWikitext
MediaWiki
  • 1.26 (mw.storage) for anonymous users
  • 1.23 for registered users

Internationalization

[edit]

The code is prepared for multilingual support.

  • I18N.texts mapping on top of source code needs to be translated.

Further projects might define an independent plugin with their template definitions, deriving current result from API result.

Localization on the fly

[edit]

The following code defines for an entry nithingale a translation when GUI is displayed in qya language:

var xLang = { nithingale: { qya: "lómelinde" } };
if ( typeof mw.libs.citoidWikitext !== "object" ) {
   mw.libs.citoidWikitext  =  { };
}
if ( typeof mw.libs.citoidWikitext.l10n === "object" ) {
   // user has defined own translations; keep them
   $.extend( xLang, mw.libs.citoidWikitext.l10n );
}
mw.libs.citoidWikitext.l10n = xLang;

This entry will replace the I18N.texts.nithingale.qya definition, or create one.