OSDN Git Service

レビュー用に追加、削除を示すためのプラグインを追加。
authortakezoe <takezoe@871d6764-1e22-0410-b313-a55050885396>
Thu, 1 Dec 2011 15:05:01 +0000 (15:05 +0000)
committertakezoe <takezoe@871d6764-1e22-0410-b313-a55050885396>
Thu, 1 Dec 2011 15:05:01 +0000 (15:05 +0000)
takezoe/plugin/book/Add.pm [new file with mode: 0644]
takezoe/plugin/book/Del.pm [new file with mode: 0644]
takezoe/plugin/book/Install.pm
takezoe/plugin/book/Memo.pm
takezoe/plugin/book/Memolist.pm

diff --git a/takezoe/plugin/book/Add.pm b/takezoe/plugin/book/Add.pm
new file mode 100644 (file)
index 0000000..f53e75e
--- /dev/null
@@ -0,0 +1,39 @@
+################################################################################
+#
+# <p>¥Ú¡¼¥¸¤Ë¥á¥â¤òµ­½Ò¤¹¤ë¤¿¤á¤Î¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£</p>
+# <pre>
+# {{memo ¤³¤³¤Ë¥á¥â¤òµ­½Ò¤·¤Þ¤¹¡£}}
+# </pre>
+# <p>
+#   µ­½Ò¤·¤¿¥á¥â¤Ï¶¯Ä´¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Þ¤¹¡£
+#   ¤Þ¤¿¡¢memolist¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤Æ°ìÍ÷ɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+# </p>
+#
+################################################################################
+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 '<span class="add"><a name="todo-'.($#list + 1).'"></a>'.Util::escapeHTML($text).'</span>';
+}
+
+1;
diff --git a/takezoe/plugin/book/Del.pm b/takezoe/plugin/book/Del.pm
new file mode 100644 (file)
index 0000000..a1565db
--- /dev/null
@@ -0,0 +1,39 @@
+################################################################################
+#
+# <p>¥Ú¡¼¥¸¤Ë¥á¥â¤òµ­½Ò¤¹¤ë¤¿¤á¤Î¥¤¥ó¥é¥¤¥ó¥×¥é¥°¥¤¥ó¤Ç¤¹¡£</p>
+# <pre>
+# {{memo ¤³¤³¤Ë¥á¥â¤òµ­½Ò¤·¤Þ¤¹¡£}}
+# </pre>
+# <p>
+#   µ­½Ò¤·¤¿¥á¥â¤Ï¶¯Ä´¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Þ¤¹¡£
+#   ¤Þ¤¿¡¢memolist¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤Æ°ìÍ÷ɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+# </p>
+#
+################################################################################
+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 '<span class="delete"><a name="todo-'.($#list + 1).'"></a>'.Util::escapeHTML($text).'</span>';
+}
+
+1;
index 163b7ef..9610bf3 100644 (file)
@@ -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_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");
        $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;
 }
 
   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;
 div.caption {
   font-size: 80%;
   font-weight: bold;
index 4475206..427b872 100644 (file)
@@ -29,10 +29,10 @@ sub inline {
        my $wiki = shift;
        my $text = shift;
        
        my $wiki = shift;
        my $text = shift;
        
-       push(@{$self->{'memolist'}}, $text);
+       push(@{$self->{'memolist'}}, "[comment]".$text);
        my @list = @{$self->{'memolist'}};
        
        my @list = @{$self->{'memolist'}};
        
-       return '<span class="memo"><a name="todo-'.($#list + 1).'">'.Util::escapeHTML($text).'</a></span>';
+       return '<span class="memo"><a name="todo-'.($#list + 1).'"></a>'.Util::escapeHTML($text).'</span>';
 }
 
 1;
 }
 
 1;
index b62e1c5..f31cd38 100644 (file)
@@ -27,8 +27,27 @@ sub paragraph {
        my $buf = '';
        my $count = 1;
        
        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'}}){
        foreach my $memo (@{$plugin->{'memolist'}}){
-               $buf .= '<li><a href="#todo-'.$count.'">'.Util::escapeHTML($memo).'</a></li>';
+               $buf .= '<li><a href="#todo-'.$count.'">';
+               $icon = '';
+               if($memo =~ /^\[comment\]/){
+                       $icon = 'comment.png';
+               } elsif($memo =~ /^\[add\]/){
+                       $icon = 'add.png';
+               } elsif($memo =~ /^\[delete\]/){
+                       $icon = 'delete.png';
+               }
+               if($icon ne ''){
+                       $buf .= '<img src="'.$path_prefix.'plugin/book/icons/'.$icon.'" style="border: 0px; position: relative; top: 4px; padding-right: 2px;">';
+                       $memo =~ s/^\[.+?\]//;
+               }
+               $buf .= Util::escapeHTML($memo).'</a></li>';
                $count++;
        }
        
                $count++;
        }