Commit graph

144 commits

Author SHA1 Message Date
Ed Sanders f285f9e8c5 VE: Rename parent tool
InspectorTool is a deprecated alias.

Change-Id: If96a623cf260b01dad53e888ff111728b529ceec
2016-04-12 15:05:03 +01:00
Derk-Jan Hartman ccce9fdf53 Prevent selecting line numbers in syntaxhighlight
This works most of the time in modern browsers.

Bug: T131227
Change-Id: Iaad1568f55556c8dd0f465b555ce868498d71828
2016-04-11 14:25:40 +02:00
Ed Sanders 635ef9c4c0 VE: Preserve context when calling parent static method
Change-Id: I32e9c13d549f8f13ca50cf8d244f0dfbc3f3bb8d
2016-04-01 12:59:32 +03:00
Ed Sanders fbdf65a344 VE: Fix primary command on SH nodes
This fixes the double-click/press-enter to edit functionality.

Change-Id: I275c505d8a3abb7d7e3686ffacf52e54235241e7
2016-02-07 23:31:16 +00:00
Ori Livneh 5d99d54626 Update pygments bundle to 2.1
Changelog:
https://bitbucket.org/birkenfeld/pygments-main/raw/7614bf7/CHANGES

Lots of new lexers: Emacs Lisp, Arduino, Modula-2 with multi-dialect support,
Fortran fixed format, Archetype Definition language, Terraform, Jcl,
Easytrieve, ParaSail, Boogie, Turtle, Fish Shell, Roboconf, Test Anything
Protocol, Shen, Component Pascal, SuperCollider, Shell consoles (Tcsh,
PowerShell, MSDOS), Elm and J, Crmsh, Praat, CSound, Ezhil, Thrift, QVT
Operational, Hexdump, and CAmkES Configuration.

Bug: T125581
Change-Id: Ie881af3d1dff23f08ccc9cbcf5f94a084fa561e1
2016-02-02 15:17:25 -08:00
Florian 3203eaf554 Fix inheritance of ve.ui.MWSyntaxHighlightDialogTool
From the description of the commit message[1] for WindowTool (which replaces
DialogTool) and FragmentWindowTool, the
ve.ui.MWSyntaxHighlightDialogTool should be a FragmentWindowTool,
and not a WindowTool/DialogTool.

In fact, the bug is caused by the missing isCompatibleWith method
in WindowTool.

[1] I3a0e761f0d6e942d503ec

Follow up: I676af9c50b09ef007926240eb2327d1a0fdd80f5

Bug: T121596
Change-Id: I0fa440d845c1dea34b623de0a36fb57cebf60f78
2015-12-19 01:27:14 +00:00
jenkins-bot 6267ec8450 Merge "VE: Register sequence with CommandHelp" 2015-11-05 15:36:41 +00:00
Ed Sanders f24eb8bfba VE: Register sequence with CommandHelp
Depends on I65e2bfc2 in VE-MW

Change-Id: I6054caa97c4f7e5fcd632912534deac977af6016
2015-11-05 10:14:14 +00:00
Ed Sanders 8a39d4f9dc VE: Clear Ace's undo manager after setting initial value
Depends on Ia331acc41 in ve-mw.

Change-Id: Idf8cd4983d7ce8cd570f5672521b04a988bbc324
2015-10-30 16:27:43 +00:00
Ed Sanders b73e6ab425 Follow-up Ib709ffd72: Add vendor prefixes
As per http://caniuse.com/#feat=css3-tabsize

