Commit graph

12 commits

Author SHA1 Message Date
Thalia 118dcdb405 Separate node classes into individual files
Bug: T205231
Change-Id: Id175f839f0ac8714c44407c52145d4140cd8e343
2018-09-24 18:48:22 +01:00
Kunal Mehta ab5ce23881 Remove tidy workaround for armoring tabs
RemexHtml does not mangle tabs, so we don't need to armor them! We'll
now output literal tab characters, so this does change the HTML output,
but does not have any visual change.

Depends-On: Idf246d05d116f63a73105b50a1929a7721fbe7b9
Change-Id: I2ba871acf9ff5fdc81c13e03eee3a8fe670e1f0f
2018-09-18 21:30:20 +00:00
C. Scott Ananian 14e3167406 Use MWTidy::isEnabled() instead of deprecated $wgUseTidy
The $wgUseTidy global has been soft-deprecated since MW 1.26, which is
when MWTidy::isEnabled() was added.  This extension currently requires
MediaWiki >= 1.32 according to extension.json.

Change-Id: Ie30c9174e6e3b60bce5a692296a9de1e30192e2c
2018-09-07 17:12:45 -04:00
libraryupgrader 74dbf4bba9 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Change-Id: I1c75e007be52cd22d0a72d228e56a3a9683fbb58
2018-09-03 19:50:49 +00:00
Kunal Mehta 27b6687848 Use wfMakeStaticArrayFile()
wfMakeStaticArrayFile() expects an associative array, so let's take this
opportunity to turn the lexer list into one with true as the value. This
allows us to use isset() instead of the slower in_array() when checking
to see if a lexer is known.

Bug: T200626
Change-Id: I7a852ddbcfa7c8ed19ac933205cabd176b20d0cb
2018-07-28 21:29:57 -07:00
Gergő Tisza cc44c3c7a8 Add notice about resource loading to highlight()
Co-Authored-By: Timo Tijhof <krinklemail@gmail.com>
Change-Id: Ide7ab4b84d1aacad2db8400de9e350a09c80e8c0
2018-05-01 09:17:58 +00:00
Ed Sanders af1a91ade9 Use OOUI 'markup' icon instead of VE's deprecated 'alienextension'
Change-Id: Iad1882c20c17792c1339cf9922b9c4c43bf6122b
2018-03-20 19:00:41 +00:00
Timo Tijhof 8c3a3ffda0 Update highlight() to use getWithSetCallback() idiom
* Use backend-specific makeGlobalKey() method instead of
  deprecated wfGlobalCacheKey().

* Call makeCacheKey() inline and reduce to only producing
  part of the key (makeCacheKeyHash).

* Add a $ttl (1 month), instead of the previously unspecified
  expiry (default: indefinite).

Change-Id: I913a768a3b61cc31ce14fa086a563ceecca7c603
2018-02-22 23:53:56 +00:00
Timo Tijhof ae9b8419dc Factor out plainCodeWrap to avoid recursive call to self
The recursive call is somewhat counter-intuitive, and seems like it could
easily break if forgotten. Instead, move the part that we want to re-use
out into its own method.

Change-Id: I64ced0da211155299744d3c86f7818e751ad027e
2018-02-22 23:40:19 +00:00
Timo Tijhof 92602f33da Minor clean up
* Move "empty tag" case to earlier in highlight() by comparing to
  empty string without strlen(). Follows-up cda15b184.

* Turn "shell disabled" case into 'elseif' after length check,
  instead of subsequent 'if'. That way, in case of a too large
  string, we don't need to check if shell is disabled, and it
  also provides the user with the size-related error instead of
  the shell-related one.

* Add a few clarifying code comments.

Change-Id: Ib0ef9e683ac4aadd0461fe061ddbe9bfb0a27a82
2018-02-22 23:40:07 +00:00
Kunal Mehta cda15b184c If there is no input, don't try and shell out to pygments
pygments will just wait for stdin if the stdin that was passed
to it was empty.

Bug: T188019
Change-Id: I46271f31df74822bc71b3ac283fa572f2d149d67
2018-02-22 13:29:58 -08:00
Kunal Mehta 141455aa33 Move classes into includes/
Change-Id: Ie26b5be1bb2551ed339fdb4a587a89823c609b2e
2018-02-15 14:29:07 -08:00
Renamed from SyntaxHighlight.php (Browse further)