如何在 Pod 的 L 中添加带有 URL 的链接文本?
如果您要链接到其他 POD,则 L
格式化代码允许您设置链接的显示文本,如 L
中所示,但这对于 L
链接是不允许的,例如
L<http://perldoc.perl.org/strict.html>
如何为此类链接指定显示文本?或者,如何手动编写这样的链接,而无需由 pod2html
实体化的 HTML 尖括号?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正确的格式是这样的:
另请参阅 http://justatheory.com/computers /programming/perl/sane-pod-links.html
The proper format is this:
See also http://justatheory.com/computers/programming/perl/sane-pod-links.html
如果你想用你的 Pod 做一些奇特的事情,那么编写一个 Pod 翻译器真的很容易。 Pod::Simple 中已经为您完成了大部分工作,因此您只需处理
L<>
的情况。 Mastering Perl 中有一个关于它的章节。If you want to do something fancy with your Pod, it's really easy to write a Pod translator. Most of the work is already done for you in Pod::Simple, so you only need to handle the cases for
L<>
. There's a chapter in Mastering Perl about it.http://perldoc.perl.org/perlpod.html#Formatting-Codes
正如您所指出的,看起来这应该可行,但也许我误解了您的问题?
编辑:
看来 pod2html 不喜欢这种方法。
找到了一个稍微复杂的解决方案
我在https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/howdoi/?p=114
我对此进行了测试,似乎没有问题插入通用 html,这样您实际上就不需要 L<> 了。根本没有标签。
这对我来说似乎是一个不错的解决方案。
http://perldoc.perl.org/perlpod.html#Formatting-Codes
As you point out, it looks like this should work, but perhaps I've misunderstood your question?
EDIT:
It seems that pod2html does not like that approach.
I found a slightly more involved solution at,
https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/howdoi/?p=114
I tested this out and it seems to have no problem interpolating generic html, so that you don't actually need th L<> tag at all.
This seems like a decent solution to me.
你们太接近了!您在尖括号和 URL 之间缺少必需的空格。试试这个:
根据
perldoc perlpod
,额外的空间是强制性的(从You were SO close! You're missing a required space between both angle brackets and the URL. Try this:
The extra space is mandatory according to
perldoc perlpod
(scroll down from here to find it):