This makes the parserTests compatible with change
I61a67a0e6928463e3872be9a42ff6992c6754662 in core.
Change-Id: I5c22f456a3ae5ea25b59c4246d68965099c465cc
Use the '--json' flag to get Pygments to output its list of supported
lexers in a machine-readable format. Support for this flag was added (at
our request) to Pygments and included in the 2.11 release[1].
Tested by running updateLexerList.php and confirming empty diff.
[1]: https://github.com/pygments/pygments/issues/1437
Change-Id: I0f1d7fceca9034e6034bafa6a8dd312b99d379d1
When using a non-bundled Pygments (which is required on Windows, as the
bundled version is an ELF binary), we call into the Pygments executable
to generate the list of supported languages (lexers). This list seems to
occasionally include carraige returns, causing some languages to not be
processed correctly. Trim those CRs out so the language list is
accurate.
Change-Id: If8b1f145dd10e2c4707d6d32927e85d1d2459f15
Replacing the HIGHLIGHT_MAX_LINES and HIGHLIGHT_MAX_BYTES constants with $wgSyntaxHighlightMaxLines and $wgSyntaxHighlightMaxBytes respectively, so sysadmins can adjust the limits to their needs if performance is not of their concern.
Bug: T322293
Bug: T104109
Change-Id: I80768d3cb45ac01c004fc812832878c83ca4ecdb
Python on Windows requires the SystemRoot environment variable in order
to initialize its internal RNG, so make sure that is passed along to the
subprocess.
Bug: T300223
Change-Id: I170ce627a3f00c023f4b1f11613f4fe2cb17bd31
Steps to reproduce:
* Make a wikitext page with <syntaxhighlight line="sure">…</…>.
* Edit with VisualEditor and make an unrelated change to the content.
* Save.
* Before the attribute was always replaced with line="1".
* With this patch the old value stays untouched.
Change-Id: I433a206905c1a0a1bc06ef8b4037f6db9d935810
Skip the expensive check,
for example when no highlighting is wanted because there is no lexer
Also all validation of the tag is now processed and
invalid tags also not counted.
Bug: T316858
Change-Id: Ifad9a9a14fae92463c345fb12defb41f14c2e1f3
The shell out to get styled text is expensive.
Call Parser::incrementExpensiveFunctionCount to limit the highlighted
text snippet on a page and not reaching a timeout.
This would count each tag and not deduplicate the text snippet to count
only once or if pygmentize needs to call or is in the cache.
This also not affect Parsoid, not sure if the concept of expensive
parser function exists there
Bug: T316858
Change-Id: I8afe61e9be4a34e5f0725a9b65ef43c345e1be5f
* 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
Follow up to ae07430. The method needs to be public so that
WANObjectCache can call it from a callback, but we don't expect any
external callers.
Follows-Up: I424926d071e1cfd454a0c2d45a83693f41bdea55
Change-Id: Ia96d3132782435c693d2eaa77fd551fe9590b113
* Add rationale for each cache key's strategy being in Memc vs APCU.
* Extend pygmentize-lexers from 1 day to 1 week. It rarely changes
and already varies by version. Few things survive the day, but
there's not a reason to explicitly expire it sooner I think.
* Add a layer of Memc to the pygments-version APCU cache given that
it has a short expiry and thus relatively high miss rate.
The main rationale for this is noise in mwdebug logs since this
is currently the only thing we log by default in Logstash with prod
severity (exec INFO) during every pageview (after a php-fpm restart
which clears APCU). By adding Memc here we lose less of the cache
churn by reviving it via Memcached, and we keep the sense of there
being nothing in the logs "by default" at prod severity after restart,
e.g. don't get used to any fatigue.
Unlike the other cache keys and hooks, getVersion is the only
thing that gets called widely regardless of whether syntaxhighlight
is in use on the given page.
Change-Id: I424926d071e1cfd454a0c2d45a83693f41bdea55
Extensions using Phan need to be updated simultaneously with core due
to T308443.
Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: Ie1356c582baf9a66b868f7349cc71c26f8f1ead3