#author("2019-08-03T10:25:58+09:00","","") #author("2020-01-08T17:58:19+09:00","","") ** emphasis.inc.php [#wdd83cf6] |RIGHT:100|LEFT:360|c |~サマリ|圏点表示| |~リビジョン|1.01| |~対応バージョン|1.5.x| |~投稿者|[[M.Taniguchi]]| |~投稿日|&new{2019-08-03 (土) 00:48:46};| **概要 [#oba072a8] 文字列に圏点(傍点・脇点)を付加するプラグイン。&br; CSS3の text-emphasis-style を利用するため、対応ブラウザーでのみ有効。 **使い方 [#rcb135cf] -&emphasis(){文字列} -&emphasis(圏点種別){文字列} &br;''引数'' -文字列 … 圏点を付加したい文字列 -圏点種別 … [filled|open] [dot|circle|double-circle|triangle|sesame] (CSSの text-emphasis-style 構文に準じる。省略時のデフォルトは filled circle) &br;''使用例'' これは&emphasis(){強調文字列}です。 **コード [#m0f82c40] emphasis.inc.php emphasis.inc.php~ (下記のコードをコピーして、plugin ディレクトリに emphasis.inc.php というファイル名で保存してください) <?php /* PukiWiki - Yet another WikiWikiWeb clone. emphasis.inc.php, v1.01 2019 M.Taniguchi License: GPL v3 or (at your option) any later version 文字列に圏点(傍点・脇点)を付加するPukiWiki用プラグイン。 CSS3の text-emphasis-style を利用するため、対応ブラウザーでのみ有効。 使い方: &emphasis(){文字列} &emphasis(圏点種別){文字列} 引数: 文字列 … 圏点を付加したい文字列 圏点種別 … [filled|open] [dot|circle|double-circle|triangle|sesame](CSSの text-emphasis-style 構文に準じる。省略時のデフォルトは filled circle) */ define('PLUGIN_EMPHASIS_USAGE', '&emphasis([emphasis type]){words};'); define('PLUGIN_EMPHASIS_CLASS', false); // style属性の代わりにclass属性を付加 function plugin_emphasis_inline() { $argNum = func_num_args(); if ($argNum <= 0) return PLUGIN_EMPHASIS_USAGE; $emphasis = 'filled'; if ($argNum == 1) { list($body) = func_get_args(); } else { list($emphasis, $body) = func_get_args(); } $body = strip_htmltag($body); if ($body == '') return PLUGIN_EMPHASIS_USAGE; $emphasis = strip_htmltag($emphasis); if (PLUGIN_EMPHASIS_CLASS) { $emphasis = str_replace(' ', '-', $emphasis); $html = '<span class="emphasis-' . $emphasis . '">' . $body . '</span>'; } else { $html = '<span style="-webkit-text-emphasis-style:' . $emphasis . ';text-emphasis-style:' . $emphasis . ';">' . $body . '</span>'; } return $html; } ?> #br ''ダウンロード''&br; https''':'''//misc.masatotaniguchi.jp/pukiwiki-plugins#h.p_j7qc_-HXcfJo **ライセンス [#z5e38841] GPL v3 **ユーザ定義ルール版 [#o76d05e7] このプラグインを導入しなくても、default.ini.php の $line_rules に次の記述を追加すれば同様の機能を実現できます。&br; プラグインを作ったあとで気づきました。 'EMPHASIS\(([^\(\)]*)\){([^}]*)}' => '<span style="-webkit-text-emphasis-style:$1;text-emphasis-style:$1">$2</span>', #br ''使い方'' EMPHASIS(filled){強調したい文字列}&br; EMPHASIS(open sesame){強調したい文字列}&br; 等