Commit graph

16 commits

Author SHA1 Message Date
Timo Tijhof f834b719b9 Remove obsolete mw-highlighter styles
The styles in MediaWiki core for <pre> already cover this. And
for skins that want different styles, SyntaxHighlight should not
have been overriding it.

Bug: T103780
Change-Id: Ib863288a9a4530b183cf5fdb692489363d82a50f
2015-06-25 05:43:24 +01:00
Legoktm f1c6b66bac Revert "Add Pyglet, a web micro-service for highlighting using Pygments"
Doesn't work, shouldn't have been self-merged either.

This reverts commit 7e4efbe114.

Change-Id: I52b200d3fb0fea101317740e4ce63a7b71015303
2015-06-25 01:11:54 +00:00
Ori Livneh 7e4efbe114 Add Pyglet, a web micro-service for highlighting using Pygments
Pyglet is an internal web service that listens on port 31337 by default and
which accepts syntax highlighting request via POST. If $wgPygletURL is set to a
URL of a Pyglet instance, the extension will attempt to query the web service
instead of shelling out.

Change-Id: Ic49f4cd77585dbffc5392e80904754ff889b8a63
2015-06-24 17:57:50 -07:00
Timo Tijhof 6ba411fe2f Merge ext.geshi.data and ext.geshi.visualeditor modules
Until and unless there is an explicit need (and intent to support)
a public interface to use this data elsewhere, there is no need
for it to be a separate module.

It can be its own class, but at the resource level this data should
be considered a JavaScript file. And we don't create separate modules
for each file. They are in the same module unless they should be
semantically loaded in unrelated page contexts.

The module registery is not a javascript class autoloader. There
is a global cost to adding more modules to this registry.

Change-Id: Ifeddef8cfe00b6c115734f92eceab251a0b75bdb
2015-06-25 00:32:03 +00:00
Ed Sanders b403b58682 Add VisualEditor support
Most functionality is provided by MWExtensionNode & MWLiveExtensionInspector.

Bug: T45126
Bug: T60388
Bug: T69515
Change-Id: If502a8bd2199b6ceb824e02fdfd13c81c39b53b4
2015-06-24 22:43:42 +01:00
Kunal Mehta 01802ac3fb Use RejectParserCacheValue hook to invalidate caches that were using GeSHi
Change-Id: I47de88dc1c2f2380e41e6af0d3222b46c9c65569
2015-06-23 21:26:44 +00:00
jenkins-bot 9f5eade94c Merge "Add basic parser tests for functionality of non-recognized languages" 2015-06-23 15:29:31 +00:00
Derk-Jan Hartman d272c1e0e2 Enable syntaxhighlighting on mobile target
Now that we switched to pygments, there should be mo reason not to
enable this on mobile

Bug: T100563
Change-Id: I008b71d4cef04fb7dc7c2ad574032f9c4645b063
2015-06-23 13:17:03 +02:00
Kunal Mehta fb0e430f47 Add basic parser tests for functionality of non-recognized languages
Change-Id: I07cecb588818fd4abb0b1b8e8de893cf6f72014a
2015-06-22 22:26:22 -07:00
Ori Livneh 648744325c Bundle Pygments 2.0.2
Include Pygments 2.0.2 as an executable zip bundle. Also include a script to
automate the process of creating such bundles and to make it reproducible and
verifiable.

Change-Id: I67e6f804e493f065311164c610dc541a5779654e
2015-06-22 22:54:42 +00:00
Ori Livneh 6484894497 Highlight using Pygments rather than Geshi
GeSHi is unmaintained, lacks support for many popular modern languages, and
suffers from deep architectural flaws, chief among them the inconsistent
tokenization of different languages, each of which requires a custom
stylesheet.

Pygments is a well-maintained alternative. It is, by my count, the most popular
syntax highlighting library around. It is BSD-licensed, actively maintained,
and is widely used in PHP projects.

To keep this easy to review, this change does not include update for l10n
files, and it does not delete the geshi/ directory. I will do those in a
separate patch.

The chief change between this and the previous implementation is that errors
result in the code block not being highlighted, as opposed to not being printed
at all, having been replaced by an angry red error message. I think that is the
right user experience. If you go to StackOverflow or GitHub and try to mark up
your code block as being written in some language that their highlighter
doesn't know about, you don't get an error message -- the code simply doesn't
get highlighted.

Because we don't recursively load dependencies for extensions, to test this,
you will need to create a composer.local.json in $IP and add:

    {
        "extra": {
            "merge-plugin": {
                "include": [
                    "extensions/SyntaxHighlight_GeSHi/composer.json"
                ]
            }
        }
    }

Then run `composer update`.

Bug: T85794
Change-Id: I07446ec9893fae3d1e394f435d3d95cf8be6bc33
2015-06-22 23:37:15 +01:00
Gilles Dubuc 58c81408f5 Explicitly define module position
Style modules currently added through addModuleStyles default
to being in the head ("top" position). This is an unhealthy default,
since only critical styles that are needed at pageload should be
in the head. In order to be able to switch the default to "bottom",
existing module positions have to be defined explicitly.

Bug: T97410
Change-Id: Ie120a781ac1950abd7963d6f722aa316b5542b51
2015-05-29 15:28:06 +00:00
Kunal Mehta 0347b58a87 Set manifest_version in extension.json
Bug: T100745
Change-Id: I444f456011a62ccb36d59b624f7f1250e44c82f2
2015-05-28 20:39:54 -07:00
Kunal Mehta b4853c7633 Revert "Revert "Add extension.json, empty PHP entry point""
Try #2. Our last attempt loaded $wgGeSHiSupportedLanguages late, and
would override anything if it was already set. We still load it late, but
only if it is not already set.

This reverts commit 033ca20746.

Bug: T88063
Change-Id: Iae0806e06a95b2d8932b3d9e078e6135dd6750a3
2015-05-20 14:36:46 -07:00
Legoktm 033ca20746 Revert "Add extension.json, empty PHP entry point"
This reverts commit 72d1e92263.

Change-Id: I47eab2842f195bf302de0ae3bf15beff1b48290f
2015-05-20 21:21:11 +00:00
Derk-Jan Hartman 72d1e92263 Add extension.json, empty PHP entry point
Bug: T88063
Change-Id: I42afa0bf81f4f89b81a11bcafcb8e4c032a2d173
2015-05-19 17:05:43 -07:00