Commit graph

879 commits

Author SHA1 Message Date
Roan Kattouw
5ce1e2b743 Linker: Use parentheses by default in userToolLinksRedContribs()
This function had been changed to unconditionally disable parentheses,
but none of its callers load the CSS needed to make that work.

Bug: T220767
Change-Id: I566d65e155258d3bd1a1a06bca9aa2b3a2d417ee
Follows-Up: I6eeeaa3b58d37adb7fefb4cc6915022229b3b324
2019-04-19 15:09:36 -07:00
Aryeh Gregor
b6e1e99bec Use LinkTarget in Linker instead of Title
Bug: T214318
Change-Id: I60b6208fa5b45a568e81f908a19cd0f244ef79be
2019-04-15 17:15:05 +03:00
jdlrobson
5040b3f680 RecentChanges updated to use pseudo elements for presentation
Bug: T219348
Change-Id: I6eeeaa3b58d37adb7fefb4cc6915022229b3b324
2019-04-02 14:52:50 -07:00
jenkins-bot
a3ab671e61 Merge "Remove temporary rollback confirmation toggle" 2019-03-28 09:28:12 +00:00
jdlrobson
064dd53b28 Consistently use classes for deleted items in lists of diffs
Even if a revision has been deleted and the history-deleted class is
being used, the original class for its corresponding element when
not deleted should be applied. This is important as it allows skins
to skin consistently. "history-deleted" is a modifier class - it provides
further information on the original meaning.

This blocks styling the history page from core in Minerva skin

Bug: T216420
Change-Id: Ia659606838d7e38bc09054e36cd980b00f5e6da9
2019-03-26 23:04:51 +00:00
Tim Eulitz
8736acada9 Remove temporary rollback confirmation toggle
This patch removes the temporary rollback confirmation toggle that was
implemented to allow certain wikis to disable the rollback confirmation
feature while still showing the option in the user preferences.

For reference:

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/494249

Bug: T217437
Change-Id: I001d7927f6f44a4cc517a80b71f5b83aca33824c
2019-03-26 10:13:45 +01:00
jdlrobson
063cce733e History page is now using pseudo elements for presentation
|, ( and ) separators are now added via CSS rather than being
made part of the HTML.

Bug: T205581
Change-Id: I272770418ee544b22f8f94312daf07010b7a2273
2019-03-26 00:15:21 +00:00
Thiemo Kreuz
9314453c93 Make use of the list() feature where it makes sense
This code is functionally identical, but less error prone (not so easy
to forget or mix these numerical indexes).

This patch happens to touch the Parser, which might be a bit scary. We
can remove this file from this patch if you prefer.

Change-Id: I8cbe3a9a6725d1c42b86e67678c1af15fbc5961a
2019-03-24 20:12:23 +00:00
Gabriel Birke
0707fd500f Remove i18n parameters
Since the confirmation message can no longer show the edit count, remove
the data attribute that contains it.

Also make the selector for the confirmation more specific.

This is a followup for change 498096

Bug: T218354
Change-Id: I08dd75d3b161d7869357e486b25693dde635eb14
2019-03-22 11:18:38 +00:00
Tim Eulitz
c4e5364ea0 Implement temporary rollback confirmation toggle
This change implements a temporary feature toggle for the rollback
confirmation change. The main purpose is to allow users of certain wikis
(de-wiki, pl-wiki, for example) to turn off this upcoming feature before
it is released to production.

Bug: T217039
Change-Id: I6ed59afde5b75756053da3ae46858304dda9317d
2019-03-21 14:21:13 +01:00
jenkins-bot
4eea7de733 Merge "Implement non-JS RollbackAction with form" 2019-03-21 12:00:23 +00:00
Tim Eulitz
0a84032711 Implement non-JS RollbackAction with form
This change prepares a form for the RollbackAction to allow rollbacks to
be triggered via POST while also ensuring users are always prompted with
a request to confirm the rollback if the rollback confirmation prompt is
enabled.

Bug: T215303

