OSDN Git Service

書籍執筆用のプラグインをsandboxにコミットしておきます。
[fswiki/sandbox.git] / takezoe / plugin / book / Title3.pm
1 ################################################################################
2 #
3 # <p>¸«½Ð¤·3¤ËÉÕÍ¿¤¹¤ë¤³¤È¤Ç¸«½Ð¤·ÈÖ¹æ¤òÉÕÍ¿¤¹¤ë¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£</p>
4 # <pre>
5 # !{{title3}}¸«½Ð¤·3
6 # </pre>
7 #
8 ################################################################################
9 package plugin::book::Title3;
10 #==============================================================================
11 # ¥³¥ó¥¹¥È¥é¥¯¥¿
12 #==============================================================================
13 sub new {
14         my $class = shift;
15         my $self = {};
16         return bless $self,$class;
17 }
18
19 #==============================================================================
20 # ¥¤¥ó¥é¥¤¥ó¥á¥½¥Ã¥É
21 #==============================================================================
22 sub inline {
23         my $self   = shift;
24         my $wiki   = shift;
25         my $anchor = shift;
26         
27         my $chapter = $wiki->get_plugin_instance('plugin::book::Chapter');
28         my $title1 = $wiki->get_plugin_instance('plugin::book::Title1');
29         my $title2 = $wiki->get_plugin_instance('plugin::book::Title2');
30         
31         $self->{'count'}++;
32         
33         if($anchor eq ''){
34                 return $chapter->{'chapter'}.'-'.$title1->{'count'}.'-'.$title2->{'count'}.'-'.$self->{'count'}.'. ';
35         } else {
36                 return '<a name="'.Util::escapeHTML($anchor).'">'.$chapter->{'chapter'}.'-'.$title1->{'count'}.'-'.$title2->{'count'}.'-'.$self->{'count'}.'. </a>';
37         }
38 }
39
40 #==============================================================================
41 # ¥Õ¥Ã¥¯¥á¥½¥Ã¥É
42 #==============================================================================
43 sub hook {
44         my $self = shift;
45         $self->{'count'} = 0;
46 }
47
48 1;