「 official:自作プラグイン/null.inc.phpとpukiwiki.ini.phpのPKWKEXP_DISABLE_MULTILINE_PLUGIN_HACKを有効にすること 」で、同様のことが実現できます。
改造には危険を伴います。どのように実現するかは各自の判断・責任でお願いします。
//コメント
は、1行コメントでかつ、
文章 //コメント
のように、行中にコメントを書けない。
phpの/*~*/のようなコメント機能が欲しい。
コメントは表示されません
文章1<!--コメント-->文章2 文章1<!--コメント--> <!--コメント-->文章1 文章1<!--コメント-->文章2<!--コメント-->文章3 文章1<!--コメント コメント -->文章2 文章1<!--コメント //コメント<!--コメント-->コメント -->文章2
|A|B|C|<!--D|--E|--> |aaa|bbb|ccc|<!--ddd|eee|-->
文章<!--コメント コメント-->
<!--コメント コメント コメント-->文章
文章1<!--コメント コメント-->文章2は
文章1文章2と解釈されます。
改造は自己責任で |
convert_html.php,v 1.18
下の差分は旧版です。最新の差分はこちら(コメントの下のほう)。上の仕様 は最新版についての説明です。
--- convert_html.org.php Sat May 13 07:29:58 2006 +++ convert_html.php Sat May 26 14:49:15 2007 @@ -885,6 +885,20 @@ // Line Break if (substr($line, -1) == '~') $line = substr($line, 0, -1) . "\r"; + + // Escape inline and multiline comments + $line = preg_replace('/\<\!--(.*)--\>/U','',$line); + if (preg_match('/^(.*)\<\!--/U',$line, $matches)) { + $line = $matches[1]; + while (! empty($lines)) { + if (preg_match('/--\>(.*)$/U', array_shift($lines), $matches)) { + $line .= $matches[1]; + break; + } + } + } + $head = $line{0}; // replace head // Other Character if (isset($this->classes[$head])) {
if (! PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK && preg_match('/^(.*)\<\!--/U',$line, $matches)) {とする必要があると思います。
// Escape inline and multiline comments + if (preg_match('/\<\!--/',$line)) { $line = preg_replace('/\<\!--(.*)--\>/U','',$line); if (preg_match('/^(.*)\<\!--/U',$line, $matches)) { $line = $matches[1]; while (! empty($lines)) { - if (preg_match('/--\>(.*)$/U', array_shift($lines), $matches)) { + if (preg_match('/^(?!\/\/).*--\>(.*)$/U', array_shift($lines), $matches)) { $line .= $matches[1]; break; } } } + if ($line == '') { + $this->last = & $this; + continue; + } $head = $line{0}; // replace head + }上にも書きましたが、この差分は横長になり過ぎないようにタブを調整してます。
- if (preg_match('/\<\!--/',$line)) { + if (strstr($line,'<!--')) {
--- convert_html.org.php Sat May 13 07:29:58 2006 +++ convert_html.php Tue May 29 06:43:56 2007 @@ -885,6 +885,25 @@ // Line Break if (substr($line, -1) == '~') $line = substr($line, 0, -1) . "\r"; + + // Escape inline and multiline comments + if (strpos($line,'<!--') !== false) { + $line = preg_replace('/\<\!--(.*)--\>/U','',$line); + if (preg_match('/^(.*)\<\!--/U',$line, $matches)) { + $line = $matches[1]; + while (! empty($lines)) { + if (preg_match('/^(?!\/\/).*--\>(.*)$/U', array_shift($lines), $matches)) { + $line .= $matches[1]; + break; + } + } + } + if ($line == '') { + $this->last = & $this; + continue; + } + $head = $line{0}; // replace head + } // Other Character if (isset($this->classes[$head])) {