Pma2wiki: Difference between revisions

No edit summary
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
See Also: [[Syntax highlighting]]
See Also: [[Syntax highlighting]]
<source lang=php>
<syntaxhighlight lang=php>
#!/usr/bin/php
#!/usr/bin/php
<?php
<?php
Line 9: Line 9:
* format of the table defintion 'headings' into the H2 heading format suitable for posting into MediaWiki
* format of the table defintion 'headings' into the H2 heading format suitable for posting into MediaWiki
* This process creates easy to navigate and reference SQL schema files in the wiki
* This process creates easy to navigate and reference SQL schema files in the wiki
* The exact tag output by this script (<sql> or <source lang=sql>) must correlate with the MediaWiki extension you use to get syntax highlighting
* The exact tag output by this script (<sql> or <syntaxhighlight lang=sql>) must correlate with the MediaWiki extension you use to get syntax highlighting
* In any case, you need to have a GeSHi syntax highlighting extension active in your MediaWiki installation.
* In any case, you need to have a GeSHi syntax highlighting extension active in your MediaWiki installation.
*
*
Line 85: Line 85:
$pattern = '/(CREATE TABLE [^;]+;)/U';
$pattern = '/(CREATE TABLE [^;]+;)/U';
// depends on GeSHi and which extension you have
// depends on GeSHi and which extension you have
$replacement = '<source lang=sql>
$replacement = '<syntaxhighlight lang=sql>
$1
$1
</source>
</syntaxhighlight>
';
';
$content = preg_replace ($pattern, $replacement, $content);
$content = preg_replace ($pattern, $replacement, $content);
Line 94: Line 94:
echo $content;
echo $content;
?>
?>
</source>
</syntaxhighlight>


[[Category:Wiki]]
[[Category:Wiki]]