Bug: T115284
Change-Id: I1a9984f37fa943b9fa4ffa403e4ba37986fa9986
2015-10-28 10:49:02 +00:00
jenkins-bot cfdacaf12a Merge "VE: Add '<syntax' and '<source' sequences" 2015-10-22 15:47:16 +00:00
jenkins-bot f53f47b8b1 Merge "Use Ace editor widget for code input" 2015-10-22 15:47:13 +00:00
jenkins-bot 89c96e67a6 Merge "Use dialog for editing block level syntax highlights" 2015-10-22 15:47:10 +00:00
jenkins-bot efe8a78991 Merge "VE: Remove unnecessary validation check" 2015-10-22 15:39:36 +00:00
jenkins-bot 465788c2de Merge "VE: Focus, but don't open, language input on open" 2015-10-22 15:39:25 +00:00
jenkins-bot f7dd0d5536 Merge "VE: Update renamed CSS class to restore fixed width font" 2015-10-22 15:39:08 +00:00
Ed Sanders e127b3162b VE: Add '<syntax' and '<source' sequences
Change-Id: Ie087fd665f527ea13254576ee07ebd029a1803ea
2015-10-22 11:56:48 +01:00
Ed Sanders 826c2cba40 Use Ace editor widget for code input
Depends on Ie483f6eba2 in ve-mw.

Bug: T49742
Change-Id: Ifaff6a5345fef92aba57b4fc00181f5b32cf7365
2015-10-21 17:32:15 +01:00
Ed Sanders 3a42016be0 Set tab size to 4
Bug: T115284
Change-Id: Ib709ffd72bad20db6282a4f32175d8062f4d2e25
2015-10-20 15:26:25 +01:00
Ed Sanders 0f10206cf2 Use dialog for editing block level syntax highlights
Maintain the inspector for inline snippets (which are editable
but still not creatable).

Bug: T112617
Bug: T57934
Change-Id: I76e36590363d36c0d3db4ec28ce81c4860d9b467
2015-10-20 15:16:11 +01:00
Ed Sanders 10b6dee5a2 VE: Remove unnecessary validation check
Change-Id: I7cc68eaead398ed97baf620142386f8e0bab4fb9
2015-10-20 15:16:11 +01:00
Ed Sanders 30a98dcbcd VE: Focus, but don't open, language input on open
Bug: T112798
Bug: T114202
Change-Id: Id70e8baea3687d5cd57ff3f45b5f332098451b7d
2015-10-20 15:16:05 +01:00
Ed Sanders 115fc92bfc VE: Update renamed CSS class to restore fixed width font
Change-Id: I029cfdfc5eabb8358b7c3b0274f4e759134a3af5
2015-10-19 13:51:03 +02:00
Ed Sanders c0482fe738 build: Update JSCS from 1.8.0 to 2.1.0 and make pass
Change-Id: I3b26c3cba814dcc8691f9f1ac04eb7dcc996f185
2015-09-18 16:01:40 +00:00
Ed Sanders 359c060eb7 Rename modules/VisualEditor to modules/ve-syntaxhighlight
Per new naming convention.

Change-Id: I0db6f70c2d7671eb9c25a6ff7eecf46eafb696d2
2015-09-18 12:14:39 +01:00
Alex Monk de31d8d7f1 VisualEditor integration: Fix handling of (None) language
Change-Id: I6a5ca5db218d8497eed5dfb61b5a5acb4bb0c122
2015-09-16 20:23:54 +01:00
Ed Sanders 8212ef5609 Split nodes into block/inline
Bug: T103963
Change-Id: Ib0390d6432fe97810988be3aca59ba38c0d55b64
2015-09-16 17:23:48 +01:00
Alex Monk 910ea5a6c9 VE integration: Fix regression in Ic84c5afb
Calling clearItems().addItems like this was super slow and broke autoEllipsis.

Bug: T103756
Change-Id: I398ae5b0fda00a559d742660fa930710174117b2
2015-08-28 19:04:15 +00:00
Alex Monk 0a59b4ccb1 VE integration: Provide a combobox for language input
Bug: T103756
Change-Id: Ic84c5afb1cf83cce6fa521a99f5fee242bc610b1
2015-08-27 03:24:07 +01:00
Bartosz Dziewoński 6b1a4a6d8c Restore 'direction: ltr;' for .mw-highlight
Follow-up to 043969f84e.

It is not needed for current HTML generated by the extension tag,
but is required for compatibility with cached renders generated
between 6484894497 and
043969f84e.

