Commit graph

590 commits

Author SHA1 Message Date
jenkins-bot 0f72ad8b05 Merge "[refactor] Finish decoupling search widget from InternalList" 2024-09-03 12:52:26 +00: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
jenkins-bot a9b8380bcb Merge "Helper function getAllGroupNames" 2024-07-30 12:30:14 +00:00
Adam Wight baedd6c44c Rename function to getIndexLabel to clarify that it's presentation
Bug: T370874
Change-Id: I2e00aca86d2a97f8dff11b742e010ef117b5522a
2024-07-30 12:05:25 +00:00
Adam Wight 06e7dda6a3 Helper function getAllGroupNames
Bug: T370874
Change-Id: I8d61b1ab428ab30e250c8dad05d1b97e15905ed5
2024-07-30 00:00:50 +02:00
jenkins-bot caee02b888 Merge "References always deal with original document" 2024-07-29 21:29:30 +00:00
jenkins-bot 014b0bcffb Merge "Test MWDocumentReferences on subref doc" 2024-07-29 21:29:29 +00:00
jenkins-bot 35b104e292 Merge "Move more editing methods to the EditPanel" 2024-07-29 13:52:07 +00:00
Adam Wight 3e2d060037 References always deal with original document
Singleton always steps up to the original document from fragments, to
give absolute numbering.

Bug: T370874
Change-Id: I0353649289f6c8fe26fa6bdff5d2367b7b575bac
2024-07-29 11:45:24 +02:00
Adam Wight c54000ed86 Test MWDocumentReferences on subref doc
Change-Id: I8fb9bee9f0f1447b38d6d67033c42c05934d1e12
2024-07-29 11:45:24 +02:00
WMDE-Fisch f9b9c7aa9b Add basic QUnit test for MWDocumentReferences
Change-Id: I40a62ceecc4ab5d0b4b6154bd934ccf4ae6a2774
2024-07-29 09:33:23 +02:00
WMDE-Fisch 8b60ead109 Move more editing methods to the EditPanel
Mainly leaving out the event handling for the change detection to
still keep it simple.

Also the data flow back for editing the content is still somewhat
opaque because the relevant data is passed by reference. I might
change that in follow up patches so it's more clear.

Bug: T369005
Change-Id: I93b62791ef10bf318697905af8a0c5b5d438fdb5
2024-07-26 17:45:23 +00:00
Adam Wight 257b3f3816 Switch reuse dialog to use shared numbering mechanism
This patch gives us the same number as will appear in the document,
even when subrefs are present.

Tests could be improved using sinon to check some call assertions
but should be fine for now.

Removed the test for placeholders, because these should be filtered
in MWDocumentReferences.getGroupRefsByParents()

Bug: T370874
Change-Id: I7543a6593308c529bcfbeb0835a7c0882cbf8621
2024-07-26 09:44:36 +02:00