mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Gallery: shift TSRs in the DOM, rather than fibbing about srcOffset
Passing srcOffsets which don't actually correspond to actual regions of the source wikitext cause problems in the token offset conversion code. Instead, parse the wikitext as itself, then adjust the TSRs in the DOM tree. Since Gallery isn't ported to PHP (yet), update the automatically-generated Gallery/index.php. The newly-added ContentUtils::shiftDSR() was ported, however. Change-Id: I28f3d3398930733ae2bcf9759e49c45f93bc7190
This commit is contained in:
parent
c790d125de
commit
b84b71af22
|
@ -29,14 +29,16 @@ class Ref {
|
|||
// in-memory DOM which is simply a tree data structure, we can
|
||||
// nest flow content in a <sup> tag.
|
||||
wrapperTag: 'sup',
|
||||
inTemplate: state.parseContext.inTemplate,
|
||||
extTag: 'ref',
|
||||
extTagOpts: {
|
||||
allowNestedRef: !!allowNestedRef,
|
||||
pipelineOpts: {
|
||||
extTag: 'ref',
|
||||
extTagOpts: {
|
||||
allowNestedRef: !!allowNestedRef,
|
||||
},
|
||||
inTemplate: state.parseContext.inTemplate,
|
||||
// FIXME: One-off PHP parser state leak.
|
||||
// This needs a better solution.
|
||||
inPHPBlock: true,
|
||||
},
|
||||
// FIXME: One-off PHP parser state leak.
|
||||
// This needs a better solution.
|
||||
inPHPBlock: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,10 @@ class References {
|
|||
static toDOM(state, content, args) {
|
||||
return ParsoidExtApi.parseTokenContentsToDOM(state, args, '', content, {
|
||||
wrapperTag: 'div',
|
||||
extTag: 'references',
|
||||
inTemplate: state.parseContext.inTemplate,
|
||||
pipelineOpts: {
|
||||
extTag: 'references',
|
||||
inTemplate: state.parseContext.inTemplate,
|
||||
},
|
||||
}).then(function(doc) {
|
||||
var refsOpts = Object.assign({
|
||||
group: null,
|
||||
|
|
|
@ -48,12 +48,14 @@ class Ref implements ExtensionTag, SerialHandler {
|
|||
// in-memory DOM which is simply a tree data structure, we can
|
||||
// nest flow content in a <sup> tag.
|
||||
'wrapperTag' => 'sup',
|
||||
'inTemplate' => $extApi->parseContext['inTemplate'] ?? null,
|
||||
'extTag' => 'ref',
|
||||
'extTagOpts' => [ 'allowNestedRef' => $allowNestedRef ],
|
||||
// FIXME: One-off PHP parser state leak.
|
||||
// This needs a better solution.
|
||||
'inPHPBlock' => true,
|
||||
'pipelineOpts' => [
|
||||
'extTag' => 'ref',
|
||||
'extTagOpts' => [ 'allowNestedRef' => $allowNestedRef ],
|
||||
'inTemplate' => $extApi->parseContext['inTemplate'] ?? null,
|
||||
// FIXME: One-off PHP parser state leak.
|
||||
// This needs a better solution.
|
||||
'inPHPBlock' => true,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -486,8 +486,10 @@ class References implements ExtensionTag, SerialHandler {
|
|||
$txt,
|
||||
[
|
||||
'wrapperTag' => 'div',
|
||||
'extTag' => 'references',
|
||||
'inTemplate' => $extApi->parseContext['inTemplate'] ?? null,
|
||||
'pipelineOpts' => [
|
||||
'extTag' => 'references',
|
||||
'inTemplate' => $extApi->parseContext['inTemplate'] ?? null,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue