Created
February 1, 2011 05:19
-
-
Save kits/805457 to your computer and use it in GitHub Desktop.
pod2html の日本語ヘッダへのアンカーをWikipedia風に変更
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# pod2html の日本語ヘッダへのアンカーをWikipedia風に変更。 | |
# 使い方は pod2html と同じ。 | |
use strict; | |
use warnings; | |
use Pod::Html; | |
{ | |
my $anchorify = sub { | |
my ($anchor) = @_; | |
$anchor = Pod::Html::htmlify($anchor); | |
$anchor =~ s/([\x80-\xff])/sprintf '.%02X', ord($1)/ge; | |
$anchor =~ s/[^0-9A-Za-z_:.-]/_/g; | |
return $anchor; | |
}; | |
no warnings 'redefine'; | |
*Pod::Html::anchorify = $anchorify; | |
} | |
pod2html(@ARGV); | |
# =head1 日本語aaです | |
# ↓ | |
# <h1><a name=".E6.97.A5.E6.9C.AC.E8.AA.9Eaa.E3.81.A7.E3.81.99">日本語aaです</a></h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment