Mediawiki: Difference between revisions
Jump to navigation
Jump to search
(→Miscellaneous: Special:Version) |
(→SyntaxHighlight GeSHi: Patch to restore GeSHi 1.0.7-like formatting) |
||
Line 41: | Line 41: | ||
This extension adds the <tt><source></tt> tag to present formatted source code. |
This extension adds the <tt><source></tt> tag to present formatted source code. |
||
See official [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi page]. |
See official [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi page]. |
||
==== Restoring 1.0.7.# output - solving <tt><pre></tt> formatting problem ==== |
|||
Since at least version ''r24298 (July 21, 2007)'' (with ''GeSHi version 1.0.8''), <tt><source></tt> tag does not match usual formatting applied for <tt><pre></tt> tags. This is because the extension applies by default the new GeSHi header style <tt>[http://qbnz.com/highlighter/geshi-doc.html#the-code-container GESHI_HEADER_PRE_VALID]</tt>. The following patch allows to restore the old formatting when there is no attribute <tt>line</tt>. It also introduces a new option '''<tt>valid</tt>''' to attribute <tt>enclose</tt> to force application of header style <tt>GESHI_HEADER_PRE_VALID</tt> |
|||
<pre> |
|||
--- SyntaxHighlight_GeSHi.class.php.old 2008-09-07 23:24:37.000000000 +0200 |
|||
+++ SyntaxHighlight_GeSHi.class.php 2008-09-07 23:33:15.000000000 +0200 |
|||
@@ -39,7 +39,7 @@ |
|||
// "Enclose" parameter |
|||
if ( isset( $args['enclose'] ) && $args['enclose'] == 'div' ) { |
|||
$enclose = GESHI_HEADER_DIV; |
|||
- } elseif ( defined('GESHI_HEADER_PRE_VALID') ) { |
|||
+ } elseif ( (isset( $args['line'] ) || isset( $args['enclose'] ) && $args['enclose'] == 'valid' ) && defined('GESHI_HEADER_PRE_VALID') ) { |
|||
// Since version 1.0.8 geshi can produce valid pre, but we need to check for it |
|||
$enclose = GESHI_HEADER_PRE_VALID; |
|||
} elseif( isset( $args['line'] ) ) { |
|||
</pre> |
|||
Example: the following code |
|||
<pre> |
|||
After the following command, <source lang="bash" enclose="valid"> % cat ~/hello.c</source> you'll get the following output |
|||
<source lang="c"> |
|||
#include <stdio.h> |
|||
int main(int,int) |
|||
{ |
|||
printf("Hello, World!\n"); |
|||
return 0; |
|||
} |
|||
</source> |
|||
</pre> |
|||
gives: |
|||
{| |
|||
| || || || |
|||
After the following command, <source lang="bash" enclose="valid"> % cat ~/hello.c</source> you'll get the following output |
|||
<source lang="c"> |
|||
#include <stdio.h> |
|||
int main(int,int) |
|||
{ |
|||
printf("Hello, World!\n"); |
|||
return 0; |
|||
} |
|||
</source> |
|||
|} |
Revision as of 22:01, 7 September 2008
Keyboard shortcuts
- Reference page in wikipedia
- page explaining how to change keyboard shortcut using user custom stylesheet.
- Most frequent keyboard shortcuts (accesskey default is alt+shift):
accesskey-edit | e |
accesskey-preview | p |
accesskey-save | s |
accesskey-search | f |
Access Restriction
See these pages for implementing access restriction in MediaWiki:
- A page that implement per-page access restriction [1].
- Another way to hide pages [2].
- See sourceforge project.
- Yet another extension [3].
- Security problem with access restriction extension:
- Some information on how to create custom namespaces [6].
Miscellaneous
- Page Special:Version produces a complete list of all extensions installed on the wiki.
Extensions
SyntaxHighlight GeSHi
This extension adds the <source> tag to present formatted source code. See official page.
Restoring 1.0.7.# output - solving <pre> formatting problem
Since at least version r24298 (July 21, 2007) (with GeSHi version 1.0.8), <source> tag does not match usual formatting applied for <pre> tags. This is because the extension applies by default the new GeSHi header style GESHI_HEADER_PRE_VALID. The following patch allows to restore the old formatting when there is no attribute line. It also introduces a new option valid to attribute enclose to force application of header style GESHI_HEADER_PRE_VALID
--- SyntaxHighlight_GeSHi.class.php.old 2008-09-07 23:24:37.000000000 +0200 +++ SyntaxHighlight_GeSHi.class.php 2008-09-07 23:33:15.000000000 +0200 @@ -39,7 +39,7 @@ // "Enclose" parameter if ( isset( $args['enclose'] ) && $args['enclose'] == 'div' ) { $enclose = GESHI_HEADER_DIV; - } elseif ( defined('GESHI_HEADER_PRE_VALID') ) { + } elseif ( (isset( $args['line'] ) || isset( $args['enclose'] ) && $args['enclose'] == 'valid' ) && defined('GESHI_HEADER_PRE_VALID') ) { // Since version 1.0.8 geshi can produce valid pre, but we need to check for it $enclose = GESHI_HEADER_PRE_VALID; } elseif( isset( $args['line'] ) ) {
Example: the following code
After the following command, <source lang="bash" enclose="valid"> % cat ~/hello.c</source> you'll get the following output <source lang="c"> #include <stdio.h> int main(int,int) { printf("Hello, World!\n"); return 0; } </source>
gives:
After the following command, % cat ~/hello.c
#include <stdio.h>
int main(int,int)
{
printf("Hello, World!\n");
return 0;
}
|