Extension talk:SyntaxHighlight GeSHi

From MediaWiki.org
Jump to: navigation, search
An archive box Archives 

2015[edit | edit source]

Code with <dl>s cause bad things[edit | edit source]

There's a bug that I'm running into:

;Here's a dt
:Here's a dd that contains code with line numbers
:<syntaxhighlight lang="lua" line="GESHI_FANCY_LINE_NUMBERS">
print "Everything is ok"
print "Everything is still ok"
</syntaxhighlight>
: And here's one that doesn't have numbers
:<syntaxhighlight lang="lua">
print "Everything is ok"
print "Everything is no longer ok"
</syntaxhighlight>
:That did not work so well...

Gives:

Here's a dt
Here's a dd that contains code with line numbers
1 print "Everything is ok"
2 print "Everything is still ok"
And here's one that doesn't have numbers
print "Everything is ok"
print "Everything is no longer ok"
That did not work so well...

Eric Wieser (talk) 19:28, 22 May 2015 (UTC)

Loading method[edit | edit source]

Hello, It is said in the extension's wikipage that SyntaxHighlight_GeSHi should be load with :

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

In my case (mw 1.24), it breaks the server (it gives blank page for every requests)

This worked fine :

require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php";

Can be a good idea to adapt the page to avoid other mistakes.

Thanks for your work !

Jona (talk) 07:41, 22 June 2015 (UTC)

Thanks for mentioning this. This was documented on the extension's page by now. --[[kgh]] (talk) 12:53, 22 July 2015 (UTC)

Wrong C++ highlighting (solved)[edit | edit source]

This is a bug report for the C++ lexer, where can I post it? The GeSHi project in the link on the top of this site does not longer exist … --Prog (talk) 20:18, 26 June 2015 (UTC)
I have reported it at pygments, the new base of the SyntaxHighlight extension. --Prog (talk) 15:07, 28 June 2015 (UTC)

I have some wrong highlightings in the Version on de.wikibooks (same as here):

// integer literals:
234;        // decimal, OK
0234;       // octal, OK
0x1234abCD; // hexadecimal, OK
0X1234abCD; // hexadecimal, fail
0b1010;     // binary, fail
0B1010;     // binary, fail

1;        // OK
1u;       // OK
1U;       // OK
1l;       // OK
1L;       // OK
1ll;      // OK
1LL;      // OK
1ul;      // OK
1Ul;      // OK
1uL;      // OK
1UL;      // OK
1ull;     // OK
1Ull;     // OK
1uLL;     // OK
1ULL;     // OK

01;        // OK
01u;       // OK
01U;       // OK
01l;       // OK
01L;       // OK
01ll;      // OK
01LL;      // OK
01ul;      // OK
01Ul;      // OK
01uL;      // OK
01UL;      // OK
01ull;     // OK
01Ull;     // OK
01uLL;     // OK
01ULL;     // OK

0x1;        // OK
0x1u;       // OK
0x1U;       // OK
0x1l;       // OK
0x1L;       // OK
0x1ll;      // OK
0x1LL;      // OK
0x1ul;      // OK
0x1Ul;      // OK
0x1uL;      // OK
0x1UL;      // OK
0x1ull;     // OK
0x1Ull;     // OK
0x1uLL;     // OK
0x1ULL;     // OK

0b1;        // fail
0b1u;       // fail
0b1U;       // fail
0b1l;       // fail
0b1L;       // fail
0b1ll;      // fail
0b1LL;      // fail
0b1ul;      // fail
0b1Ul;      // fail
0b1uL;      // fail
0b1UL;      // fail
0b1ull;     // fail
0b1Ull;     // fail
0b1uLL;     // fail
0b1ULL;     // fail

// integer literals with ' as separator always fail:
1'123'456'789;    // same as 1234567890
0123'456;         // same as 0123456
0xABCD'1234;      // same as 0xABCD1234
0XABCD'1234;      // same as 0XABCD1234
0b1111'0000'0000; // same as 0b111100000000
0B1111'0000'0000; // same as 0B111100000000
// the ' can appear as separator on every position of an integer but for direct
// after a prefix (0, 0b, 0B, 0x or 0X), after another ' ('' is not allowed)
// and of course at the begin and after the last _digit_ (not suffix) of an integer literal

978'3'446'43981'8; // is a correct integer literal, same as 9783446439818
// (it is an ISBN, as example for a not equidistant separation use case)

// floating point literals:
4.24;    // OK
4.24f;   // OK
4.24F;   // OK
4.24l;   // The 'l' must be part of the literal
4.24L;   // The 'L' must be part of the literal

4.2e4;   // OK
4.2e+4;  // OK
4.2e-4;  // OK
4.2e4f;  // The 'f' must be part of the literal
4.2e+4f; // The 'f' must be part of the literal
4.2e-4f; // The 'f' must be part of the literal
4.2e4F;  // The 'F' must be part of the literal
4.2e+4F; // The 'F' must be part of the literal
4.2e-4F; // The 'F' must be part of the literal
4.2e4l;  // OK
4.2e+4l; // OK
4.2e-4l; // OK
4.2e4L;  // OK
4.2e+4L; // OK
4.2e-4L; // OK

