From e3948e36cccba3b1ab3beb3fb0d8eef3d96e69b8 Mon Sep 17 00:00:00 2001 From: mitty Date: Fri, 20 May 2011 15:59:47 +0000 Subject: [PATCH] * add comments git-svn-id: https://lab.mitty.jp/svn/lab/trunk@122 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- Dev/pukiwikiplus/getsource.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dev/pukiwikiplus/getsource.pl b/Dev/pukiwikiplus/getsource.pl index 10fcc37..d2cf0af 100644 --- a/Dev/pukiwikiplus/getsource.pl +++ b/Dev/pukiwikiplus/getsource.pl @@ -9,6 +9,9 @@ use URI; use Data::Validate::URI qw(is_uri); use Encode; +## get wiki formatted source text from PukiWiki Plus! page +# '-f' option to save file automatically + if (@ARGV < 1) { print "$0: [-f] url_to_pukiwikiplus_page\n"; exit; @@ -23,6 +26,7 @@ my $url = $ARGV[0]; die "$0: '$url' is not URI" unless is_uri($url); if ($url !~ /cmd=source/ ) { + # set url to page of source plugin page (source.inc.php) $url =~ s#\?(.+)#\?cmd=source&page=$1#; if ($file) { $file = wikifile($1) . '.txt'; @@ -32,6 +36,7 @@ if ($url !~ /cmd=source/ ) { print STDERR "getting: '$url'\n"; my $source = scraper { + # scrape page with '
' tag
     process "pre#source", "source" => "TEXT";
     result "source";
 };
@@ -46,6 +51,7 @@ print encode('utf8', $text);
 
 
 sub wikifile {
+    # get wiki text filename from pagename
     my $pagename = shift @_;
     
     $pagename =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack('H2', $1)/eg;
-- 
1.7.9.5