From: takezoe Date: Thu, 1 Dec 2011 15:05:01 +0000 (+0000) Subject: レビュー用に追加、削除を示すためのプラグインを追加。 X-Git-Url: http://git.osdn.net/view?p=fswiki%2Fsandbox.git;a=commitdiff_plain;h=86fd504e9134f536427542983c901f1ede680f87 レビュー用に追加、削除を示すためのプラグインを追加。 --- diff --git a/takezoe/plugin/book/Add.pm b/takezoe/plugin/book/Add.pm new file mode 100644 index 0000000..f53e75e --- /dev/null +++ b/takezoe/plugin/book/Add.pm @@ -0,0 +1,39 @@ +################################################################################ +# +#

¥Ú¡¼¥¸¤Ë¥á¥â¤òµ­½Ò¤¹¤ë¤¿¤á¤Î¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£

+#
+# {{memo ¤³¤³¤Ë¥á¥â¤òµ­½Ò¤·¤Þ¤¹¡£}}
+# 
+#

+# µ­½Ò¤·¤¿¥á¥â¤Ï¶¯Ä´¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Þ¤¹¡£ +# ¤Þ¤¿¡¢memolist¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤Æ°ìÍ÷ɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ +#

+# +################################################################################ +package plugin::book::Add; +#============================================================================== +# ¥³¥ó¥¹¥È¥é¥¯¥¿ +#============================================================================== +sub new { + my $class = shift; + my $self = {}; + $self->{'todo'} = []; + return bless $self,$class; +} + +#============================================================================== +# ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É +#============================================================================== +sub inline { + my $self = shift; + my $wiki = shift; + my $text = shift; + + my $plugin = $wiki->get_plugin_instance('plugin::book::Memo'); + push(@{$plugin->{'memolist'}}, "[add]".$text); + my @list = @{$plugin->{'memolist'}}; + + return ''.Util::escapeHTML($text).''; +} + +1; diff --git a/takezoe/plugin/book/Del.pm b/takezoe/plugin/book/Del.pm new file mode 100644 index 0000000..a1565db --- /dev/null +++ b/takezoe/plugin/book/Del.pm @@ -0,0 +1,39 @@ +################################################################################ +# +#

¥Ú¡¼¥¸¤Ë¥á¥â¤òµ­½Ò¤¹¤ë¤¿¤á¤Î¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£

+#
+# {{memo ¤³¤³¤Ë¥á¥â¤òµ­½Ò¤·¤Þ¤¹¡£}}
+# 
+#

+# µ­½Ò¤·¤¿¥á¥â¤Ï¶¯Ä´¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Þ¤¹¡£ +# ¤Þ¤¿¡¢memolist¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤Æ°ìÍ÷ɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ +#

+# +################################################################################ +package plugin::book::Del; +#============================================================================== +# ¥³¥ó¥¹¥È¥é¥¯¥¿ +#============================================================================== +sub new { + my $class = shift; + my $self = {}; + $self->{'todo'} = []; + return bless $self,$class; +} + +#============================================================================== +# ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É +#============================================================================== +sub inline { + my $self = shift; + my $wiki = shift; + my $text = shift; + + my $plugin = $wiki->get_plugin_instance('plugin::book::Memo'); + push(@{$plugin->{'memolist'}}, "[delete]".$text); + my @list = @{$plugin->{'memolist'}}; + + return ''.Util::escapeHTML($text).''; +} + +1; diff --git a/takezoe/plugin/book/Install.pm b/takezoe/plugin/book/Install.pm index 163b7ef..9610bf3 100644 --- a/takezoe/plugin/book/Install.pm +++ b/takezoe/plugin/book/Install.pm @@ -26,6 +26,8 @@ sub install { $wiki->add_block_plugin("box" ,"plugin::book::Box" ,"HTML"); $wiki->add_inline_plugin("memo", "plugin::book::Memo", "HTML"); + $wiki->add_inline_plugin("add", "plugin::book::Add", "HTML"); + $wiki->add_inline_plugin("del", "plugin::book::Del", "HTML"); $wiki->add_paragraph_plugin("memolist", "plugin::book::Memolist", "HTML"); $wiki->add_inline_plugin("wordcount", "plugin::book::Wordcount", "HTML"); @@ -89,6 +91,16 @@ span.memo { margin-right: 2x; } +span.delete { + color: blue; + text-decoration: line-through; +} + +span.add { + color: red; + text-decoration: underline; +} + div.caption { font-size: 80%; font-weight: bold; diff --git a/takezoe/plugin/book/Memo.pm b/takezoe/plugin/book/Memo.pm index 4475206..427b872 100644 --- a/takezoe/plugin/book/Memo.pm +++ b/takezoe/plugin/book/Memo.pm @@ -29,10 +29,10 @@ sub inline { my $wiki = shift; my $text = shift; - push(@{$self->{'memolist'}}, $text); + push(@{$self->{'memolist'}}, "[comment]".$text); my @list = @{$self->{'memolist'}}; - return ''.Util::escapeHTML($text).''; + return ''.Util::escapeHTML($text).''; } 1; diff --git a/takezoe/plugin/book/Memolist.pm b/takezoe/plugin/book/Memolist.pm index b62e1c5..f31cd38 100644 --- a/takezoe/plugin/book/Memolist.pm +++ b/takezoe/plugin/book/Memolist.pm @@ -27,8 +27,27 @@ sub paragraph { my $buf = ''; my $count = 1; + my @paths = split(/\//, $wiki->get_CGI()->path_info()); + my $path_prefix = ''; + for(my $i = 0; $i < $#paths; $i++){ + $path_prefix .= '../'; + } + foreach my $memo (@{$plugin->{'memolist'}}){ - $buf .= '
  • '.Util::escapeHTML($memo).'
  • '; + $buf .= '
  • '; + $icon = ''; + if($memo =~ /^\[comment\]/){ + $icon = 'comment.png'; + } elsif($memo =~ /^\[add\]/){ + $icon = 'add.png'; + } elsif($memo =~ /^\[delete\]/){ + $icon = 'delete.png'; + } + if($icon ne ''){ + $buf .= ''; + $memo =~ s/^\[.+?\]//; + } + $buf .= Util::escapeHTML($memo).'
  • '; $count++; }