mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-28 08:50:07 +00:00
Enable RT-ing of references tag if page has no refs/citations.
* There was a fixme for this in ext.Cite.js which was triggering an error in the serializer and introducing rt-diffs. * No change in parser tests. * Eliminates semantic error in en:Birkenhauer Island and other pages. Change-Id: I9fe6ea26fdf1859d751b02a288393af610be5474
This commit is contained in:
parent
d39d4fa9e8
commit
7aad9fc1b7
|
@ -159,10 +159,12 @@ Cite.prototype.onReferences = function ( token, manager ) {
|
|||
group: null
|
||||
}, Util.KVtoHash(token.attribs));
|
||||
|
||||
var dataAttribs;
|
||||
if (options.group in refGroups) {
|
||||
var group = refGroups[options.group],
|
||||
listItems = $.map(group.refs, renderLine ),
|
||||
dataAttribs = Util.clone(token.dataAttribs);
|
||||
listItems = $.map(group.refs, renderLine );
|
||||
|
||||
dataAttribs = Util.clone(token.dataAttribs);
|
||||
dataAttribs.src = token.getWTSource(this.manager.env);
|
||||
res = [
|
||||
new TagTk( 'ol', [
|
||||
|
@ -171,7 +173,20 @@ Cite.prototype.onReferences = function ( token, manager ) {
|
|||
], dataAttribs)
|
||||
].concat( listItems, [ new EndTagTk( 'ol' ) ] );
|
||||
} else {
|
||||
res = [ new SelfclosingTagTk( 'meta', [ new KV('fixme', 'add-rdfa-rt-info') ] ) ];
|
||||
var tsr = token.dataAttribs.tsr;
|
||||
if (tsr) {
|
||||
// src from original src
|
||||
dataAttribs = {
|
||||
tsr: tsr,
|
||||
src: this.manager.env.text.substring(tsr[0], tsr[1])
|
||||
};
|
||||
} else {
|
||||
// Use a default string
|
||||
dataAttribs = {
|
||||
src: "<references />"
|
||||
};
|
||||
}
|
||||
res = [ new TagTk('span', [ new KV( 'typeof', 'mw:Placeholder' ) ], dataAttribs) ];
|
||||
}
|
||||
|
||||
//console.warn( 'references res: ' + JSON.stringify( res, null, 2 ) );
|
||||
|
|
Loading…
Reference in a new issue