Go to file
Bartosz Dziewoński e116699480 Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:

  <ref name=r/>
  <references>
  <ref name=r>A</ref>
  <ref name=r>B</ref>
  </references>

This is simple. Cite would see these as the following operations, in
order:

1. Use only:       <ref name=r/>
2. References block
3. Define only:    <ref name=r>A</ref>
4. Define only:    <ref name=r>B</ref>

<ref name=r> is defined twice with different content and we get an
error message.

Now, imagine the following wikitext:

  <ref name=r/>
  {{#tag:references|
  <ref name=r>A</ref>
  <ref name=r>B</ref>
  }}

Cite would see these as the following operations, in order:
1. Use only:       <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block

When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.

5. Undo:          <ref name=r> reused
6. Define only:   <ref name=r>B</ref>
7. Undo:          <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>

Thus we get no errors, although we should.

This patch changes the order of the rollback operations:

5. Undo:          <ref name=r> reused
6. Undo:          <ref name=r> defined
7. Define only:   <ref name=r>A</ref>
8. Define only:   <ref name=r>B</ref>

Aha! <ref name=r> is defined twice with different content! We get an
error correctly.

Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-02-02 21:21:30 +01:00
i18n Localisation updates from https://translatewiki.net. 2016-01-20 21:05:43 +01:00
modules Update packages 2015-12-19 09:52:30 +00:00
.gitignore composer test entry point 2015-11-23 22:15:36 +01:00
.gitreview Adding .gitreview 2012-03-23 10:16:54 -07:00
.jscsrc build: Test JS code with jshint and jscs via npm 2015-11-18 16:54:55 -08:00
.jshintignore Update packages 2015-12-19 09:52:30 +00:00
.jshintrc Update packages 2015-12-19 09:52:30 +00:00
AUTHORS.txt Add license details and give credit to more authors (based on git shortlog) 2014-07-26 16:16:47 -07:00
Cite.php Add extension.json, empty PHP entry point 2015-05-03 06:36:25 +00:00
Cite_body.php Rollback all, then redo all, when fixing out-of-order tags; not one-by-one 2016-02-02 21:21:30 +01:00
CiteCSSFileModule.php Use CSS to style Parsoid's Cite HTML 2015-06-08 21:58:15 +01:00
citeParserTests.txt Rollback all, then redo all, when fixing out-of-order tags; not one-by-one 2016-02-02 21:21:30 +01:00
composer.json build: Updating development dependencies 2016-01-05 10:32:19 -08:00
COPYING.txt Add license details and give credit to more authors (based on git shortlog) 2014-07-26 16:16:47 -07:00
extension.json Add pages with Cite errors to a tracking category 2015-09-24 12:16:13 +03:00
Gruntfile.js Update packages 2015-12-19 09:52:30 +00:00
package.json build: Updating development dependencies 2015-12-29 11:15:53 -08:00
phpcs.xml Add php code sniffer 2015-12-16 13:11:00 +00:00
SpecialCite.php Add SpecialCite stub file for backwards-compatability 2015-05-25 15:01:42 +02:00