Bug: T105499
Change-Id: Ie15d9c7fb673528b2ab5e40e6beddc580fb6d368
2015-07-11 13:50:41 +02:00
Ed Sanders d38d9c1994 Add VisualEditor support for 'line' attribute
The line attribute sets line='1', as both Parsoid and VE
expect proper XML attributes.

Change-Id: I10b5717fcc4b8e84a3030425a4a6a9a865272830
2015-07-06 22:09:23 +01:00
Bartosz Dziewoński 48bf989cad Highlight background of whole lines, not just text in them
Bug: T103964
Change-Id: Ia1036f00e05634fe6b7e3b65af2a34fc91a540e5
2015-07-05 23:39:38 +00:00
Bartosz Dziewoński 043969f84e Refactor final output formatting
* 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
2015-07-05 22:03:24 +00:00
Ori Livneh 927f40e98a Hide the red border around syntax errors
MZMcBride noticed the red border around '國' in
https://en.wikipedia.org/wiki/Swift_(programming_language)#Example_code

That particular case happens to be a Pygments bug, because multibyte characters
are valid variable names in Swift. But even in cases of legitimate syntax
errors, I don't think we want to show the red border. This behavior may be
useful in code editors, but it is not useful in a wiki environment, especially
given the longstanding habit of using an existing, mostly-compatible lexer to
highlight a language for which no specific lexer exists.

To fix this, override the style in pygments.wrapper.css, and swap the order in
which the two CSS files are concatenated, so that in general we have the
ability to override Pygments-generated CSS.

Change-Id: I304fdaf3a462445d316e0f7fecc983fa87afc629
2015-06-25 17:24:15 -07:00
Bartosz Dziewoński 892b52a30d Avoid displaying double borders for inline code snippets
Before we started using the 'code' tag for inline code snippets,
<code><syntaxhighlight enclose=none ...>...</syntaxhighlight></code>
was a common pattern. Continue supporting it in existing content.

Follow-up to 04293baad9. My IRC comments
about this were seemingly forgotten, and the code I added in
5b7522a5fc to handle this problem
unceremoniously removed.

Bug: T85794
Change-Id: I8e52089fed41e78fb60ddd5b7c12075056265dd9
2015-06-25 13:38:37 +02:00
Bartosz Dziewoński ca778d0a99 Revert "Remove obsolete mw-highlighter styles"
The 'direction' rules must not be applied to regular preformatted
text in MediaWiki core, only to syntax-highlighted programming
language code.

(Not reverting the part that removes 'monospace' rule, *that* is
superfluous.)

This reverts commit f834b719b9.

Bug: T103780
Change-Id: Ie7e9123ab3456aa6fff0485431fe81cd5eb31fa2
2015-06-25 13:05:19 +02:00
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
Timo Tijhof 1a90245838 ext.geshi.visualEditor: Store languages in the module instead of mw.config
Also fixed typo language -> langauge.

Change-Id: Ic4bfeb275c479df17e5dd41d5173d9807f6bc1a0
2015-06-25 00:35:20 +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
jenkins-bot ef3e89cc7c Merge "Use <code> instead of <span> for inline code snippets" 2015-06-24 18:11:32 +00:00
Bartosz Dziewoński 8593fef342 Add 'direction: ltr;' to .mw-highlight
I'm not entirely sure that this will always behave correctly on RTL
wikis, but currently we never behave correctly on RTL wikis.

Bug: T85794
Change-Id: I8af2b18884ec619d581f9ceed737c5628b647086
2015-06-23 22:02:35 +00:00
Ori Livneh 04293baad9 Use <code> instead of <span> for inline code snippets
Change-Id: Ibc07169fc3b91509aa2d98b8ae910c901d2f1703
2015-06-23 08:38:56 -07:00
Bartosz Dziewoński 5b7522a5fc Unbreak <syntaxhighlight enclose="none">
It was always "none" and not "span", this must've been an accidental change.

Also add a CSS tweak to better render the common pattern of
<code><syntaxhighlight enclose="none">...</syntaxhighlight></code>.

Bug: T85794
Change-Id: I3ed1b7f3c954374b49fc9a97881ea5236415cb6f
2015-06-23 15:21:29 +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