OSDN Git Service

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