4.2E4;   // OK
4.2E+4;  // OK
4.2E-4;  // OK
4.2E4f;  // The 'f' must be part of the literal
4.2E+4f; // The 'f' must be part of the literal
4.2E-4f; // The 'f' must be part of the literal
4.2E4F;  // The 'F' must be part of the literal
4.2E+4F; // The 'F' must be part of the literal
4.2E-4F; // The 'F' must be part of the literal
4.2E4l;  // OK
4.2E+4l; // OK
4.2E-4l; // OK
4.2E4L;  // OK
4.2E+4L; // OK
4.2E-4L; // OK

// character and c-string literals:
'a';            // OK
u'a';           // The 'u' must be part of the literal
U'a';           // The 'U' must be part of the literal
L'a';           // OK
"I am a Text";  // OK
u"I am a Text"; // The 'u' must be part of the literal
U"I am a Text"; // The 'U' must be part of the literal
L"I am a Text"; // OK

// also all raw string literals are not supported

// with C++17 the following literals will also become correct:
// --> begin C++17
u8'a';
u8"I am a Text";
// <-- end C++17

Here are the formal definitions of C++ literals:

Kind regards! --Prog (talk) 18:57, 26 June 2015 (UTC)

line property destroys copy & paste code (solved)[edit | edit source]

When I use the line property, I can't select the source without the line numbers:

1 def quickSort(arr):
2     less = []

This is very disruptive! The line property is a very nice feature, but it destroys all my code examples when I use copy & paste, so I can not use it without much trouble for the readers. --Prog (talk) 20:16, 26 June 2015 (UTC)

solved via CSS: .mw-highlight .lineno { user-select:none; } on Mediawiki:common.css. --Prog (talk) 15:37, 28 June 2015 (UTC)

MediaWiki:Geshi.css[edit | edit source]

Since the GeSHi update, all the present code is non-functional, as none of the referenced classes are no longer used. However, what is the status of MediaWiki:Geshi.css? Is it still loaded? -- [[User:Edokter]] {{talk}} 14:42, 28 June 2015 (UTC)

I guess this needs to be filed on Phabricator. Currently no developer seems to be involved in looking at this talk page. Cheers --[[kgh]] (talk) 12:51, 22 July 2015 (UTC)
Doesn't seem even basic diligence was exercised in testing it or considering the needs of the vast number of end users, given the large number of breaking changes. I wonder why this couldn't be done as a new alternate extension for people who weren't happy with the GeSHi-based one instead of overwriting what was a stable product for years. --QuasarEE (talk) 16:22, 24 July 2015 (UTC)

inline[edit | edit source]

Please deprecate inline and suggest enclose="none" for proper XML. Some of us (=me+maybe others) still recall the hilarious disabled="disabled" in XHTML1, and not all backward steps in HTML5 are better than XHTML1 transitional. –Be..anyone (talk) 22:19, 16 July 2015 (UTC)

Can't use SyntaxHighlight inline with a list[edit | edit source]

In the past i was able to use the extension Extension:Code with a list like this,

* the code
*: <code lang="diff">
--- common.inc  2015-03-06 00:32:26.000000000 +0200
+++ /tmp/drupal-6.21/includes/common.inc        2011-05-25 23:02:48.000000000 +0300
@@ -1901,9 +1901,7 @@
       // starting with "ad*".
       $filename = 'css_'. md5(serialize($types) . $query_string) .'.css';
       $preprocess_file = drupal_build_css_cache($types, $filename);
-         // HACKED - Asaph - added title to the CSS link tag
-      $output .= '<link type="text/css" title="default" rel="stylesheet" media="'. $media .'" href="'. base_path() . $preprocess_file .'" />'."\n";
-      //$output .= '<link type="text/css" rel="stylesheet" media="'. $media .'" href="'. base_path() . $preprocess_file .'" />'."\n";
+      $output .= '<link type="text/css" rel="stylesheet" media="'. $media .'" href="'. base_path() . $preprocess_file .'" />'."\n";
     }
   }

</code>

And the code block was indent correctly.


But now when i use SyntaxHighlight the same way it brakes horribly (you can see it here http://imgur.com/a/wCjp8), and i need to put the opening tag on a new line to make it work.

I'm running

  • MW 1.25.1
  • SyntaxHighlight 1.0.8.12

-- UPDATE I downloaded a new version of SyntaxHighlight (Version 2.0) from the git, extracted it, and installed with composer, and it seems to work like before.

REL1_24 currently broken[edit | edit source]

Filed as task T106383

To fix this line 39 of "SyntaxHighlight_GeSHi.php" has to be commented out. Cheers --[[kgh]] (talk) 12:49, 22 July 2015 (UTC)