OSDN Git Service

Remove charset selector, use UTF-8
[pukiwiki/pukiwiki.git] / plugin / ruby.inc.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: ruby.inc.php,v 1.8 2011/01/25 15:01:01 henoheno Exp $
4 //
5 // Ruby annotation plugin: Add a pronounciation into kanji-word or acronym(s)
6 // See also about ruby: http://www.w3.org/TR/ruby/
7 //
8 // NOTE:
9 //  Ruby tag works with MSIE only now,
10 //  but readable for other browsers like: 'words(pronunciation)'
11
12 define('PLUGIN_RUBY_USAGE', '&ruby(pronunciation){words};');
13
14 function plugin_ruby_inline()
15 {
16         if (func_num_args() != 2) return PLUGIN_RUBY_USAGE;
17
18         list($ruby, $body) = func_get_args();
19
20         // strip_htmltag() is just for avoiding AutoLink insertion
21         $body = strip_htmltag($body);
22
23         if ($ruby == '' || $body == '') return PLUGIN_RUBY_USAGE;
24
25         return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' .
26                 '<rt>' .  htmlsc($ruby) . '</rt>' . '<rp>)</rp>' .
27                 '</ruby>';
28 }
29 ?>