Commit graph

1133 commits

Author SHA1 Message Date
Timo Tijhof 7d9c268ffd pygments.linenumbers: Avoid deep jQuery loops on unrelated interactions
Follows-up 42c97fa (I82ed4ade), 63c5943a9 (Ic71346196).

This commit makes no functional changes, but it reduces overhead
from the SyntaxHighlight code when interacting with other features,
such as elaborate modals or other hashchange-heavy code paths that
a gadget might produce.

It uses vanilla DOM instead of jQuery where possible, and adds an
early return rather than fairly deep continuation no-ops.

Change-Id: I2264f6f398193802f05c738bad4c294da007fb27
2021-02-19 03:43:24 +00:00
Prod c9892df300 Update pygments to 2.8.0
Changes:
  <https://github.com/pygments/pygments/blob/2.8.0/CHANGES#L10-L150>

The 2.8.0 release contains fixes to existing lexers, as well as the
following new lexers:
  amdgpu, cddl, futhark, graphviz/dot, markdown

Bug: T274741
Change-Id: I84c32591a06aac5e1afe46dab1f80bb53d981bb3
2021-02-18 16:12:33 +00:00
Timo Tijhof fa20f69cf4 SyntaxHighlightVisualEditorModule: Use Context::encodeJson() instead
Also fixes the Phan warning about Xml::encodeJsCall/FormatJson
needing booleaen where int inDebugMode() is passed.

Change-Id: Id8de16ab683948eae096b43462118ea837f53038
2021-02-18 05:07:32 +00:00
jenkins-bot 123f8677fc Merge "Move default CSS/JS model mapping out of extension.json" 2021-02-12 15:01:44 +00:00
Kunal Mehta 9bdf728fc1 Move default CSS/JS model mapping out of extension.json
These are for MediaWiki core models, so it seems reasonable to specify
them in the PHP source.

Change-Id: Iab6f9969d2bf72122b2661e139aa21a3475a92a8
2021-02-10 23:54:21 -08:00
Translation updater bot 3846eca370 Localisation updates from https://translatewiki.net.
Change-Id: I0919e0cb253bd11c98e2bece0850d24f688a55dc
2021-02-11 08:40:14 +01:00
Translation updater bot 8e1a5f0edd Localisation updates from https://translatewiki.net.
Change-Id: I2650cb0ab73e6bdc5e7868426a51715c7f40d6a5
2021-02-08 08:45:14 +01:00
Translation updater bot adb912bb3a Localisation updates from https://translatewiki.net.
Change-Id: Ia6c67aa649a6df170a388646fb5ec12fb4ef4120
2021-02-01 08:48:50 +01:00
libraryupgrader c7600c3f40 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 34.0.0 → 35.0.0
* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.18.1

Additional changes:
* Added the "composer phan" command to conveniently run phan.

Change-Id: Ie7649408030682fccc0c0f0251359246bc06a986
2021-01-30 14:48:22 +00:00
Translation updater bot 4faed53640 Localisation updates from https://translatewiki.net.
Change-Id: I2a69442ac8f1923a3f17861336365af8bc3b46c8
2021-01-27 08:35:29 +01:00
jenkins-bot fc0ded34e1 Merge "Avoid console warning when hash is empty" 2021-01-25 22:54:36 +00:00
Ed Sanders 42c97fa448 Avoid console warning when hash is empty
Bug: T272844
Change-Id: I82ed4ade24ed9e61e654cc7ea1ce19c7607086e1
2021-01-25 22:30:48 +00:00
Ed Sanders 173491fa6f VE: Fix highlight of block syntax next to floats
Bug: T272864
Change-Id: Ifb8a36bb0f7fee93711c07ebc4efa8c0da244469
2021-01-25 15:13:31 +00:00
Ed Sanders 1a15a8832c Move position:relative to inner wrapper
The outer wrapper is 100% width, so making it position:relative
causes it to stack above floated elements.

Bug: T272853
Change-Id: I20a73b5086ebb03673f0435e27ca93432dcd000c
2021-01-25 14:43:18 +00:00
Ed Sanders e793626d52 Line number selection: Remove user-select:none
These rules were being kept for cached content, but were
actually breaking Firefox by triggering a multi-part selection.

