OSDN Git Service

書籍執筆用のプラグインをsandboxにコミットしておきます。
[fswiki/sandbox.git] / takezoe / plugin / book / Title2.pm
1 ################################################################################
2 #
3 # <p>¸«½Ð¤·2¤ËÉÕÍ¿¤¹¤ë¤³¤È¤Ç¸«½Ð¤·ÈÖ¹æ¤òÉÕÍ¿¤¹¤ë¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£</p>
4 # <pre>
5 # !!{{title2}}¸«½Ð¤·2
6 # </pre>
7 #
8 ################################################################################
9 package plugin::book::Title2;
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         
30         $self->{'count'}++;
31         
32         if($anchor eq ''){
33                 return $chapter->{'chapter'}.'-'.$title1->{'count'}.'-'.$self->{'count'}.'. ';
34         } else {
35                 return '<a name="'.Util::escapeHTML($anchor).'">'.$chapter->{'chapter'}.'-'.$title1->{'count'}.'-'.$self->{'count'}.'. </a>';
36         }
37 }
38
39 #==============================================================================
40 # ¥Õ¥Ã¥¯¥á¥½¥Ã¥É
41 #==============================================================================
42 sub hook {
43         my $self = shift;
44         $self->{'count'} = 0;
45 }
46
47 1;