「AsciiArtsExtension」の版間の差分
提供: Yourpedia
細 (118.157.177.209 (トーク) による編集を オレリ による直前の版へ差し戻しました) |
|||
| (3人の利用者による、間の4版が非表示) | |||
| 2行目: | 2行目: | ||
# 以下のソースをコピペして、$IP/extensions/AsciiArts/aa.php を作る。 | # 以下のソースをコピペして、$IP/extensions/AsciiArts/aa.php を作る。 | ||
# LocalSettings.php に、require_once( "extensions/AsciiArts/aa.php" ); を追加する。 | # LocalSettings.php に、require_once( "extensions/AsciiArts/aa.php" ); を追加する。 | ||
| + | <!-- s --> | ||
==ソースコード== | ==ソースコード== | ||
<pre> | <pre> | ||
| − | |||
<?php | <?php | ||
if ( ! defined( 'MEDIAWIKI' ) ) | if ( ! defined( 'MEDIAWIKI' ) ) | ||
| 13行目: | 13行目: | ||
'name' => 'AsciiArts', | 'name' => 'AsciiArts', | ||
'author' => 'Beyond', | 'author' => 'Beyond', | ||
| − | 'description' => '<nowiki><aa> | + | 'description' => '<nowiki><aa>夕べのロース売れんかいなぁ!</aa></nowiki>', |
'url' => 'http://ja.yourpedia.org/wiki/AsciiArtsExtension' | 'url' => 'http://ja.yourpedia.org/wiki/AsciiArtsExtension' | ||
); | ); | ||
| 26行目: | 26行目: | ||
function asciiArts($aainput) { | function asciiArts($aainput) { | ||
$aaoutput = htmlspecialchars($aainput); | $aaoutput = htmlspecialchars($aainput); | ||
| − | return '<pre style="font-family:\'MS Pゴシック\',IPAMonaPGothic; background:#fff; border:0; margin-left: 1em;">'."$aaoutput".' | + | return '<pre style="font-family:\'MS Pゴシック\',IPAMonaPGothic; background:#fff; border:0; margin-left: 1em;">'."$aaoutput".'</pre>'; |
} | } | ||
?> | ?> | ||
| − | |||
</pre> | </pre> | ||
2020年7月12日 (日) 15:08時点における最新版
使用方法[編集]
- 以下のソースをコピペして、$IP/extensions/AsciiArts/aa.php を作る。
- LocalSettings.php に、require_once( "extensions/AsciiArts/aa.php" ); を追加する。
ソースコード[編集]
<?php
if ( ! defined( 'MEDIAWIKI' ) )
die();
$wgExtensionCredits['parserhook'][] = array(
'name' => 'AsciiArts',
'author' => 'Beyond',
'description' => '<aa>夕べのロース売れんかいなぁ!</aa>',
'url' => 'http://ja.yourpedia.org/wiki/AsciiArtsExtension'
);
$wgExtensionFunctions[] = 'wfAsciiArtsExtension';
function wfAsciiArtsExtension() {
global $wgParser;
$wgParser->setHook( 'aa', 'asciiArts' );
}
function asciiArts($aainput) {
$aaoutput = htmlspecialchars($aainput);
return '<pre style="font-family:\'MS Pゴシック\',IPAMonaPGothic; background:#fff; border:0; margin-left: 1em;">'."$aaoutput".'</pre>';
}
?>