Had to do that in JavaScript as doing it server-side would have
made refactoring large parts of the extension necessary.
Bug: 38141
Change-Id: I60ecd2fc0edf2aee89974d8069cc0b075cda3f93
Moved the scripts and the CSS into the modules folder directly
(like almost all other extensions do), added a .jshintrc to not have
jenkins shout at this change and minor stuff.
After this change Cite will no longer work with anything older than
PHP 5.3!
Change-Id: I1c87af794f2a9894fb0d82a5bd97bd2182f028e1
* The initialization of nestedRefCollectionMap[references-id]
in handleReferences was the wrong place to initialize it since
on pages with multiple <references /> tags, the map can get
reset after a references tag is processed. So, for later
references tags, the entry for those will get cleared which
led to crashes.
Ex: es:Abderramán_I and couple others found in RT testing.
* This patch fixes the crasher.
* Added a new parser test with multiple references tags that
captures this scenario. Regenerated selser changes file.
Change-Id: I64402e77996486b099acda114f2e250258b0048e
* Track <ref>s birthed in <references> tags and capture their
HTML and set <references>.data-mw.body.html to the concatenated
HTML for all those child <ref> tags.
* No change in parser-tests because our test normalization code
strips data-mw before comparing results. Since this patch
only changes data-mw output for "References: 5. ..." test,
there is no change. In any case, this patch updates the
data-mw output for the test in question so that if we do
modify our normalization routines, the test will still pass.
Change-Id: Iaea752dec03e5e7f0d36baf3b7a9973f1b85e8a5
* This patch now supports any template that generates nested refs
where the top-level token is just a single-ref.
Ex: {{efn|New timetable{{sfn|Vallance|1991|p=31}}}}
* The solution in this patch removes the hack from the previous
version (53bbcbb3). As documented in the bug report, this
solution essentially "trusts" template authors and lets
nested refs through when they come from templates.
But, top-level nested refs are still not allowed.
<ref>foo<ref>bar</ref>baz</ref> in the toplevel page
will still generate a single reference with content
"foo<ref>bar</ref>baz"
* Updated the nested ref test output
- Regenerated selser changes because of the changed output.
- Regenerated blacklist because of the changed selser changes.
* This now handles:
- https://en.wikipedia.org/wiki/User:Edgepedia/VE/GNoSR
- https://en.wikipedia.org/wiki/Phellinus ellipsoideus
Change-Id: I627955f0be1c5e2bafc49647c94c2be68ce711a8
Problem:
* VisualEditor needs to be able to more reliably target Cite errors.
Solution:
* Add a more specific class to cite errors
Grumble:
* Ideally all extensions would use mw-ext-{extension name} as a prefix to
their CSS classes (or something similar).
Bug: 51337
Change-Id: If4f5360cc1c7b765ad896b14901a9b024782cc93
* There is another unrelated issue on that page ==> It has
a couple instances of <ref>text<ref> which slurps the entire
rest of the page into a 10K string (on which the regexp failed).
Change-Id: Ia4c498b28042de5bfe9b0945c0efaa8c6cb81ea0
* source and group attributes were being added as HTML attrs.
on the ol-node which is invalid. Plus, after refererences
generation, source attr was being deleted which causes crashers
in production if references output is reused from cache.
* Moved both attributes to data.parsoid
* Removed group="" from parserTests that I erroneously added
in that previous commit.
* Minor cleanup in DOMPostProcessor.
Change-Id: I85f4ad0a311d653d7ba3e010c7a5db028b643e9f
* So far, references wikitext was being replaced with a meta marker
token that participated as an inline token in p-wrapping. As a
result, in some cases, a p-tag was wrapping the references ol-node
which is buggy HTML. When VE loaded this DOM, the p-node was split
around the ol-node and duplicated DSR which led to duplicated
output when selser ran on this.
* One way of fixing this would have been to add a special case in
the paragraph wrapper to treat the mw:Extensions/References/Marker
meta tag as a block token.
* A better solution with an eye towards the longer-term is to emit
mw:DOMFragment wrapper for the references tag with the content
being an ol-node. The dom-fragment unpacking code then takes care
of p-wrapping issues for the ol-node. This fixes the bug in this
case.
* Also fixed parser tests output where group attribute was missing
on some tests (which indicated that the older code was not emitting
the group attribute on references tag).
* No change in parser tests.
Change-Id: I073b2e68667d577c75cad07d19cea2b19d0e89fe
* After trying various hacks, came up with a relatively simple
fix/hack to support nested refs.
The fix looks for {{#tag:ref..}} and short-circuits full
pipeline expansion and converts that to an extension tag
in place.
* Tested with the following wikitext which parses and RTs correctly
A <ref name='foo' />
B {{#tag:ref|nested ref <ref>bar</ref> |name=foo}}
<references />
* Also tested on en:Fomitiporia_ellipsoidea from the bug report
and verified correct parse and round tripping.
* Verified that the nested ref in <ref> foo <ref>bar</ref> </ref>
continues to be parsed as plain text.
* No change in parser test results -- have to make another
round of updates to parser tests.
Change-Id: I43bb8b710bd10a9ddbea27818ff8aaf97ddb3fdc
* See example below that clarifies the problem before this patch
-------------------
$ echo "{{#tag:ref|foo}} {{echo|<references />}}" | node parse --extensions ref,references --wt2wt --editMode true
<ref>foo</ref> <references />
-------------------
* The problem is that references are generated after dom fragments
are unpacked in the DOM which lost the mw:Transclusion typeof and
data-mw that had been set on the ref and references tags.
* This is a quick fix to prevent some dirty diffs with #tag:ref being
reported on en-wp. Longer term, we do have a plan to use DOMFragment
encapsulation for refs and references as well and splitting up
references processing differently than is being done currently.
Change-Id: I4186cae93b9882d367c7d4efecc092607fe17c61