Verify that running Pygmentize::fetchGeneratedCss() (which gets invoked
from the updateCss.php maintenance script) gives CSS that matches the
generated file pygments.generated.css.
Change-Id: I454f287cb461b596178ee47c44634e2e127fe576
I think the syntax for parsoid-compatible may have changed at some
point and these tests probably never ran against Parsoid for a while now.
Change-Id: I9d7b23b180995eeadb4e3d183a0e970040ef6c78
Prior to the shellbox migration, if during the parsing of a page,
pygmentize failed (i.e. non-zero exit from its local shell command,
pretty much the only way a php shell exec could fail), then
SyntaxHighlight would fallback to outputting a preformatted plain
`<pre>`.
The logic still exists in the code, and is still triggered for cases
where the command reached shellbox and its result was "successfully"
communicated to MediaWiki (HTTP 200), with the boxed result reporting
the non-zero exit code on the shellbox server.
However, the more likely scenario in the new setup is that the command
times out or never reaches the server in the first place, in which
case we don't get any shell exit code. Instead, we get a Shellbox
exception since the result is unknowable.
Instead of fatalling the entire pageview with a PHP exception and
HTTP 500 from MW, use the same graceful fallback.
Bug: T292663
Change-Id: Icaa8c34ff97ad8a99d044beab529ef943071269c
This makes the parserTests compatible with change
I61a67a0e6928463e3872be9a42ff6992c6754662 in core.
Change-Id: I5c22f456a3ae5ea25b59c4246d68965099c465cc
* Added Parsoid config, and refactored code slightly to
add native Parsoid handlers for parser tags exposed
by this extension.
* Enabled parsoid mode testing on the test file.
* Added html/parsoid sections on a few tests.
* Marked rest of tests as wt2html and wt2wt only since
html2wt and html2html will fail without a html/parsoid section
and there is no real benefit to adding them to all tests.
* Added a couple tests to the known failures list:
- One is because of T299103.
- The other is because Parsoid always emits attributes in the
form <tag .. foo="bar"..> instead of just <tag ... foo ..>
Since Parsoid needs to accept this format that is present on
wikis, I added a html/parsoid section for this test and
added the failures to the known failures list.
Bug: T272939
Change-Id: Ie30aa6b082d4fc43c73296ff2ed6cb8c3873f48f
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
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
When the `enclose` attribute is used `syntaxhighlight-enclose-category`
is added, and when a <source> tag is used, the
`syntaxhighlight-source-category` is used.
Parser tests verify the tracking category is added when appropriate.
Bug: T241636
Bug: T237267
Change-Id: I7a21c635de426ab024703c04acdc6fa2184daedb
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
I42e747f1 stopped changing a regular space before percent-escapes (like
"%25") to a non-breaking space in certain cases, causing tests to fail
where they were expecting that non-breaking space. Update the test to
match this new behavior.
Bug: T199647
Change-Id: If5d90e5701f240b1bc71a3c3458e952e0e2c7df4
Add phan configuration for static analysis, and fix phan warnings.
`PhanDeprecatedClass` and `PhanDeprecatedFunction` rules are supressed.
Bug: T179554
Change-Id: I7cbb410ed88ba58198d0557cafd9e6df968ed885
Notable changes:
* Added new token types and lexing for magic methods and variables in
Python and PHP.
* Added a new token type for heredoc (and similar) string delimiters and
lexing for them in C++, Perl, PHP, Postgresql and Ruby lexers.
* Improved the CSS lexer.
* Added Varnish config lexer
Full changelog is found at:
<bc45808f83/CHANGES>
Bug: T156573
Change-Id: I4dc1782f19881ba1294308e1cdea1b2e063f438a
Follows-up 043969f84e.
This caused a fatal MWException when saving/reading pages that contain a
<source> that couldn't be highlighted (e.g. no lang attribute, unknown
lang, or too large).
Specifically when wgWellFormedXml=false, in which case $out isn't
just from Pygments, but actually from our own Html::element.
Change-Id: Ib299a274d28021b2c7bba52d763dd1e17c1f09ec
* Use 'nowiki' strip marker to prevent list processing (also known as
doBlockLevels()). This resolves various issues related to using
<syntaxhighlight/> blocks in lists and lists suddenly appearing
inside <syntaxhighlight/> blocks. Fixes T17333, T25674, T104067.
* To prevent <p/>-wrapping resulting from the above, add our own
wrapper <div/> around the output.
* Since we already have our own wrapper, remove Pygments' one and
extend it with custom attributes. This resolves some regressions
from the GeSHi migration. Fixes most of T103964.
Bug: T17333
Bug: T25674
Bug: T103964
Bug: T104067
Change-Id: I3afd1224a18549c62cd4a95fd046affa6d1d3b3f