Revisión | 3809644b6a3b69bd98de8ff214e3376e8c5a8d95 (tree) |
---|---|
Tiempo | 2007-11-11 20:02:40 |
Autor | henoheno <henoheno> |
Commiter | henoheno |
* BugTrack2/285: & => &
* BugTrack/779: Not using list() and array_pad()
* BugTrack/779: trim()
* BugTrack/779: Simplify
* Simplify: strip_htmltag() for AutoLink => strip_autolink()
* Simplify: ruby tags
@@ -1,29 +1,32 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone. |
3 | -// $Id: ruby.inc.php,v 1.6 2005/05/07 07:41:31 henoheno Exp $ | |
3 | +// $Id: ruby.inc.php,v 1.7 2007/11/11 11:02:40 henoheno Exp $ | |
4 | 4 | // |
5 | -// Ruby annotation plugin: Add a pronounciation into kanji-word or acronym(s) | |
5 | +// Ruby annotation plugin: Attach a pronounciation into kanji-word(s) or acronym(s) | |
6 | 6 | // See also about ruby: http://www.w3.org/TR/ruby/ |
7 | 7 | // |
8 | 8 | // NOTE: |
9 | 9 | // Ruby tag works with MSIE only now, |
10 | 10 | // but readable for other browsers like: 'words(pronunciation)' |
11 | 11 | |
12 | -define('PLUGIN_RUBY_USAGE', '&ruby(pronunciation){words};'); | |
12 | +define('PLUGIN_RUBY_USAGE', '&ruby(pronunciation){words};'); | |
13 | 13 | |
14 | 14 | function plugin_ruby_inline() |
15 | 15 | { |
16 | 16 | if (func_num_args() != 2) return PLUGIN_RUBY_USAGE; |
17 | 17 | |
18 | - list($ruby, $body) = func_get_args(); | |
19 | - | |
20 | - // strip_htmltag() is just for avoiding AutoLink insertion | |
21 | - $body = strip_htmltag($body); | |
18 | + $args = func_get_args(); | |
19 | + $body = trim(strip_autolink(array_pop($args))); // htmlspecialchars() already | |
20 | + $ruby = isset($args[0]) ? trim($args[0]) : ''; | |
22 | 21 | |
23 | 22 | if ($ruby == '' || $body == '') return PLUGIN_RUBY_USAGE; |
24 | 23 | |
25 | - return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' . | |
26 | - '<rt>' . htmlspecialchars($ruby) . '</rt>' . '<rp>)</rp>' . | |
24 | + return | |
25 | + '<ruby>' . | |
26 | + '<rb>' . $body . '</rb>' . | |
27 | + '<rp>(</rp>' . | |
28 | + '<rt>' . htmlspecialchars($ruby) . '</rt>' . | |
29 | + '<rp>)</rp>' . | |
27 | 30 | '</ruby>'; |
28 | 31 | } |
29 | 32 | ?> |