Change-Id: Iaf7e095b3bb34072eea6bcac76ba29358b14cc09
2019-03-21 12:16:44 +01:00
tzhelyazkova
7dc340656e Count number of usages for Rollback Confirmation Prompt
Bug: T215796
Change-Id: If8536955f4988440af053525ec9d761d4a60794c
2019-03-21 10:57:18 +00:00
Tim Eulitz
341320457c Show confirmation prompt on rollback links
Bug: T215020
Change-Id: Ic831888e30808a20a04397912498fe2ca04f80ba
2019-03-21 10:13:22 +00:00
jenkins-bot
2b14cc0096 Merge "Linker: Use RequestContext::getMain()->getLanguage() instead of $wgLang" 2019-03-11 18:30:56 +00:00
Brian Wolff
0364f852a3 Various fixes to make phan-taint-check happier
Bug: T216348
Change-Id: If4071e689f476d2138d8964598c5a02b09448677
2019-03-04 03:24:44 +00:00
jenkins-bot
12a9cf3110 Merge "Linker: Remove some else statements, and unnecessary temporary variables" 2019-02-11 00:43:31 +00:00
Reedy
50da4f3be1 Linker: Remove some else statements, and unnecessary temporary variables
Change-Id: I9b9383459edf06280135d9709da889fc5a688c98
2019-02-11 00:28:24 +00:00
James D. Forrester
8d47f53687 Drop Linker::formatTemplates, deprecated in 1.28 and unused
Change-Id: I02e677021cdc1fc7ac6da4839a23b15afcfb2296
2019-02-08 17:43:33 -08:00
James D. Forrester
17c84a62c2 Drop Linker::formatSize, deprecated in 1.28 and unused
Change-Id: Id119e9f3ff0d27b59654876bad9212cc0f3c5a2d
2019-02-08 17:43:33 -08:00
Fomafix
ebd1016e5a Linker: Simplify return paths
* Avoid else after return.
* Use early-return pattern.

Change-Id: I059e233d019dbc2233756776dfa09f8f2fdb2df7
2019-01-17 12:25:39 +01:00
jdlrobson
c6a96b4bd5 Separate content parts of mw-usertoollinks from presentation
Use the existing class mw-changeslist-links to visually separate
the user tools in CSS rather than in the HTML.

Bug: T205581
Change-Id: I024c8298ca5da753d96ec392be05d4530bb3ffa9
2019-01-09 00:56:40 +00:00
Fomafix
cf568ba823 Linker: Use RequestContext::getMain()->getLanguage() instead of $wgLang
$wgLang can be an StubUserLang object. This change allows to force a
Language object.

Change-Id: I93c79b985a2ee49648c678844eef189126a4d765
2018-12-21 17:41:30 +01:00
Fomafix
dffbbdbe39 Linker: Deprecate non-Language types for $lang of tocList() and generateTOC()
$lang still defaults to $wgLang on unset parameter.

Change-Id: I15b65fec987641885374dfef9e1229ea405f7c30
2018-12-21 17:41:30 +01:00
jenkins-bot
bd78869618 Merge "No yoda conditions" 2018-12-09 01:34:23 +00:00
Kunal Mehta
1706d353ae Don't link wikilinks in section heading autocomments
Previously, a manually constructed autocomment in the form of
/* [[Some link]] */

would create a link to the the section, and then the "Some link" page.

After T165189 was implemented, the entire autocomment is now a link to
the section, so we're creating links inside of a link...which is
problematic. In most contexts (history and watchlist particularly), the
section link is more important than the title in the section heading, so
that's what we'll favor here.

It's worth noting that this situation is a manually created edge case.
Even if the section heading is a wikilink, the edit summary will
autofill a section autocomment without the double brackets.

We'll now render the double brackets ([[...]]) and not link them. This
is what the user literally typed, and matches the existing practice of
rendering templates in section headings with their literal syntax. And
as a bonus, it's still possible for user scripts such as wikEdDiff to
turn the rendered double brackets into a real link if users want.

Bug: T165189
Change-Id: Ib10679edd76c72a60d7e1c89fc8454166e34c463
2018-12-03 12:43:03 -08:00
Kunal Mehta
0c9cf24b05 Restore old HTML structure for history section links
A follow-up to 0a8e16d7cf thanks to Anomie's code review.

The section title is now inside <span dir="auto"> and <span
class="autocomment">, as before. $wgLang->getDirMark() between the arrow
and the text was restored.

Given the comment
 /* External links */ removed bogus entries
the HTML before 0a8e16d7cf looked like:
 <a href="#External_links">→</a>‎<span dir="auto"><span
 class="autocomment">External links: </span> removed bogus entries</span>
