OSDN Git Service

リソースのパスのプレフィックス処理を修正。
[fswiki/sandbox.git] / takezoe / plugin / book / Caption.pm
1 ################################################################################
2 #
3 # <p>¿ÞɽÈÖ¹æ¤Ê¤É¤ò½ÐÎϤ¹¤ë¤¿¤á¤Î¥Ñ¥é¥°¥é¥Õ¥×¥é¥°¥¤¥ó¤Ç¤¹¡£</p>
4 # <pre>
5 # {{caption É½,¥á¥½¥Ã¥É°ìÍ÷}}
6 # </pre>
7 # <p>°Ê²¼¤Î¤è¤¦¤ÊHTML¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£</p>
8 # <pre>
9 # &gt;div class="caption"&lt;ɽ1: ¥á¥½¥Ã¥É°ìÍ÷&gt;/div&lt;
10 # </pre>
11 # <p>
12 #   link¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤ÆÁê¸ß»²¾È¤ò¤Ï¤ë¾ì¹ç¤ÏÂè3°ú¿ô¤Ë¥ê¥ó¥¯ÍѤΥé¥Ù¥ë¤òµ­½Ò¤·¤Þ¤¹¡£
13 #   link¥×¥é¥°¥¤¥ó¤Ç¤Ï¤³¤Î¥é¥Ù¥ë¤ò»ØÄꤷ¤Æ¥ê¥ó¥¯¤òºîÀ®¤·¤Þ¤¹¡£
14 # </p>
15 # <pre>
16 # {{caption É½,¥á¥½¥Ã¥É°ìÍ÷,method_list}}
17 # ...
18 # ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï{{link method_list}}¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
19 # </pre>
20 #
21 ################################################################################
22 package plugin::book::Caption;
23 #==============================================================================
24 # ¥³¥ó¥¹¥È¥é¥¯¥¿
25 #==============================================================================
26 sub new {
27         my $class = shift;
28         my $self = {};
29         return bless $self,$class;
30 }
31
32 #==============================================================================
33 # ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É
34 #==============================================================================
35 sub paragraph {
36         my $self    = shift;
37         my $wiki    = shift;
38         my $type    = shift;
39         my $caption = shift;
40         my $anchor  = shift;
41         
42         $self->{$type}++;
43         
44         my $plugin = $wiki->get_plugin_instance('plugin::book::Chapter');
45         
46         if($anchor eq ''){
47                 return '<div class="caption">'.
48                         Util::escapeHTML($type).$plugin->{'chapter'}.'-'.$self->{$type}.': '.
49                         Util::escapeHTML($caption).'</div>';
50         } else {
51                 return '<div class="caption"><a name="'.Util::escapeHTML($anchor).'">'.
52                         Util::escapeHTML($type).$plugin->{'chapter'}.'-'.$self->{$type}.': '.
53                         Util::escapeHTML($caption).'</a></div>';
54         }
55 }
56
57 #==============================================================================
58 # ¥Õ¥Ã¥¯¥á¥½¥Ã¥É
59 #==============================================================================
60 sub hook {
61         my $self = shift;
62         foreach my $key (keys(%$self)){
63                 $self->{$key} = 0;
64         }
65 }
66
67 1;