Commit graph

2465 commits

Author SHA1 Message Date
Translation updater bot 22acd9a29c Localisation updates from https://translatewiki.net.
Change-Id: Icc162281f1ddec0369b8447b3c10f0cd84df4205
2018-12-18 22:48:09 +01:00
Kunal Mehta 0395035789 build: Set "root": true, in .eslintrc.json
This ensures that each repository's "npm test" command is fully
independent of wherever it might be in the filesystem.

Bug: T206485
Change-Id: I54d052bed4ceed175a938896154fd6ad5c89f964
2018-12-18 10:47:31 +00:00
Translation updater bot cfb8412e11 Localisation updates from https://translatewiki.net.
Change-Id: I3f4d7fd126b48e103bce03b104db51edcccbd569
2018-12-15 22:23:48 +01:00
Translation updater bot 87c2b3ded4 Localisation updates from https://translatewiki.net.
Change-Id: Ia71b6012942934a135547e787ad9c74ae37f7563
2018-12-14 22:21:37 +01:00
jenkins-bot 4eef765808 Merge "Restructure highlighting code for improved readability" 2018-12-13 00:04:21 +00:00
Translation updater bot 0dca8d7428 Localisation updates from https://translatewiki.net.
Change-Id: Ieea1e84f17cf47832f8c83dcd802b94293ace8ee
2018-12-12 22:18:26 +01:00
Translation updater bot 075d391ace Localisation updates from https://translatewiki.net.
Change-Id: I84b3d49b0e3c7cb7edeb62096427e6c3bc13cedb
2018-12-11 22:39:36 +01:00
Thiemo Kreuz 3f22189998 Fix <ref> ignoring all parameters when there are more than two
We can resolve this bug by either replacing the bogus "return false"
with the intended "return [ false, … ]". Or rely on the code a few
lines below that also bails out with a "return [ false, … ]" when to
many parameters ($cnt is not 0 then) are present. The tests prove both
solutions are equally valid.

Bug: T211576
Change-Id: Iadd55c134dede7042cfd152c69bc8f27b59d8912
2018-12-11 20:49:40 +01:00
jenkins-bot b9783b1d17 Merge "Rewrite private Cite::refArg for readability" 2018-12-11 18:43:49 +00:00
jenkins-bot 1ee256aa76 Merge "Add "twice" instead of "2 times" in an English message" 2018-12-11 17:32:45 +00:00
Thiemo Kreuz (WMDE) 06b821a451 Rewrite private Cite::refArg for readability
The biggest issue with this code was that it was tracking the exact
same state in two ways: Processed array elements got removed from the
$argv array, *and* the $cnt was decremented the same time. This is not
necessary and a potential source of confusion and errors.

I carefully transformed the code. I'm sure it still does exactly what
it did before. The tests should prove this.

Change-Id: I642d38e7944aa3e2239179fa58e1e231b4698263
2018-12-11 17:58:19 +01:00
Thiemo Kreuz e32a76061c Restructure highlighting code for improved readability
This gives the code a little more structure without changing anything
it does. A section is extracted as a named function, and some lines
are moved and bundled where it made sense.

Change-Id: I51909517021bee9dc618efe5fbe40adfc29dc6af
2018-12-11 15:19:17 +01:00
jenkins-bot 9e981d28b6 Merge "Sanitize underscores as core does, to not create broken links" 2018-12-11 00:01:57 +00:00
jenkins-bot c4dc31b89e Merge "Add missing test cases for code in Cite::refArg" 2018-12-10 18:18:00 +00:00
Thiemo Kreuz 9a8c718c2a Add missing test cases for code in Cite::refArg
This is split from I642d38e and does nothing but adding test cases
that document the current (broken) behavior.