after this change, it will look like:
 <span dir="auto"><span class="autocomment"><a
 href="#External_links">→‎External links</a>: </span> removed bogus
 entries</span>

The issue of having links be inside other links will be addressed in a
separate patch.

Bug: T165189
Change-Id: I31d87a87ccaf50de58fdd0621c46133b2881b490
2018-12-03 12:42:56 -08:00
Bjornskjald
0a8e16d7cf Make "→" link to page section on History page larger by adding section name to it
Bug: T165189
Change-Id: I1f845592bd3de342fda84b60fc412055973950fd
2018-11-24 03:22:16 +00:00
jdlrobson
8f694424bd Differentiate comments with and without brackets
Per T205581#4768548 cached HTML might render a comment with
double brackets in the text. The CSS selector should not apply
there so a new class is used.

Using a BEM convention for the time being. This class can be
removed in future if needed.

Bug: T205581
Change-Id: If1552d6ddd4729b8beca45a1ca19ec6ce36e6118
2018-11-22 11:46:37 -08:00
jdlrobson
a7b8043cc3 Remove hardcoded parentheticals from ChangesList "comments"
From now on, the edit summary in ContribsPager results
will be wrapped in brackets via CSS pseudo elements.

Changes:
* Linker::revComment and Linker::commentBlock now accept a parameter which
can be used to disable wrapping in the text
* ContribsPager makes use of it

Bug: T205581
Change-Id: I60403a4a23d89107b7a28f0c12326d828a76614e
2018-11-21 20:15:06 +00:00
Fomafix
3ee1560232 No yoda conditions
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
2018-11-21 17:54:39 +01:00
Max Semenik
c16704c33a Display SVGs in target language
Previously, they were always displayed in defult language unless
forced explicitly in wikitext, e.g. [[File:Foo.svg|lang=ru]].
This change adds a feature flag that would enable always trying to
display in page language.

* If enabled, Parser will pass a new parameter - 'pagelang' - to
  the media handler.
* SvgHandler uses page language when determining what language to
  render the image in.
* 'pagelang' can always be overridden by 'lang'.
* If no translation in page language is available, the default
  language (English) will be used for thumbnail URLs, to prevent
  cluttering media storage and HTTP caches with useless copies.

Performance: this requires accessing image's metadata during parsing.
My testing indicates there were no code path where this wasn't the
case already, so no performance hit is expected, however we should
still keep an eye on page save performance.

Bug: T205040
Change-Id: I348840ef405e1370cc0c17d69051bce30153c9c0
2018-10-30 16:12:11 -07:00
Roan Kattouw
39e2e85a44 Linker: Document parseComment() as returning HTML
It's not entirely clear from the documentation whether this method
returns wikitext or HTML, so make it explicit.

Change-Id: I094e370e921c43dd8c5dc4376b3dddd803665d90
2018-10-12 15:18:03 -07:00
jenkins-bot
2311183aa0 Merge "Linker: Remove outdated comment" 2018-09-08 01:35:49 +00:00
Thiemo Kreuz (WMDE)
2c58fbaa29 Linker: more consistent whitespace parsing in formatLinksInComment
Try to paste and preview this in the wikitext as well as the summary
line: [[:a]] [[ :a]]

The wikitext will show "a a", but the summary line will show "a :a".
This is only a display issue, all 4 links correctly link to the
article [[A]].

Change-Id: I08253a6d0b55b9aa3eace519bbdc1a456400bf84
2018-09-06 17:19:32 +00:00
Bartosz Dziewoński
f08f6fcbc2 Linker: Remove outdated comment
This talks about references and values the way they worked in PHP 4.
Comment was added in r4927 (b025ad54) in 2004.

Change-Id: I58a74219665bed9e804d7c01f271fd96fd889072
2018-09-05 16:41:40 +02:00
Brian Wolff
5f577437e8 Change @return-taint to use onlysafefor_html instad of escapes_html
This prevents some double escaped warnings. Requires
I2f4e33656b9f94 to be effective. Follow up faf2e14517.

Change-Id: I255c96592f3baff2df34e07c81510c8874908e28
Bug: T202797
2018-08-31 09:48:30 +00:00
Kunal Mehta
faf2e14517 Linker: Add @return-taint for formatLinksInComment()
Works around a false positive in the phan-taint-check-plugin.

