Commit graph

145 commits

Author SHA1 Message Date
Subramanya Sastry c3b1492d10 Disable Parsoid-integrated-mode tests for now
* Since Cite development happens in two repos (here and the Parsoid
  repo), integrated tests ensures that changes don't fall too far
  out of sync.

  CI runs Parsoid-integrated-mode tests in extensions repo with the
  vendor-released Parsoid.

  Parsoid CI runs Parsoid-standalone-mode tests in the Parsoid repo
  which also has a copy of the citeParserTests.txt file found here.
  But, that CI run uses the Parsoid patch itself.

  This difference makes for unnecessrily laborious test syncing
  while making changes to the two repos. It is manageable for one-off
  changes but when making lots of updates that changes tests a lot,
  this quickly becomes painful.

* For now, we can break this coupling temporarily by disabling
  Parsoid-integrated-mode test runs. This simplifies the test syncing
  by letting patches in Cite repo to be merged in a chain and then
  doing a single test sync to the Parsoid repo (otherwise, Parsoid's
  CI will be broken since the html/php sections in Parsoid's cite
  test copy will be out of date).

* Filed T354215 to move Parsoid's Cite implemntation to this repo
  which eliminates this complexity altogether.

Change-Id: Id5727381b0e23058d098180c308797b2555ad02f
2024-01-02 19:31:52 +00:00
Subramanya Sastry 58f008ae1e Sync up Cite repo tests with Parsoid + (en/dis)able some Parsoid tests
* This now aligns with Parsoid commit 0fab92ba453d424aedeadaaa9e1514c42bbd94d1
* Disabled the newly added tests because that Parsoid fixes for the
  tests haven't been released to vendor to let CI pass these tests.
* Re-enabled a previously disabled test.

Change-Id: I4ab87d2d486b7a1fef652c50c4f1e79ddfe83ce6
2023-12-18 16:35:01 -06:00
jenkins-bot f112648cb2 Merge "Revert "Revert "Temporarily disable a Parsoid test to let us change code in Parsoid""" 2023-12-15 21:14:43 +00:00
Subramanya Sastry 8ac343718b Revert "Revert "Temporarily disable a Parsoid test to let us change code in Parsoid""
This reverts commit b163add15b.

Reason for revert: This was my mistake. I forgot that reverting this
would break Parsoid CI once the Parsoid Cite patch merged. So, I have to
wait till the Parsoid Cite change is released to vendor before I sync
the test change here.

Change-Id: Icaecee1e56907980681aae01be377b6906bd93a6
2023-12-15 20:36:43 +00:00
jenkins-bot 708436c998 Merge "Revert "Temporarily disable a Parsoid test to let us change code in Parsoid"" 2023-12-15 19:24:05 +00:00
jenkins-bot d5fe9559e7 Merge "Temporarily disable a Parsoid test to let us change code in Parsoid" 2023-12-15 19:10:57 +00:00
xiplus f7a181ed42 Give a different error from too_many_keys when 'follow' attribute conflicts
Add message "cite_error_ref_follow_conflicts" for tags with
conflicting parameters.

Bug: T299280
Change-Id: Ie64f4ab4831966f66f812ea67cc244718f818afb
2023-12-15 15:23:53 +01:00
jenkins-bot cdc2bd2b96 Merge "Skip URL encoding in id="…" attributes that aren't URLs" 2023-12-12 14:34:07 +00:00
thiemowmde 89bd26fcf5 Skip URL encoding in id="…" attributes that aren't URLs
I played around with a few options (see patchset 1) but ended
introducing new terminology:

* "Backlink" describes the ↑ button down in the list of <references>
  that jumps back up into the article. The code was already using
  "backlink" in some places.
* "Backlink target" is the id="…" attribute up there, visible as the
  typical [1] in the article.
* I use "jump" to describe the idea that clicking the [1] jumps down
  to the full reference.
* "Jump target" is the id="…" down there in the list of <references>.
* "Jump link" is the same id, but encoded to be used as the href="…"
  attribute when clicking the [1].

I hope this makes sense. Suggestions welcome.

Another benefit is that "normalization" is really only normalization
now, not any URL and/or HTML encoding.

Bug: T298278
Change-Id: I5a64ac43aef895110b61df65b27f683b131886fb
2023-12-12 13:56:37 +00:00
thiemowmde 6a18eac513 Fix regular expressions not being case-insensitive
The "parser marker" placeholders are case-sensitive, e.g. for a tag
that's written like <rEf> the placeholder will also say …-rEf-…. This
was really just a mistake.