Bug: T271614
Change-Id: I83fb4aab88fe1f34bc59d1da18ae8a6a4838a831
2021-01-19 20:32:39 +00:00
Translation updater bot 1de7fc4d94 Localisation updates from https://translatewiki.net.
Change-Id: I180c83f9de3cf14adabcb0fa485abb58b535aba6
2021-01-18 08:39:54 +01:00
jenkins-bot 49043547f2 Merge "Line numbers use mw-content-ltr/rtl direction" 2021-01-15 21:39:51 +00:00
jenkins-bot 8824036ea9 Merge "Remove unused directionality styles" 2021-01-15 21:39:34 +00:00
jenkins-bot 003c86028e Merge "Add mw-content-ltr/rtl classes to inline snippets" 2021-01-15 21:31:33 +00:00
jenkins-bot fe7e9f77e4 Merge "Remove -o-tab-size rule, no longer required by Grade C browsers" 2021-01-15 21:31:31 +00:00
Ebrahim Byagowi e5238a17a8 Line numbers use mw-content-ltr/rtl direction
Content blocks always output a directionality class. It defaults
to LTR as most code is LTR, but it is allowed to set it to RTL
by adding a dir attribute to the <syntaxhiglight> block.

Use this class to do CSS flipping instead of CSSJanus, as this
class indicates the direction of the code.

Bug: T271792
Change-Id: I084550c2775febf13596addfb3598d6ae1afa2db
2021-01-15 17:34:16 +00:00
Ed Sanders c895f1c9e4 Remove unused directionality styles
* direction:ltr default is not required as every block
  gets an mw-content-ltr/rtl class and dir=ltr/rtl attr
* float rules for line numbers are no longer used as
  they are now position:absolute

Change-Id: I417ae969bf969b7cb25fbcf9ca3b1457c7bc6549
2021-01-15 17:34:16 +00:00
Ed Sanders 2d3af74c39 Add mw-content-ltr/rtl classes to inline snippets
We already add the dir=ltr/rtl HTML attribute so this
should be a no-op and makes it consistent with block
snippets.

Change-Id: I53e9204cc3bd54ba167f6f91e718a9d35b5bdfd0
2021-01-15 17:33:15 +00:00
jenkins-bot 4df77c1138 Merge "De-emphasise line numbers" 2021-01-14 17:40:36 +00:00
Ed Sanders 63c5943a9f Don't try to highlight elements not in a code block
The 'hll' CSS only targets the .linenos selector, but it doesn't
hurt to avoid unnecessary DOM changes.

Change-Id: Ic7134619606c6e4abc2480ddc9650d0352fc33da
2021-01-13 20:47:41 +00:00
Ed Sanders 8f09ace86b Don't throw an error when location.hash in unparseable
Bug: T271572
Change-Id: I50e5593272c0039c32019e5fdcb2c79465229cf0
2021-01-13 20:39:10 +00:00
Ed Sanders 76fd10659b Remove -o-tab-size rule, no longer required by Grade C browsers
Change-Id: I5d8ca364f96872a6a7da925b6d6cbebf35b7e523
2021-01-13 17:14:57 +00:00
Ed Sanders 8d645a385c De-emphasise line numbers
Use the darker text color for hovered/selected lines.

Bug: T271956
Change-Id: Icc6dce48a2e5720807309a47f84d8c2a7552a4f6
2021-01-13 16:55:02 +00:00
Umherirrender ecbc374f7d build: Run stylelint also for less files
no-descending-specificity:
Expected selector ".mw-highlight.mw-content-ltr .linenos" to come before
selector ".mw-highlight a:hover .linenos"

Change-Id: Ib8bd3dcc83058c6935b6b6c472554e3c1fa01eda
2021-01-10 13:40:20 +01:00
Translation updater bot 9ddd742ad7 Localisation updates from https://translatewiki.net.
Change-Id: I19dd2d2705dc3c35cd034625dd42f5a64a6128ae
2021-01-04 08:44:50 +01:00
Ed Sanders 16af4f3c6b Register VE module unconditionally
Change-Id: Ifccc0223c2b57c0de6f6c14355850213b090f8fb
2021-01-03 00:25:21 +00:00
Ed Sanders 583e3b3db8 Add support for line anchors on code pages
Bug: T29531
Change-Id: Ic09086c19d37bdff8bb7e68bbb0f676ef87896fe
2021-01-03 00:19:13 +00:00
Ed Sanders ef196f31ff Fix positioning of line numbers in VE
Change-Id: I349e80d8ad96e240ecb7afcb43dafdd72a76a308
2021-01-03 00:19:13 +00:00
Ed Sanders 0aec99f386 Extend highlight into line number gutter
Change-Id: I8947dc11dc671c44db084287ff1b3fe497eaa25b
2021-01-01 19:55:06 +00:00
jenkins-bot d1c0acf718 Merge "Move all HTML wrapping into #highlight" 2021-01-01 18:52:10 +00:00
Ed Sanders e8add72d66 Move all HTML wrapping into #highlight
This means all callers to #highlight get code wrapped
in the correct HTML.