Bug: T202797
Change-Id: If7c9e729ca7624b3f791fe01d0b768791657277b
2018-08-29 22:22:24 -07:00
jenkins-bot
4e021bb8d4 Merge "Paranoia, escape image alignment parameters before outputting." 2018-08-27 19:10:41 +00:00
Aryeh Gregor
e68fdb4065 Mass conversion to SpecialPageFactory service
Change-Id: Ia6e1e819ec6cbe8bf75b820109f51d47863e31fc
2018-08-17 12:03:12 -07:00
Brian Wolff
d370c51df1 Paranoia, escape image alignment parameters before outputting.
The alignment parameter is totally safe (See the very convoluted
code in the parser) but its best practise to escape things right
before the output. Additionally this protects in case any extension
uses a hook to do anything silly.

Change-Id: Ie19b106409d55c704b69280e2d0e2bb29068bd2e
2018-08-13 23:30:50 +00:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Bartosz Dziewoński
6e09d07b20 Set role=button on TOC show/hide checkbox
This should give more intuitive hints in assistive technology,
identical (or similar) to the hints for the JavaScript-generated
button we had before 68527cf479.
See results of testing with Windows Narrator/VoiceOver: T195053#4428563.

Bug: T195053
Change-Id: I9358b29f56ac1e43e9c5ed00d30ce6ffdf903299
2018-07-16 18:15:48 +00:00
Arlo Breault
ce9f5c2546 Put <dt>/<dd>/<li> in the always-suppressing category of doBlockLevels
This is a clarification of what already happens in practice for lists
generated from wikitext syntax, since that parsing happens
simultaneously.

Parsoid, for its part, does list handling prior to paragraph wrapping,
so must make use of these definitions.

Further, this helps reduce paragraph wrapping in interstitial spacing of
lists from HTML syntax, as spec'd in the tests, though the possibility
isn't eliminated entirely.

The TOC generation code is altered to reduce the number of newlines
emitted in between list items, since those are now left intact.

Change-Id: I6888b6e8e6768b0737565b87924fefa5a06ebd18
2018-07-13 12:40:49 -04:00
jenkins-bot
56d45558b1 Merge "Hide TOC with CSS instead of JavaScript" 2018-07-11 20:36:22 +00:00
Fomafix
68527cf479 Hide TOC with CSS instead of JavaScript
Changes in the behavior:
* The toggle button generate no FOUC on loading.
* On keyboard navigation the toggle key is the space key and not the
  return key.
* Animation on hide and show is missing. Maybe a new animation with CSS
  can added.
* The state of the button is not saved in a cookie.
* Self-build TOCs can not get hidden.

Browser support:
* The new implementation does not need JavaScript and therefor it works
  on browser with disabled JavaScript and on Grade C browser.
* The new implementation requires the CSS pseudo-class selector
  :checked. Therefor IE8 and lower are not supported.

Risks:
* The new implementation needs additional HTML elements. These elements
  also get cached and crawled. The elements have no content so they get
  hopefully ignored by crawler.
* The new CSS code imitates some styles (link, focus). This must kept
  up to date.
* Multiple TOCs on one page would generate the same id attribute.
  This can avoided by appending a counter or better and easier a random
  string to the id attribute.

Bug: T195053
Change-Id: I82db33d656b3795d7134a91d20ed9d93a3471086
2018-07-09 08:07:52 +02:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
jenkins-bot
c451267578 Merge "Pass $parser, &$query and &$widthOption to the 'ImageBeforeProduceHTML' hook" 2018-06-13 15:31:01 +00:00
Kunal Mehta
03e7ae45bc Remove deprecated Linker::getLinkColour()
Change-Id: I1818d9eb369c620cc436c13446a5362816e8362d
2018-06-13 01:30:04 -07:00
Jack Phoenix
088c6db48b Pass $parser, &$query and &$widthOption to the 'ImageBeforeProduceHTML' hook
This allows extensions to essentially reimplement Linker#makeImageLink
completely. Before this wasn't 100% possible as these three are needed for
that.

Inspired by wikiHow's core hacks to /includes/Linker.php, which can now be
moved to an ImageBeforeProduceHTML hook subscriber. wikiHow uses those
changes together with the WikihowArticle extension to heavily modify the
article DOM for various extensions and the default skin.

Change-Id: I8b5ab42d9cf021d66b90d15be68a0239643c10e3
2018-06-10 18:31:56 +03:00