Changeset a1439aa in lab.git for Dev/pukiwikiplus
- Timestamp:
- May 21, 2011 12:48:14 AM (14 years ago)
- Branches:
- master, trunk
- Children:
- e3948e3
- Parents:
- 74f778c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/pukiwikiplus/getsource.pl
r74f778c ra1439aa 11 11 12 12 if (@ARGV < 1) { 13 print "$0: url_to_pukiwikiplus_page\n";13 print "$0: [-f] url_to_pukiwikiplus_page\n"; 14 14 exit; 15 } 16 17 my $file; 18 if ($ARGV[0] eq '-f') { 19 $file = shift @ARGV; 15 20 } 16 21 … … 20 25 if ($url !~ /cmd=source/ ) { 21 26 $url =~ s#\?(.+)#\?cmd=source&page=$1#; 27 if ($file) { 28 $file = wikifile($1) . '.txt'; 29 } 22 30 } 23 31 … … 31 39 my $text = $source->scrape( URI->new($url) ); 32 40 41 if ($file) { 42 print STDERR "saving: '$file'\n"; 43 open STDOUT, ">$file"; 44 } 33 45 print encode('utf8', $text); 46 47 48 sub wikifile { 49 my $pagename = shift @_; 50 51 $pagename =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack('H2', $1)/eg; 52 return uc unpack("H*", $pagename); 53 }
Note: See TracChangeset
for help on using the changeset viewer.