This was done outside of #highlight before as the transformation
depended on $parser, so optionally pass in a $parser object if
the contents are going to go through the parser.

Change-Id: Ic5d5c341687e965804cb33da07dda23913718ff5
2021-01-01 18:27:29 +00:00
Ed Sanders d3b4227ed4 Fix selector specificty for Minerva
Bug: T270989
Change-Id: I55d6735002247b228b7c2a7406d684496b0b7f00
2021-01-01 16:42:55 +00:00
Ed Sanders 10ec5067c5 Enable line numbers on code content pages
Bug: T32773
Change-Id: I2eb8dcfe4d7bf751f998e1b2dd26a23cce69bf34
2020-12-30 21:35:05 +00:00
Ed Sanders 98c644a639 Improve appearance of line numbers
* Render a solid gutter that can take 3-4 digit line numbers
* Position line numbers absolutely in the gutter
* Add padding to code so that it doesn't wrap into the gutter

Change-Id: I7abb87452ad61808dad32b41c1d2d86b8ababb28
2020-12-30 21:35:04 +00:00
Ed Sanders fe357519c7 Add correct classes to full page output
Previously the full page output was missing the
-lang-<languagename> and mw-content-<dir> classes.

Change-Id: I54f4ed0a86e78a3a7ff1d670ebbdfdb6f05f86cc
2020-12-30 20:31:38 +00:00
Ed Sanders f2ef11144a Display line numbers as generated CSS content
This makes them unselectable in more browsers as the
user-select fix isn't supported everywhere (e.g. Safari).

Bug: T32773
Change-Id: I274632a1055e1f85679fbb29c81629104cc8b222
2020-12-30 19:43:03 +00:00
Ed Sanders 6e558b37db Add small gap between line numbers and code
Change-Id: Ie65128872f318a42677e52420338684ad8d814f8
2020-12-30 19:43:03 +00:00
Ed Sanders 9c0e82878e Fix classname lineno->linenos
Bug: T270296
Change-Id: Ia11c2f13161bfd5b8c1c7e898416373202736c76
2020-12-30 19:43:00 +00:00
Ed Sanders 62cd4384ba Convert pygments.wrapper.css to LESS
Change-Id: I3b221a146528cfc328666da40f99f3132d0ac700
2020-12-30 15:31:33 +00:00
Translation updater bot 721cb16354 Localisation updates from https://translatewiki.net.
Change-Id: I3b00fc665b25ebaa3d5694332dda8dd78f685bff
2020-12-28 10:40:05 +01:00
Translation updater bot 59d8716af0 Localisation updates from https://translatewiki.net.
Change-Id: I9190bfb6c7ac4a65366ef2fe0391b9164d571155
2020-12-22 08:32:48 +01:00
Translation updater bot 8426bec5ef Localisation updates from https://translatewiki.net.
Change-Id: I3e9aa900c14138c6481304e46b40b1bc1483d849
2020-12-21 08:40:11 +01:00
libraryupgrader f50b52c97c build: Updating mediawiki/mediawiki-phan-config to 0.10.6
Change-Id: Ib2c418aa6d8d110d579e376566579ccf118825ec
2020-12-20 03:24:51 +00:00
libraryupgrader 322024dc4e build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.10.4 → 0.10.5

npm:
* ini: 1.3.5 → 1.3.7
  * https://npmjs.com/advisories/1589

Change-Id: Ifdf41f7187ce3b1003b8756a5afb5af0033c04a0
2020-12-11 10:41:33 +00:00
Translation updater bot 09c2dd66e4 Localisation updates from https://translatewiki.net.
Change-Id: I7976b85cfb75f328b9ca09dea30bad694a2c6227
2020-12-09 08:42:33 +01:00