Commit graph

601 commits

Author SHA1 Message Date
Adam Wight 6ea3a8c696 Try to always limit our document references to the current fragment
Reverses the previous logic which traversed up from a fragment to get
the full document's refs.  Much other code in VE isn't ready for this
behavior, for example we can see list-defined refs but not inline refs
defined outside of the fragment.

This patch will ensure that we're only looking at refs accessible from
the current fragment, and prevents caching on fragments because the
cache uses `persistentStorage`, which is shared between fragments and
their parent document.

Bug: T374068
Change-Id: Ia38098f8b3e5a9d24c2206e11edab37d60209225
2024-09-10 12:26:32 +02:00
jenkins-bot e26e726cb0 Merge "[refactor] Rewrite context as service" 2024-09-10 08:27:05 +00:00
jenkins-bot 6203ab3d13 Merge "VE include subref count in warning message" 2024-09-09 12:09:26 +00:00
jenkins-bot 25b71720a4 Merge "[refactor] Renaming some fields in SearchWidget for clarity" 2024-09-09 07:26:57 +00:00
mareikeheuer bdcbcc08f8 VE include subref count in warning message
Include subref count in warning messages in VE editPanel dialog and contextItem

Bug: T373023
Change-Id: Ie7d162c4a2291db441846ec338159e8955c206c2
2024-09-09 09:21:06 +02:00
WMDE-Fisch b5a41a62de [refactor] Renaming some fields in SearchWidget for clarity
Should be a no-op. I checked CodeSearch for other usages but seems
safe so far.

Bug: T370875
Change-Id: I4969e93308735f06be3e344616341c1284157c19
2024-09-09 09:03:11 +02:00
Adam Wight 8e4c83bfc6 [refactor] Rewrite context as service
Puts the ReferencePreviewsContext behind a service to improve
testability.

Bug: T363162
Change-Id: I63aa4144081a2625da1b89f4d56adb612741c8fc
2024-09-06 16:26:20 +02:00
jenkins-bot 2890772a9f Merge "Adding some QUnit tests for MWGroupReferences" 2024-09-04 11:46:11 +00:00
WMDE-Fisch f133ad3ead Adding some QUnit tests for MWGroupReferences
Bug: T373854
Change-Id: Ie1ea1016e6e67429b109989bc7995b6dd532f314
2024-09-03 17:00:01 +02:00
jenkins-bot 52dc522cca Merge "Streamlining the MWReferenceEditPanel QUnit test" 2024-09-03 13:19:54 +00:00
jenkins-bot 0f72ad8b05 Merge "[refactor] Finish decoupling search widget from InternalList" 2024-09-03 12:52:26 +00:00
WMDE-Fisch 1507354f93 Streamlining the MWReferenceEditPanel QUnit test
I could add some simplifications to reduce the complexity of the
tests a bit. I also fixed the test for the change handler. Seems
it did not work that way before.

Also some minor random doc fixes.

Change-Id: If1530a815ea126c38c3a55f3d52e3ca482059840
2024-09-03 14:50:51 +02:00
Adam Wight ab0f2ea000 [refactor] Finish decoupling search widget from InternalList
Bug: T370875
Change-Id: I6ed43ea3a5b25c2ef5afc373b5a2523a730fd11e
2024-09-03 12:12:01 +02:00
jenkins-bot 1116cfb9a9 Merge "Allow disabling the alternative backlink labels message" 2024-09-02 19:34:57 +00:00
WMDE-Fisch 31dcf2528e [refactor] Replace InternalList with DocumentReferences in ReferenceEditPanel
Change-Id: Icdb7b80f5ca4284fe77c4905b7a9c98659f9c2b4
2024-08-29 23:43:03 +02:00
jenkins-bot 1bae4d71c9 Merge "[refactor] Update some usages to new refs interface" 2024-08-29 12:23:14 +00:00
Adam Wight 633969300b [refactor] Update some usages to new refs interface
Change-Id: Idfffbe92ad1385e85b078bc4794a529c5f770eae
2024-08-29 13:21:48 +02:00
jenkins-bot 72056c5fd0 Merge "Make use of createNoOpMock in ReferenceListFormatterTest" 2024-08-29 10:21:44 +00:00
jenkins-bot 179e12f4ec Merge "[refactor] groupInput takes narrower parameters" 2024-08-28 08:09:55 +00:00
Adam Wight b69614fc82 [refactor] groupInput takes narrower parameters
Simple parameters hide knowledge and ease testing.

