From 7aad9fc1b736340f51999e87e6c73d0b95e7590b Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Mon, 29 Oct 2012 12:07:18 -0500 Subject: [PATCH] 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 --- js/lib/ext.Cite.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/lib/ext.Cite.js b/js/lib/ext.Cite.js index 23c675c07..e66739da7 100644 --- a/js/lib/ext.Cite.js +++ b/js/lib/ext.Cite.js @@ -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: "" + }; + } + res = [ new TagTk('span', [ new KV( 'typeof', 'mw:Placeholder' ) ], dataAttribs) ]; } //console.warn( 'references res: ' + JSON.stringify( res, null, 2 ) );