Page MenuHomePhabricator

Add The Enclosure/Header Type "none"
Closed, ResolvedPublic

Description

Author: ricardo

Description:
Please Add the enclose type "none".

so that syntax can highlighted inline.

My revision: 37495

Patch:

  • SyntaxHighlight_GeSHi.class.php.org 2008-08-18 10:25:21.00

+++ SyntaxHighlight_GeSHi.class.php 2008-09-18 14:32:20.000000000 +0200
@@ -35,9 +35,11 @@

if( !$geshi instanceof GeSHi )
        return self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-lang
// "Enclose" parameter
  • $enclose = isset( $args['enclose'] ) && $args['enclose'] == 'div'
  • ? GESHI_HEADER_DIV
  • : GESHI_HEADER_PRE;

+ $enclose = GESHI_HEADER_PRE;
+ if (isset( $args['enclose']) ) {
+ if ( $args['enclose'] == 'div' ) { $enclose = GESHI_HEADER_DIV; }
+ if ( $args['enclose'] == 'none' ) { $enclose = GESHI_HEADER_NONE; }
+ }

// Line numbers?
if( isset( $args['line'] ) ) {
        // Force <div> mode to maintain valid XHTML, see

@@ -85,7 +87,12 @@

        $out = str_replace( "\n", '', $out );
// Register CSS
$parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" );
  • return '<div dir="ltr" style="text-align: left;">' . $out . '</div>';

+ if ( $enclose == GESHI_HEADER_NONE ) {
+ return '<span class="'.$lang.' source-'.$lang.'"> '.$out . '</span>';
+ } else {
+ return '<div dir="ltr" style="text-align: left;">' . $out . '</div>';
+ }
+

        }
}

Version: unspecified
Severity: enhancement

Details

Reference
bz15634

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:23 PM
bzimport added a project: SyntaxHighlight.
bzimport set Reference to bz15634.

Can you post the patch as an attachment please?

Are the parameters the extension accepts documented anywhere? They should probably be updated too (or written, but that is out of scope of this bug)

ricardo wrote:

Patchfile for inline Highlighting for revision 37495

attachment inline_Highlight_geshi_37495.patch ignored as obsolete

Patch does not apply to latest version in trunk. I've cleaned up the enclosure code somewhere in the middle. Can you provide a patch against the latest version? I can try to port the patch later if I have time.

ricardo wrote:

Patch for the last revision: 37495

Attached:

Added with some modifications in r41349.