Change-Id: I9a8549199a1de07b437caf274c8d5e842183f570
2024-08-28 05:48:44 +00:00
jenkins-bot 6e6a7ebf2a Merge "Add parameters to Cite error messages in Parsoid" 2024-08-27 11:51:56 +00:00
Isabelle Hurbain-Palatin 3774c86a64 Add parameters to Cite error messages in Parsoid
The Parsoid error messages are missing a couple of parameters, according
to the json i18n files; this patch fixes that issue.

Change-Id: I4232c0b71ecc6d6f1220db3988e67d9cd4eb3d58
2024-08-27 12:01:30 +02:00
jenkins-bot 56ccdd0e48 Merge "Move existing ReferenceListFormatter code closer together" 2024-08-27 09:40:50 +00:00
jenkins-bot 9fb20ec09a Merge "Remove not needed int type from ReferenceListFormatter" 2024-08-27 09:37:49 +00:00
jenkins-bot e9d2aecb5f Merge "Moving ref group knowledge into a dedicated data structure" 2024-08-26 10:10:37 +00:00
Adam Wight 6e03d2cafa Moving ref group knowledge into a dedicated data structure
Pushes per-group knowledge down into a structured object and give it
an interface, separated from the singleton cache across all groups.

Also changes the behavior of orphaned subrefs so that they're still
rendered as subrefs, with an error placeholder where the parent
should be.

Bug: T372871
Change-Id: I84e679a8365f3fbfabaf344d99f56f6d069c0776
2024-08-26 09:26:15 +00:00
thiemowmde 205cc3ecd0 Rename parser tests to avoid "book referencing" terminology
I try to be as consistent as possible here and avoid mixing
terminology.

Bug: T373307
Change-Id: I309916028328a7b8c93334c933baab1ac2a0233d
2024-08-26 11:21:11 +02:00
Subramanya Sastry b3af8fdcfd Parsoid: Add newline after every reference list item
Updated known failures to include the new output for previously
failing tests.

Bug: T372889
Change-Id: I32b2a7cff144d74f646962bb28a83180e5446798
2024-08-23 14:31:33 +00:00
Adam Wight ce16e4a4cb Show error message in ref edit dialog for orphaned subref
Bug: T372871
Change-Id: I2b5c99f699ac4113f90b0b22913f1b7119d1d8ce
2024-08-22 17:27:51 +02:00
Adam Wight 3c4d198eaa Tighten up test mock
Caller can be more ignorant about what happens inside the mock.
Mostly, this patch is meant to prepare for an internal refactor,
minimizing test changes.

Bug: T372871
Change-Id: Ie08624fea4a89ce6a6f61d5430cf5b7eb95278fa
2024-08-21 15:22:06 +02:00
Adam Wight 99c4c9856a More robust and thorough numbering test
Check all refs, and only check outputs without coupling to class
internals.

Bug: T372871
Change-Id: I99187b09b0d93e1fb19fedf80a8e4fe64fe4e7ac
2024-08-21 15:19:32 +02:00
WMDE-Fisch 3af9dfdb71 Move event handler to the EditPanel class
Making sure that change events form the fields are handled in the
panel and forwarded to the dialog with the information needed.

Also slighly moving some calls in the setup process that inits
the dialog and removing some duplication. Calling focus on the
edit panel only makes sense in the ready step. Not during setup.

Bug: T369005
Change-Id: I4f9a022a06ec6543b106620eae030235b8f6712b
2024-08-13 15:53:24 +02:00
jenkins-bot e163f354a5 Merge "Add method to get the updated ref from the edit panel" 2024-08-13 13:22:15 +00:00
thiemowmde b223649f9d Move existing ReferenceListFormatter code closer together
This moves existing code around a little bit without changing
anything, as proven by the tests.

This is motivated by Iaca0e14.

Change-Id: I30366d32b07f87f238b045f0d7817686b5cc26bd
2024-08-13 12:42:02 +00:00
thiemowmde a4ffedbcc2 Remove not needed int type from ReferenceListFormatter
It's always a string anyway. Also improve the test coverage. The
localization was pretty much untested before.

Change-Id: Ie6f34c67ae7dd9559346eb45a2604e14c5633991
2024-08-13 10:46:52 +02:00
thiemowmde 3cebd437e8 Make use of createNoOpMock in ReferenceListFormatterTest
The main benefit is that this makes it more obvious what is actually
under test, and what's not.