The error is as old as this code is. Added in commit 75004e33 in
2009.

Note we shouldn't use /i at the end because the marker itself should
not be case-insensitive. Only the tag name.

Instead of adding more (slow) test cases I update two that are
exactly about this part of Cite (nested tags) anyway.

Bug: T64335
Change-Id: I44c7a42a0da682a1082952fd1af817bf7d45378c
2023-12-11 19:21:12 +01:00
Subramanya Sastry b163add15b Revert "Temporarily disable a Parsoid test to let us change code in Parsoid"
This reverts commit 650d6a9f13.

Depends-On: I7249bd03a7942ff7725a20178a051300b777e3a8
Change-Id: Ica414002604f2dffde866dfac6a85db400ea714e
2023-12-08 11:35:13 -06:00
Subramanya Sastry 650d6a9f13 Temporarily disable a Parsoid test to let us change code in Parsoid
Change-Id: I401656265253a429691cc76adc5db5b129cff2cc
2023-12-08 11:33:38 -06:00
Subramanya Sastry 69529bdcf6 Sync up Cite repo with Parsoid
This now aligns with Parsoid commit 2f962cd9a66c9fd69664e3e8a2d79820cd6f1453

Change-Id: Ia93f8ced5c79e2ba49d40aafe6ea14d1691609b0
2023-12-07 18:46:23 +00:00
thiemowmde 0bae6eb224 Fix confusing wording of "invalid parameter in <ref>" message
This error message really always meant nothing but "there is an
unknown parameter in your <ref> tag". It's unnecessarily confusing
only for historical reasons. See T299280#9384546 for a long
explanation.

