Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | 'name' => 'SyntaxHighlight', |
47 | 47 | 'svn-date' => '$LastChangedDate$', |
48 | 48 | 'svn-revision' => '$LastChangedRevision$', |
49 | | - 'author' => array( 'Brion Vibber', 'Tim Starling', 'Rob Church' ), |
| 49 | + 'author' => array( 'Brion Vibber', 'Tim Starling', 'Rob Church', 'Niklas Laxström' ), |
50 | 50 | 'description' => 'Provides syntax highlighting using [http://qbnz.com/highlighter/ GeSHi Highlighter]', |
51 | 51 | 'descriptionmsg' => 'syntaxhighlight-desc', |
52 | 52 | 'url' => 'http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi', |
Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php |
— | — | @@ -45,6 +45,27 @@ |
46 | 46 | $enclose = GESHI_HEADER_DIV; |
47 | 47 | $geshi->enable_line_numbers( GESHI_FANCY_LINE_NUMBERS ); |
48 | 48 | } |
| 49 | + // Highlightning |
| 50 | + if( isset( $args['highlight'] ) ) { |
| 51 | + $lines = array(); |
| 52 | + $values = array_map( 'trim', explode( ',', $args['highlight'] ) ); |
| 53 | + foreach ( $values as $value ) { |
| 54 | + if ( ctype_digit($value) ) { |
| 55 | + $lines[] = (int) $value; |
| 56 | + } elseif ( strpos( $value, '-' ) !== false ) { |
| 57 | + list( $start, $end ) = array_map( 'trim', explode( '-', $value ) ); |
| 58 | + if ( ctype_digit($start) && ctype_digit($end) && $start < $end ) { |
| 59 | + for ($i = $start; $i <= $end; $i++ ) $lines[] = $i; |
| 60 | + } else { |
| 61 | + wfDebugLog( 'geshi', "Invalid range: $value\n" ); |
| 62 | + } |
| 63 | + } else { |
| 64 | + wfDebugLog( 'geshi', "Invalid line: $value\n" ); |
| 65 | + } |
| 66 | + } |
| 67 | + if ( count($lines) ) $geshi->highlight_lines_extra( $lines ); |
| 68 | + } |
| 69 | + |
49 | 70 | // Starting line number |
50 | 71 | if( isset( $args['start'] ) ) |
51 | 72 | $geshi->start_line_numbers_at( $args['start'] ); |