This is mainly motivated by the ongoing work in Iaca0e14.

Change-Id: Icbf1b824ba1f5468dbdb30445134db2b568e19f8
2024-08-13 10:41:04 +02:00
Subramanya Sastry e66fedcfbe Fix typo in closing sup tag in parsoid html in a test
Change-Id: I06b827ed4b03216eaf73296739cb428eabe14aae
2024-08-12 16:23:36 -05:00
WMDE-Fisch 48d0699f09 Add method to get the updated ref from the edit panel
That's another step to separate the editing form the dialog. The dialog should not know about internals of the edit panel.

And eventually the dialog can get rid of the referenceModel property.

Bug: T369005
Change-Id: I9cf3a68ef58bc5791497af362c0572734e4bcadd
2024-08-12 18:00:32 +00:00
jenkins-bot d847caf5b8 Merge "Hide main ref warning on orphan refs" 2024-08-12 13:34:09 +00:00
thiemowmde d885a0c6b5 Allow disabling the alternative backlink labels message
The message cite_references_link_many_format_backlink_labels contains
e.g. "a b c …" and so on, to be used as alternative backlink labels
when a single reference is re-used multiple times. The default numeric
rendering is "1.1 1.2 …" and so on.

The two labels end in the message cite_references_link_many_format as
parameters $2 and $3. But only one of the two parameters is ever used.
By default the alternative label in $3 is unused.

This implies that everything about these alternative backlink labels
including the error message is effectively dead code most of the time,
never to be seen on the majority of wikis.

This change makes it possible to disable the message without breaking
anything. Instead the code will silently fallback to the default
behavior of showing the numeric label. This is much more efficient
than rendering possibly hundreds of error messages that never show
up anyhere. The same optimization is already done for the extremely
similar cite_link_label_group-… messages, see
FootnoteMarkFormatter::fetchCustomizedLinkLabel.

This is also partly motivated by T335129 as well as T321217.

Change-Id: Iab818d7db7eddaf7091234f6a22a18cdff70f8e8
2024-08-12 13:36:20 +02:00
jenkins-bot d056400800 Merge "Simplify ErrorReporter mocks in tests" 2024-08-12 09:17:19 +00:00
jenkins-bot 4d231c347c Merge "Fix incomplete test setup now that ref items are objects" 2024-08-12 09:02:25 +00:00
jenkins-bot 7955321a2f Merge "Remove unused test setup from ReferenceListFormatterTest" 2024-08-12 09:02:24 +00:00
thiemowmde fb8494b4dd Relax support for error/warning message keys with dashes
This is a direct follow up for I6f05842 where we already started
supporting dashes, but converted them to underscores. The only change
in this patch is that the CSS class will use the message key as it
is, without the dashes being converted to underscores. I added a test
case specifically for this.

Bug: T352676
Change-Id: Ic22e897c27b8371e3b1ed63932b619e7af71bd5c
2024-08-09 12:29:34 +00:00
thiemowmde f3b732bf93 Simplify ErrorReporter mocks in tests
In some tests we want to see the message parameters. But not here.
Simply echoing the message key (thats parameter number one) is
enough.

Change-Id: Id9824cbbe944c84c9fd1932b0863ac1b3f232b75
2024-08-07 18:22:59 +00:00
thiemowmde e078155e94 Remove unused test setup from ReferenceListFormatterTest
I think this was just a mistake in I5457304 when this test was
written. There was never an ->exists() call in the code, as far as
I can see.

This is motivated by our ongoing, probably year-long efforts to
clean this codebase up, see T335129.

Change-Id: I72d89213c5cff06d78ac119b3c79827afbd0b4f5
2024-08-05 16:25:03 +02:00
WMDE-Fisch 3d0a88c384 Hide main ref warning on orphan refs
Also adding tests.

Bug: T369005
Change-Id: Icb3deaf0c8e14e34bd05455590bd9680a7a5adec
2024-08-02 15:33:44 +02:00
Adam Wight 4328a8c9bd Test orphaned subrefs
Change-Id: If3091b5a7e1ac382d95691bade0cfff2d418d270
2024-08-02 08:18:33 +02:00
jenkins-bot 6c508d0c95 Merge "Reading mode square brackets become customizable through CSS" 2024-08-01 12:37:52 +00:00
jenkins-bot 8ef86b2f0f Merge "Rename function to getIndexLabel to clarify that it's presentation" 2024-08-01 06:33:30 +00:00