OSDN Git Service

Cleanup. Added comments. Shrink. Show usage
authorhenoheno <henoheno>
Tue, 4 Jan 2005 14:25:24 +0000 (23:25 +0900)
committerhenoheno <henoheno>
Tue, 4 Jan 2005 14:25:24 +0000 (23:25 +0900)
plugin/ruby.inc.php

index 5a22190..36d25ad 100644 (file)
@@ -1,25 +1,25 @@
 <?php
-/////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
+// $Id: ruby.inc.php,v 1.5 2005/01/04 14:25:24 henoheno Exp $
 //
-// $Id: ruby.inc.php,v 1.4 2004/07/31 03:09:20 henoheno Exp $
+// Ruby annotation plugin: Add a pronounciation into kanji-word or acronym(s)
+// See also about ruby: http://www.w3.org/TR/ruby/
 //
+// NOTE:
+//  Ruby tag works with MSIE only now,
+//  but readable for other browsers like: 'words(pronunciation)'
+
+define('PLUGIN_RUBY_USAGE', '&ruby(pronunciation){words};');
 
 function plugin_ruby_inline()
 {
-       if (func_num_args() != 2)
-       {
-               return FALSE;
-       }
-
-       list($ruby,$body) = func_get_args();
+       if (func_num_args() != 2) return PLUGIN_RUBY_USAGE;
 
-       if ($ruby == '' or $body == '')
-       {
-               return FALSE;
-       }
+       list($ruby, $body) = func_get_args();
+       if ($ruby == '' || $body == '') return PLUGIN_RUBY_USAGE;
 
-       $s_ruby = htmlspecialchars($ruby);
-       return "<ruby><rb>$body</rb><rp>(</rp><rt>$s_ruby</rt><rp>)</rp></ruby>";
+       return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' .
+               '<rt>' .  htmlspecialchars($ruby) . '</rt>' . '<rp>)</rp>' .
+               '</ruby>';
 }
 ?>