Bug: T299280
Change-Id: Ic224d5828f7b7ac0928c44f526c61654ccf3425e
2023-12-07 10:54:46 +01:00
jenkins-bot e73c7d61ca Merge "Correctly encode non-breaking spaces in reference names" 2023-12-06 18:00:43 +00:00
thiemowmde f9bb125e4c Correctly encode non-breaking spaces in reference names
Note how this currently behaves. The user input is
<ref name="…&nbsp;…">
But what we get in the end is
<li id="…&#160;…">
This implies that the &nbsp; is decoded and re-encoded with a
slightly different entity encoding. (Note that &nbsp; and &#160;
and &#xa0; are all the same character.)

Also note how there is only an underscore in the href="…", but the
non-breaking space is gone. This is identical to what happens in
links and headlines. Try for example [[a&nbsp;_a]]. Multiple
underscores, non-breaking spaces, and normal spaces will be
normalized. We just do the same in the id="…" attributes.

Note this fixes only one of the issues listed in T298278.

Bug: T298278
Change-Id: Ia01f2fdd3b3e9ee6aaa9da60ca3386dcd5d6b1a0
2023-12-05 07:58:38 +01:00
Subramanya Sastry f267635b48 Update tests to match update to <gallery> output in core
Depends-On: I5039c7ef9e07199c256fd568b4f94714e5831d17
Change-Id: I69776da432eeca134785329d424d310fb506bce6
2023-11-27 18:09:03 -06:00
Subramanya Sastry 4929e015d1 Temporarily disable test to allow us to make changes in core
* Needed by change I5039c7ef9e07199c256fd568b4f94714e5831d17

Change-Id: Ieeb6b98afc74595a928bd141889486acfc9eb346
2023-11-27 18:07:35 -06:00
thiemowmde 5aa6cb0c7b Replace extremely slow parser test with fast unit tests
This parser test is a bit obscure, in my opinion. We added it in
I8c4de96 to make sure we don't get thousand separators in most
places.

We continued reworking the code since then. By now it's effectively
impossible to "accidentally" get thousand separators. The
problematic methods from the Language class are not even accessible
any more from this code.

To make the tests more robust we now use createNoOpMock (done via
the previous patch) where it matters, specifically for all Language
and Parser mocks. This proves the problematic Language methods are
never called.

Bug: T253743
Bug: T238187
Change-Id: I9bfe1f4decfaf699996da63e19473c2c0d581d9d
2023-07-28 00:32:38 +00:00
Arlo Breault 9177b50feb Sync up Cite repo with Parsoid
This now aligns with Parsoid commit 7b724ddc6c4abd44de2e1f67f64ca1d9685c6b4f

Change-Id: If24ad064d7d84fb070cb0c7976d56373e8a9db3a
2023-05-12 09:59:44 -04:00
Arlo Breault 6ed2daec12 Disabled tests to break circular dependency
html/php sections are added since otherwise it complains that the
"Test lacks html or metadata section on lines"

Change-Id: Ib1c47be09bdbe1e84b595373ad71772f2a983fc9
2023-05-10 19:47:13 -04:00
Arlo Breault 1c8a0115e9 Update parsertests with new media classes
Depends-On: Ifd4001e312a5fa4b7beaad63ba8c4e79e3201b9b
Change-Id: I80b76e2f4f538eba323f47cb2bf831016e2b2dc2
2023-04-26 13:19:58 -04:00
Arlo Breault 984aa7750c Disable tests to break circular dependency
Needed-By: Ifd4001e312a5fa4b7beaad63ba8c4e79e3201b9b
Change-Id: Ie85ee7048273023a2c51f42a333a9c1493360404
2023-04-20 16:00:43 -04:00
Subramanya Sastry fc0a239887 Document Parsoid's differing HTML for follows
* Add a file-level comment in the cite tests file.
* Document the CSS rule that hides the Parsoid HTML.

Change-Id: I27dc6d5f6ab09b67e28ce88a2e13bf2d1a13e9c0
2023-03-13 14:38:30 -05:00
Subramanya Sastry d8da2cbb28 Enable integrated testing with Parsoid
* The failing tests added to known failures are the tests
  known to fail as documented in T307741.

Bug: T307741
Change-Id: I5e5163a4bd093768d1364516ed79fb2d225ee656
2023-03-07 00:22:55 -06:00
thiemowmde c207e343a2 Add test case with conflicting dir="…" values
Just to document the current behavior.

Bug: T202593
Change-Id: I87c4118cd8ca9f860319dc1d3a25f448019339c4
2023-03-01 08:54:56 -06:00
thiemowmde 899775b5ce Remove problematic spaces from a parser test case + Rename a test file
IDEs like my PHPStorm trim spaces from the end of the line. It looks
like they are not relevant for the test and can as well be removed.

Change-Id: I54cb4fdf74dd7174450dcc552b077d388dbac749
2023-03-01 08:54:11 -06:00
Arlo Breault 1dd994a28a Re-enable test
Change-Id: I9c909e10170a0437676bdf1290cc6421073a8284
Follow-Up: If9cdabdfac26656272fcf3b4aaae0576aaed1346
Depends-On: If1e55feb86ce8b32f772e3b78bc9d29f122f4d58
2023-02-09 17:30:52 -05:00
Arlo Breault 5fa75277b7 Disable test for CI
Needed-By: If1e55feb86ce8b32f772e3b78bc9d29f122f4d58
Change-Id: If9cdabdfac26656272fcf3b4aaae0576aaed1346
2023-02-09 17:28:08 -05:00
Arlo Breault d5b5a83ae9 Sync up Cite repo with Parsoid
This now aligns with Parsoid commit b520b8092db6f092603e7244cdac5f1fc645e89a

Change-Id: I671c5831d90bbeb088f5ff2133df553142e1af53
2023-02-09 16:58:34 -05:00
Arlo Breault 0060e2b43d Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 9041d0bac69fe763112c0d8fcbd553a211a25c26

Change-Id: I34b1fdf2232e67db5326ed25ab3f4ad128e59e5d
2022-08-23 15:11:06 -04:00
Thiemo Kreuz 8fef0dd2aa Improve two error messages
Makes it easier to find the source of the error in the wikitext.

Change-Id: I648a19881210184ab1abe9b948b5efbbbdabcdc9
2022-08-20 12:23:28 +02:00
C. Scott Ananian d730d17c1a parser tests: move test which requires {{#ifeq}} into its own file
Since parser test requirements are per-file, move the smoke test which
requires `{{#ifeq}}` (from [[mw:Extension:ParserFunctions]]) into its
own file and define the requirement properly in the file header.

That avoids spurious parser test failures if developers don't have
the ParserFunctions extension installed locally.

Change-Id: Ia5ffbe0896d5033fe2da526e42bf111edbc56adf
2022-05-27 11:38:02 -04:00
Subramanya Sastry 5515de2003 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit e4305217923162568cf5b6ec08ba3c96fd5b04e3

Change-Id: I935d8641d90ec5cbcf7d29fd984085cc5338b6ec
2022-05-17 18:00:18 -05:00
C. Scott Ananian af2352e523 parser tests: Make !! config values JSON-compatible
Bug: T307720
Change-Id: Ib716c70bc47659701edfc572674b3e890e19605b
2022-05-11 21:05:55 -04:00
Subramanya Sastry 45cc963ca2 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 12d896bd5852b4a7d602fb22dd09d7fc2c5c5b64

Change-Id: I1d3183ee4afa37e0d71768cd02f03112771b82c4
2022-05-11 18:08:24 -05:00
Subramanya Sastry a478d6c3a3 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit c434df9.

Change-Id: Ib8b8593d1a303530dac56ed01335e0d635863eda
2022-04-20 19:03:18 -04:00
Subramanya Sastry 169ebf6344 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 3b5a7a318eaf8dcc5e6ed142352f1cf1a9439474

Change-Id: I32f9fcac231cdf25bd1501d7f6e022e067c8d8e1
2022-04-14 12:15:53 +05:30
Thiemo Kreuz 7b30a165e4 Use correct Sanitizer method for id/fragment escaping
Note how only the HTML5 mode behavior changes, but nothing in
legacy mode.

Also note this does not 100% fix the issue. The esample with a
non-breaking space is still broken. But it's already much better
than before.

Bug: T298278
Change-Id: Idf50dad4219ff4c594a0cc15f63cb10fdac5ffb7
2022-01-03 16:23:45 +01:00
Thiemo Kreuz 83041449a7 Add parser & unit test cases for different $wgFragmentMode's
This is only to document the current status quo and make later patches
smaller and easier to review.

Bug: T298278
Change-Id: I6c78f4d3ee32de596f2b5ee081d56eaffb1cc7bd
2022-01-03 14:14:47 +01:00
Subramanya Sastry ed59e2ac38 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 29f8e7051529ecbb62fc52bff6726a4df8bf20c2

Change-Id: I165ee24e1b78bdf181fa45430fdec1549310c359
2021-09-30 15:00:56 -05:00
C. Scott Ananian 53e8dc7b39 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 88d4620278988d121761fb440952d1d66a70ce99

Required some newline fixes to resync after "Refactor newline logic"
(change I6691c70f8e3fa3f21e2d11035bed9cdc2dc87093 /
commit 6389459b1e) was merged
this morning.

Change-Id: I64fba6cc9330a55d4e1eeb5371164b3eb4efa508
2021-07-30 11:14:38 -04:00
C. Scott Ananian 6b813c6874 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit d9a3e14dfcb422e95de7a79f0eb662fd43f9354f

Change-Id: Iae34d2107bfb47304819da7f7c715dec83da1a48
2020-08-18 16:54:33 -04:00
C. Scott Ananian a0faedb942 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 77db605163990ad851e3da0fb4fa7eca2081f379

Change-Id: I19ad9f1b6845e5557c2f5f87ac435db0ad87000d
2020-07-28 15:53:08 -04:00
C. Scott Ananian 90728bde87 Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 7321ab547b7663ba86c1cfe0bc021ff1918c0970

Change-Id: I2cc88069b19e7611f23c83ca993f9caa70f786f0
2020-07-15 11:39:46 -04:00
Bartosz Dziewoński 1975cb3dcb Do not add thousands separators when formatting reference numbers
Bug: T253743
Change-Id: I8c4de963277895d7751d6bfe3c34ca6097ebe606
2020-05-28 00:08:44 +02:00
Thiemo Kreuz 7fbd5de7f5 Merge two code paths related to follow
This patch also adds a test case that was missing before. If a
follow="…" is followed by another, normal <ref>, the internal key
(a.k.a. $this->refSequence) is not incremented. This was the case
before, just not covered by any test.

Change-Id: I102d1e67a6918017acc7e4a4663b08c828d101a6
2020-05-12 10:52:08 +02:00
jenkins-bot 53cf713cdb Merge "Add test cases for impossible follow vs. rollback edge case" 2020-05-12 02:03:35 +00:00
Subramanya Sastry eb8e07c69c Sync up with Parsoid citeParserTests.txt
This now aligns with Parsoid commit 1e72ddefc2df8d5b38d7b370d67a87b48d8a09f7

Change-Id: Ic75ac33c92997427751d037339f7eb79027356a2
2020-05-07 12:14:19 -05:00
Bartosz Dziewoński 3678215a77 Add a newline in wikitext before autogenerated reflist
Previously the reflist was added at the end of the last line of text,
which messes up paragraph wrapping (as seen in many test cases), and
generated invalid HTML when the last line was a list item (T148701).

(second try, previously reverted in 8c933d03c5)

Note this affects only pages where the <references /> tag is missing,
and the references section is auto-generated at the very end of the page.

Bug: T148701
Change-Id: Ib2101346434a4e317b5fc7379215b60c7020cb2b
2020-05-06 20:51:25 +02:00