Bug: T211576
Change-Id: Iee313d26e7bed6deb34101e37736a1c697947905
2018-12-10 12:54:58 +01:00
Volker E b9ee8433f4 build: Update 'stylelint-config-wikimedia' to v0.5.0 and make pass
Change-Id: I05e257b3213dd4039455d7e55efeb72b58da67fb
2018-12-10 02:59:11 -08:00
Amir Aharoni af28eed881 Add "twice" instead of "2 times" in an English message
Change-Id: I53de963d71015dfd26692241b2a0ea5630be080c
2018-12-10 08:52:36 +02:00
Translation updater bot 626d8a75df Localisation updates from https://translatewiki.net.
Change-Id: I5a8df261ae60ded18ca4709af624aa4fa4bc4a72
2018-12-09 22:38:53 +01:00
Translation updater bot 004426b354 Localisation updates from https://translatewiki.net.
Change-Id: Ia52c3a211395f620147f63b9fae7f1781bb52719
2018-12-05 22:30:13 +01:00
Translation updater bot ad5fd43df9 Localisation updates from https://translatewiki.net.
Change-Id: Iafe3fa40062305c4dd0d8353bbe05896cb2f15e5
2018-12-03 22:35:12 +01:00
Translation updater bot 7a969c2dbc Localisation updates from https://translatewiki.net.
Change-Id: Ibe63f4543e5bacb89808be7f04d76ce2f76bcb06
2018-12-02 22:14:54 +01:00
Translation updater bot af9e6cb510 Localisation updates from https://translatewiki.net.
Change-Id: I8e590da0866f6ba21c58073ea436194e4539b2e8
2018-12-01 22:17:29 +01:00
jenkins-bot c6e13db74f Merge "Simplify weirdly complex [\n\t ] regex" 2018-11-30 23:50:55 +00:00
jenkins-bot 7ac91bef82 Merge "ve.ui.MWCitationDialog: Remove unneeded code re-setting insert label" 2018-11-30 22:42:44 +00:00
Translation updater bot 519157719b Localisation updates from https://translatewiki.net.
Change-Id: Iad5a14d487e2561133c7f9d0684de1955c247ee9
2018-11-30 22:49:44 +01:00
jenkins-bot e7b3167b31 Merge "Split overly long highlighting code into functions" 2018-11-30 15:00:09 +00:00
jenkins-bot 8ae3b13d1a Merge "Get rid of one nesting level in highlighting code" 2018-11-30 14:58:49 +00:00
jenkins-bot e353d36f3a Merge "Make backlink highlighting robust when "mw-cite-backlink" is missing" 2018-11-30 14:58:46 +00:00
Thiemo Kreuz 4d03f8f17f Split overly long highlighting code into functions
Change-Id: I055c21ee2202afea4751dd74fa389c55fdd30acf
2018-11-30 15:03:02 +01:00
Thiemo Kreuz 9ce4b959bc Get rid of one nesting level in highlighting code
The code before was not wrong, just deeply nested. The worst case was
that the final $upArrowLink.attr( … ) might have been called on zero
elements. jQuery is fine with this.

Change-Id: I62e7286c7fe906544fe148e1122c60cc8db070f3
2018-11-30 14:49:27 +01:00
Bartosz Dziewoński b7bdcaeccc ve.ui.MWCitationDialog: Remove unneeded code re-setting insert label
This sets the label to be the same as the default value inherited from
ve.ui.MWTemplateDialog. Looks like it's no longer needed since change
Ia8fb88d3501ffa2c26add4419da5463a926f45d1 in VE-MW (2014).

Change-Id: Icd64d22aef29a3791352e1839993ea8462a147f3
2018-11-29 23:09:23 +01:00
Translation updater bot c31c93f619 Localisation updates from https://translatewiki.net.
Change-Id: I58dfd99dd04e0d78298df7ad51286ba252019142
2018-11-29 22:26:44 +01:00
Bartosz Dziewoński 7f6ae77b3c ve.ui.MWCitationDialog: Fix condition for enabling insert/apply action
The method #hasUsefulParameter has been accidentally made to always
return false in fdde5b71af.

Bug: T210686
Change-Id: I215924c2f693842abd8026404d17c725192272c3
2018-11-29 04:02:44 +00:00
James D. Forrester 57aeb852ae eslint: Drop 'dot-notation' rule
Bug: T210552
Change-Id: Ia6bacf9aacd0167317cbd7d8348be1c2005b6562
2018-11-28 10:27:44 -08:00
Thiemo Kreuz 4152c6cdf4 Make backlink highlighting robust when "mw-cite-backlink" is missing
The class="mw-cite-backlink" is part of a message. It should be
considered code and not be customized, but can be. Frwiki for example
localized it.

The new code still hopes to find the class, and still hopes the first
child is the text node containing the plain text up arrow. (See the
message "cite_references_link_many" which contains all this.) This code
path is kept because it is more performant.

If the class is not found, the upwards traversal done via .closest()
stops at the <li>. It then traverses down into the firstChild nodes,
hoping to find the plain text up arrow this way.

This patch makes the code work with the customizations found in frwiki.

