Commit graph

55 commits

Author SHA1 Message Date
Ori.livneh 0122c20452 Merge "(bug 26204) font-size is too small" 2013-02-22 23:41:19 +00:00
Ori Livneh 9fd1639d46 Disable some highlighting for MOUSs
(...modules of unusual size.)

Enabling full syntax highlighting for very long Lua modules can produce DOMs
that have hundreds of thousands of elements and cause browsers to lock up.

I took a count of spans by class (which amounts to a count of tokens by type)
of https://en.wiktionary.org/wiki/Module:languages and came up with:

       sy0:      62545 (symbols)
       br0:      61952 (brackets)
       st0:      39291 (strings)
       kw3:       7746 (keywords)
       kw1:          3
       kw2:          2
       co2:          2
       co1:          2
       nu0:          1
     ------     ------
     Total:     171544

GeSHi allows you to disable highlighting for a particular token type (see
<http://qbnz.com/highlighter/geshi-doc.html#disabling-lexics>) which like a
good way of handling this issue.

Disabling symbols (set_symbols_highlighting(false)) removes both sy0 and br0
elements from the DOM (about 124k elements in the case of Module:languages),
with about 47k elements remaining on the page. This is enough to make Chromium
responsive on my laptop (2.3ghz i5, 8 GB RAM), but it's still noticeably
sluggish. Adding 'set_string_highlighting(false);' removes another 40k elements
from the rendered output, and the resulting DOM is quite zippy at 8k elements.

Proposed solution: disable symbols highlighting when >100 kB; disable strings
highlighting too when >200 kB.

Change-Id: I90c645f9d03bbdc135058a3717a463dec40aa77d
2013-02-20 22:06:59 -08:00
Antoine Musso 6d54985ad6 (bug 26204) font-size is too small
The Geshi rendered output has a font-size of 10px where we would expect
13px just like for <pre>.

Bug 33496 against MediaWiki core dealt with that issue already: in some
(all?) browser 'monospace' has a size of 13px where as the default is
16px. When defining a font-size of 0.8em the monospace is scaled down to
10 px which is too small. By appending another font statement, the
browser treat monospace as a default font and thus scale it starting
with 16px instead of 13px.

This patch append a style to geshi which set the font-family to
"monospace, monospace" thus tricking the browser in considering
monospace a regular font.

Change-Id: I7bbdcc0a21010513473a7ca9d784df77e9920b5b
2013-02-13 22:37:00 +01:00
Siebrand Mazeland c602c5a4a7 Maintenance for extension SyntaxHighlight_GeSHi.
* Use Message class where possible.
* Removed superflous newlines.
* Update .gitignore.

Change-Id: Ic2386183e240662331656ebadcaad1057569fb7c
2012-08-26 11:24:29 +02:00
Catrope a62433879b Shut up a PHP notice when the (css|js) expression doesn't match anything
This can happen if the TitleIsCssOrJsPage hook causes a page without a
.css or .js extension to be considered a CSS/JS page.

Change-Id: I875a7f89f683336f18e70358fe589cef706fd5d1
2012-07-18 16:33:04 -07:00
Timo Tijhof b06fbd3b60 Remove usage of mw-code-inline
Remove usage of mw-code-inline:
 * That class ended up not being merged into core, so it does nothing.
   Only mw-code (for the <pre> wrap) is needed.
   7c9b2273c9cbdae90c9f4e3890a13619f769c5d0 (mediawiki/core) had both
   in an earlier patch version, but only mw-code was merged.

Follows-up:
 * mediawiki/extensions/SyntaxHighlight_GeSHi:
   dc147a5ef1
   Use .mw-code and .mw-code-inline

 * mediawiki/core
   7c9b2273c9cbdae90c9f4e3890a13619f769c5d0
   Add .mw-code styles in core

Change-Id: I793c05c3e103209cf966d9e35ab37c05528cdbb8
2012-05-11 04:36:18 +02:00
Timo Tijhof dc147a5ef1 Use CSS classes .mw-code and .mw-code-inline
- Follows-up I4ff5d0197ba8dc0dad3cafd03f2b120bc22e75cb

- Reverts r113190 (redundant fix that caused 35875)

- Fixes:
 * bug 19416
 * bug 35875

Change-Id: Iaa2227348ca632d4a261c149bdf2428b4b48adc7
2012-04-14 06:08:20 +02:00
Sam Reed d2f784ca96 Documentation, spaces, braces, explicit member variables 2012-03-09 23:33:42 +00:00
Krinkle 5dfa1034c1 [SyntaxHighlight GeSHi] Use <code> and <pre> instead of <span> and <div> to allow skins to universally style these without requiring local wikis to manually maintain a copy of each skins's <pre> style and apply it to .mw-geshi
* Fixes
-- (bug 19416) GeSHi-generated blocks should use <pre> style for the container
2012-03-06 22:35:40 +00:00
Robin Pepermans b81f422ffc Add mw-content-ltr/rtl class: fixes bug 33538: Line numbers are outside of left border when using <source ... line start= > on RTL wikis
Also make sure mw-content-ltr/rtl is the same as the dir attribute value. Restrict that value to either ltr or rtl (not sure if rtl really needed; source code is always ltr). Also remove text-align:left; as it can/should be set manually in the <source> tag.
2012-01-05 19:46:42 +00:00
Sam Reed 65ffff273a Fix whitespace
Don't use direct member variable access
2011-12-16 14:51:31 +00:00
Sam Reed 01139727ee Documentation 2011-12-02 17:00:19 +00:00
Roan Kattouw 4227b5510d (bug 27714) Load MediaWiki:Geshi.css using ResourceLoader. Modified patch by Lewis Cawte 2011-11-20 18:07:20 +00:00
Brion Vibber e739c5d3b8 * (bug 30930) Fix bad tab-to-space conversion in SyntaxHighlight_GeSHi when $wgUseTidy on
Tidy always converts tabs to spaces on input; on a big <pre> section this is ok but it tends to fail on syntax-highlighted output, where the spacing should depend on the *output* not the *input markup*.
As a workaround, when $wgUseTidy is enabled we now apply our own tab-to-space conversion preemptively on the input before feeding it into GeSHi for highlighting; this keeps the right spacing through to output.
2011-09-16 17:52:28 +00:00
Victor Vasiliev bcd5a74456 Make certain members of the SyntaxHighlight_GeSHi class public, so other
extensions may use it.
2011-08-14 06:59:35 +00:00
Brion Vibber 0cd1f4b868 * (bug 10201) SyntaxHighlight_GeSHi now shows the text unformatted along with warning if the language is invalid or unrecognized.
Uses a simple <pre> which may not be ideal but works ok. :D
Consolidated a few repeat lines.
2011-05-13 13:27:29 +00:00
Max Semenik 25fb269d86 SyntaxHighlight_GeSHi: collapse language list by default to look less scary 2011-02-25 16:38:23 +00:00
Sam Reed 8b3fe7231c Minor followup to r81865, only set dir to ltr if it's not already set to something else 2011-02-11 00:31:17 +00:00
Sam Reed 0ed4e3e390 *(bug 10081) Allow html attribute on SyntaxHighlight GeSHi extension
Patch by Umherirrender

(Seems to be all but based on the Poem implementation, as per Brions suggestion)
2011-02-10 01:59:14 +00:00
Sam Reed 40db2f22e7 Explicitally define a couple of variables 2011-01-23 09:38:33 +00:00
Sam Reed fcb04eeed7 More deprecated method call removals and updates 2010-10-29 15:32:44 +00:00
Sam Reed 29de7361fb Fixup (and add) some braces, remove trailing whitespace 2010-08-09 06:56:38 +00:00
Jeroen De Dauw 4bc3dbd009 Follow up to r70741 2010-08-09 06:25:28 +00:00
Max Semenik 973516a5cb SyntaxHighlight_GeSHi: although I haven't been able to reproduce bug 23840, this should fix it. 2010-06-12 06:27:04 +00:00
Chad Horohoe 6ecc369fbd Revert r66934 (Removing wfLoadExtensionMessages() from everything). I disagree on principle...we branch extensions for this very reason. But people want trunk extensions compatible for several versions back, meh. 2010-05-27 15:56:53 +00:00
Chad Horohoe b57547e670 Large commit. Removed 800+ references to no-op wfLoadExtensionMessages() 2010-05-26 22:25:32 +00:00
Happy-melon 0342a1a717 Follow-up to r63815: code style 2010-03-16 12:50:30 +00:00
Happy-melon d0eb05173e (bug 22848) Rm extraneous space after <span> tag, which Tidy moves outside the tag forcing a perhaps-unwanted break. 2010-03-16 12:48:12 +00:00
Max Semenik 8902d97dd0 SyntaxHighlight_GeSHi: fixed bug with <source lang=""> spewing zillion PHP warnings. Patch by Dan Barrett 2009-11-19 20:37:17 +00:00
Shinjiman e63f55da7d show the version information of GeSHi currently using, only show the version when Special:Version is loaded using the SpecialVersionExtensionTypes hook.
Link to r52546, r52550 and r52555 as there have some comments on CodeReview.
2009-07-01 19:34:01 +00:00
Shinjiman bb149b0887 revert r52546 and r52550 for slow loading for the class, per CodeReview. 2009-06-29 17:06:59 +00:00
Shinjiman b7179c44cf tweak for r52546, use require_once() to make the class file only load once. 2009-06-29 16:29:43 +00:00
Tim Starling b424069389 Added a class to the wrapper to allow site CSS to re-add the dashed borders on wikis that want them. 2009-06-24 05:39:23 +00:00
Tim Starling ae726406e2 Added a profiling section for the parser hook. 2009-06-24 05:25:32 +00:00
Brion Vibber 9406b30989 Follow-up to r50693 "Add optional $wgSyntaxHighlightDefaultLang parameter; allows people to set a default language that shows up if the lang parameter is missing."
Fix whitespace (tab/space issues) and drop duplicated strtolower() call to common code path
2009-05-18 20:28:50 +00:00
X! 72521f6b30 Add optional $wgSyntaxHighlightDefaultLang parameter; allows people to set a default language that shows up if the lang parameter is missing. 2009-05-17 15:21:37 +00:00
Siebrand Mazeland 005a5d82a9 (bug 16317) source tag error shows invalid example in german error message 2008-11-21 08:41:06 +00:00
Siebrand Mazeland a2deece649 Consistent casing for addHTML() 2008-11-06 22:20:29 +00:00
Niklas Laxström 3fdce00db1 * (bug 15634) Add The Enclosure/Header Type "none" 2008-09-28 15:30:45 +00:00
Niklas Laxström 79697ffd83 * Trim only preceeding newlines, not all whitespace
* Support for the new GESHI_HEADER_PRE_VALID in geshi 1.0.8
* Strict Standards: Non-static method SyntaxHighlight_GeSHi::validHighlightRange() should not be called statically
2008-07-11 18:12:48 +00:00
Brion Vibber f059181154 Cleanup for r37495 (adds line highlighting support to geshi plugin):
* Break input validation out to a function so it doesn't mush up main program flow readability
* Reduce denial of service attack area by imposing an arbitrary limit on the size of line ranges
* Reject 0 as a valid input line

Some further notes:
* Currently, the line numbers given for highlighting seem to ignore the 'start' line number provided for displaying line numbers. This is IMHO a bit confusing; it might be better to add the start line number in so you can specify line numbers which match what will be displayed.
* You can specify line numbers after the end of the document without complaint. It might be better to count the lines and ignore any additional ones.
2008-07-10 20:55:02 +00:00
Niklas Laxström 9bb924174a * Add highlight support: highlight=3,6-7 2008-07-10 12:45:20 +00:00
Siebrand Mazeland d31a5dc268 * use wfLoadExtensionMessages for SyntaxHighlight_GeSHi
* add version in extension credits
* update Translate extension
2008-01-11 09:05:18 +00:00
Rotem Liss 95156dcd11 Adding text-align: left to the div of <source>, to avoid problems when the text-align is set differently. 2007-12-14 16:54:00 +00:00
Rob Church 7f976ff398 (bug 11351) Normalise language names to lowercase for consistent class names, etc. 2007-09-15 16:09:30 +00:00
Rob Church 86a708ab29 Honour 'LoadAllMessages' hook; make sure messages show up in Special:Allmessages, etc. 2007-07-21 01:26:43 +00:00
Rob Church daa4578caf Spacing 2007-07-18 21:51:27 +00:00
Aryeh Gregor 1b487ec637 Avoid using CSS for semantic information like directionality. 2007-07-18 21:43:54 +00:00
Rotem Liss 50a18bcaaf Source code should be LTR: adding style. 2007-07-18 17:06:27 +00:00
Brion Vibber f4a9164e78 bug 10594 -- @import needs to be at the start of the <style> due to anal spec 2007-07-17 17:45:02 +00:00