From: takezoe Date: Wed, 23 Nov 2011 00:44:11 +0000 (+0000) Subject: 章の中を{{section}}で区切れるようにした。 X-Git-Url: http://git.sourceforge.jp/view?p=fswiki%2Fsandbox.git;a=commitdiff_plain;h=df55940afa0aa0420d0cf738495b09434db61182 章の中を{{section}}で区切れるようにした。 --- diff --git a/takezoe/plugin/book/Install.pm b/takezoe/plugin/book/Install.pm index fd02863..8fda54a 100644 --- a/takezoe/plugin/book/Install.pm +++ b/takezoe/plugin/book/Install.pm @@ -10,6 +10,7 @@ use plugin::book::TocParser; sub install { my $wiki = shift; $wiki->add_paragraph_plugin("chapter", "plugin::book::Chapter", "HTML"); + $wiki->add_paragraph_plugin("section", "plugin::book::Section", "HTML"); $wiki->add_inline_plugin("title1", "plugin::book::Title1", "HTML"); $wiki->add_inline_plugin("title2", "plugin::book::Title2", "HTML"); $wiki->add_inline_plugin("title3", "plugin::book::Title3", "HTML"); diff --git a/takezoe/plugin/book/Section.pm b/takezoe/plugin/book/Section.pm new file mode 100644 index 0000000..763c9f6 --- /dev/null +++ b/takezoe/plugin/book/Section.pm @@ -0,0 +1,34 @@ +################################################################################ +# +#

¾Ï¤Î¸«½Ð¤·¤ò½ÐÎϤ¹¤ë¥Ñ¥é¥°¥é¥Õ¥×¥é¥°¥¤¥ó¡£

+#
+# {{chapter 1,¤Ï¤¸¤á¤Ë}}
+# 
+#

+# ¾¤Î¥×¥é¥°¥¤¥ó¤Ç¤Ï¤³¤Î¥×¥é¥°¥¤¥ó¤ÇÄêµÁ¤·¤¿¾ÏÈÖ¹æ¤ò»È¤Ã¤Æ¿ÞɽÈÖ¹æ¤Ê¤É¤ò¿¶¤Ã¤Æ +# ¤¤¤ë¤¿¤á¡¢1¥Ú¡¼¥¸¤ËºÇÄã1¤Ä¤Ï¤³¤Î¥×¥é¥°¥¤¥ó¤òµ­½Ò¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£ +#

+# +################################################################################ +package plugin::book::Section; +#============================================================================== +# ¥³¥ó¥¹¥È¥é¥¯¥¿ +#============================================================================== +sub new { + my $class = shift; + my $self = {}; + return bless $self,$class; +} + +#============================================================================== +# ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É +#============================================================================== +sub paragraph { + my $self = shift; + my $wiki = shift; + my $title = shift; + + return '' +} + +1; diff --git a/takezoe/plugin/book/TocParser.pm b/takezoe/plugin/book/TocParser.pm index 7a62ac8..0f611b6 100644 --- a/takezoe/plugin/book/TocParser.pm +++ b/takezoe/plugin/book/TocParser.pm @@ -28,7 +28,9 @@ sub new { $self->{'outline_html'} = ""; $self->{'outline_level'} = 0; $self->{'outline_cnt'} = 0; + $self->{'outline_fix'} = 0; $self->{'pagename'} = $page; + $self->{'section_cnt'} = 0; return bless $self,$class; } @@ -40,6 +42,8 @@ sub l_headline { my $level = shift; my $obj = shift; + $level = $level + $self->{'outline_fix'}; + if($level > $self->{'display_level'}){ $self->{outline_cnt}++; return; @@ -73,8 +77,12 @@ sub l_headline { } $self->{'outline_close_'.$level} = 1; - $self->{outline_html} .= "
  • {pagename})."#p".$self->{outline_cnt}."\">$text"; - $self->{outline_cnt}++; + if($self->{'outline_fix'} == 1 && $level == 1){ + $self->{outline_html} .= "
  • $text"; + } else { + $self->{outline_html} .= "
  • {pagename})."#p".$self->{outline_cnt}."\">$text"; + $self->{outline_cnt}++; + } } #============================================================================== @@ -133,6 +141,15 @@ sub l_plugin{ $self->{'chapter'} = $plugin->{'args'}->[0]; return undef; } + if($plugin->{'command'} eq 'section'){ + if($self->{'outline_fix'} == 0){ + $self->{'outline_fix'} = 1; + $self->{'display_level'}++; + } + $self->{'section_cnt'}++; + $self->l_headline(0, [$plugin->{'args'}->[0]]); + return undef; + } # outline°Ê³°¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦ if($plugin->{command} ne "outline"){