Bug: T205270
Bug: T210508
Change-Id: I32552ebe820ee12aea1a75aa17af11298dc7536a
2018-11-28 12:35:05 +01:00
jenkins-bot c88275c8d5 Merge "Make backlink highlighting robust for community customized HTML" 2018-11-28 11:34:32 +00:00
Thiemo Kreuz d7c1943b04 Make backlink highlighting robust for community customized HTML
This change makes the code much, much more robust. See, almost all HTML
relevant for this feature is encoded in messages. This allows unexpected
customizations that add additional HTML elements, change the order of DOM
elements, even remove class names and elements.

The <ol class="references"> is the only HTML snippet generated via code,
guaranteed to be there, and used as an entry point because of this.

Instead of the selector utilizing a "*" to detect references with "one"
vs. "many" backlinks, we check if a second backlink exists.

The .first() copies the browsers behavior to only respect the first anchor
in case an id="…" appears multiple times on a page.

The additional .length check further down is a missing sanity check,
currently relevant on frwiki where the expected class="mw-cite-backlink"
got localized.

Bug: T205270
Bug: T210520
Change-Id: Iba9aebfd01508b283933964cfb986d7239d4cf38
2018-11-28 11:56:27 +01:00
Ed Sanders fdde5b71af Update eslint-config-wikimedia to 0.9.0
Change-Id: I7883af1f56c7f2f3eeff1f7a51b640a303bcab78
2018-11-27 22:23:57 +00:00
Translation updater bot 8991801975 Localisation updates from https://translatewiki.net.
Change-Id: If5195d61ed2642c4182de62f4ef12bc8b33a893c
2018-11-27 22:14:30 +01:00
WMDE-Fisch 6dda36a1e7 Improve a11y support on backlinks
This changes the a11y support on the main backlinks by introducing the usage
of title and aria-labels. The support for these elements increased a lot since
the topic was first tackled and seems the appropriate way to go.

A new message was introduced for the link that will be set when directly
coming from a clicked refrence to emphasize that the can jump back to where
he came from.

Bug: T206323
Change-Id: Ifa56d41bcdb8100e19f29619796b62bb3c886d2f
2018-11-26 11:36:26 +01:00
Translation updater bot 0f3961df4e Localisation updates from https://translatewiki.net.
Change-Id: I703db0a48870ec600f2596bef7538b27f12ee569
2018-11-25 22:33:45 +01:00
Thiemo Kreuz (WMDE) 8760fe5e62 Rearrange Cite::listToText for performance
The two message are not needed in case there is only one element.
Since fetching messages is a little expensive, I feel it's worth
rearranging this code.

Or not, because it seems this method is never called with one
element only.

Change-Id: Ie915278b41f053afe0d14a29d2aec54c98e5185e
2018-11-21 18:16:55 +00:00
jenkins-bot 1fe6947693 Merge "Use \d shortcut in regular expressions" 2018-11-21 18:13:00 +00:00
jenkins-bot 7c7f258aac Merge "Remove unused parameter from two private Cite functions" 2018-11-21 18:03:30 +00:00
Thiemo Kreuz (WMDE) 436453e758 Use \d shortcut in regular expressions
This does not change anything, but is only for readability.

Change-Id: I7970df426246c16f5418665c9af069c13e0b9933
2018-11-21 17:59:42 +00:00
jenkins-bot ea5c84fdaf Merge "Use more specific type hints in PHPDoc tags" 2018-11-21 17:44:55 +00:00
Thiemo Kreuz (WMDE) 7c06347fc7 Simplify weirdly complex [\n\t ] regex
This change does have two consequences:

1. A few more whitespace characters act as separators. This should not
have any consequence in real life situations, and is mainly done to
make the code easier to read and less surprising.

2. Sequences of two or more whitespace characters previously resulted
in partly *empty* results. This was a potential source of errors. The
additional + fixes this.

Change-Id: Ib58326109c740dd0cbd05d8fddb4af2145f232fe
2018-11-21 17:33:25 +00:00
Thiemo Kreuz (WMDE) 0f76d79169 Use more specific type hints in PHPDoc tags
Change-Id: Ib0cf532fa51ddce135914edf357638a0862a200f
2018-11-21 18:19:25 +01:00
jenkins-bot 1bc1d1e075 Merge "Prefer "=== null" for consistency and readability" 2018-11-21 02:41:18 +00:00
jenkins-bot fd956ab507 Merge "ve.ui.MWReferencesListDialog: Disable 'Apply' button until changes are made" 2018-11-20 15:54:57 +00:00