7

The L<name> formatting code allows you to set the display text for the link if you're linking to other POD, as in L<Display Text|link_dest>, but this isn't allowed for L<scheme:...> links, such as

L<http://perldoc.perl.org/strict.html>

How do I specify a display text for such links? Alternatively, how do I manually write such a link without the angle brackets being HTML entitized by pod2html?

4

4 に答える 4

6

適切な形式は次のとおりです。

L<strict|http://perldoc.perl.org/strict.html>

http://justatheory.com/computers/programming/perl/sane-pod-links.htmlも参照してください。

于 2013-03-28T20:18:01.670 に答える
2

Pod で何か凝ったことをしたい場合、Pod トランスレーターを書くのはとても簡単です。ほとんどの作業は Pod::Simple で既に行われているため、 のケースのみを処理する必要がありますL<>Mastering Perlにそれに関する章があります。

于 2009-08-23T18:25:21.477 に答える
1

あなたはとても近かった!両方の山かっことURLの間に必要なスペースがありません。これを試して:

I think L<< http://example.com >> is the best site on the web!

(ここperldoc perlpodから下にスクロールして見つける)に従って、追加のスペースは必須です。

「より読みやすく、おそらくより「わかりやすい」方法は、エスケープするために単一の">"を必要としない区切り文字の代替セットを使用することです。perl5.5.660以降の標準のポッドフォーマッタでは、山かっこが2倍になります。 ("<<"および">>")は、開始区切り文字の直後に空白があり、終了区切り文字の直前に空白がある場合にのみ使用できます。たとえば、次の方法でうまくいきます。 "

       C<< $a <=> $b >>
于 2010-10-02T01:30:56.363 に答える
1

http://perldoc.perl.org/perlpod.html#Formatting-Codes

L<<a href="http://www.perl.org/">http://www.perl.org/</a>>

あなたが指摘するように、これはうまくいくように見えますが、おそらく私はあなたの質問を誤解しましたか?

編集: pod2html はそのアプローチを好まないようです。
私はもう少し複雑な解決策を見つけました。

https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/howdoi/?p=114


#!/usr/bin/perl                                                                                                              
use strict;
use warnings;
use Pod::2::html;


my $pod_file =  $ARGV[0];
my $template =  $ARGV[1];

# Create pod2html object                                                                                                    
my $pod = Pod::2::html->new($pod_file);

# The path to the HTML template                                                                                             
$pod->template($template);

# The formatted HTML will go to STDOUT                                                                                      
$pod->readpod();

私はこれをテストしましたが、一般的な html の補間に問題がないように思われるため、実際には L<> タグはまったく必要ありません。これは私にとってまともな解決策のようです。

于 2009-08-23T03:51:06.597 に答える