我正在尝试在YARD文档中创建一些链接。 我可以获得HTTP链接:
# I like {http://stackoverflow.com Stackoverflow}呈现为
<p>I like <a href="http://stackoverflow.com">Stackoverflow</a></p>但是电子邮件链接:
# You can email the {mailto:bugs@myproject.com bugs} list给我一个警告:
[warn]: In file `':: Cannot resolve link to mailto:bugs@myprojectmailto:bugs@myproject.com from text:并呈现为
<p>You can email the <tt>bugs</tt> list</p>我已经尝试了常规的RDoc语法链接:
bugs[mailto:bugs@myproject.com]但是YARD似乎忽略了这一点。 有谁知道更可靠的语法?
I'm trying to create some links in my YARD documentation. I can get an HTTP link:
# I like {http://stackoverflow.com Stackoverflow}renders as
<p>I like <a href="http://stackoverflow.com">Stackoverflow</a></p>But an email link:
# You can email the {mailto:bugs@myproject.com bugs} listgives me a warning:
[warn]: In file `':: Cannot resolve link to mailto:bugs@myprojectmailto:bugs@myproject.com from text:and renders as
<p>You can email the <tt>bugs</tt> list</p>I've tried the regular RDoc syntax for links:
bugs[mailto:bugs@myproject.com]but YARD seems to ignore that. Does anyone know of a more reliable syntax?
最满意答案
挖掘YARD的代码显示问题:在gems/yard-0.2.3.5/lib/yard有第(73)行:
if name.include?("://")这不允许mailto链接。 您可以用此替换此行
if name.include?("://") or name.include?("mailto:")它会按你的意愿工作......不完全理想,但这就是我现在所拥有的。
Digging into YARD's code shows the problem: in gems/yard-0.2.3.5/lib/yard there is the line (73):
if name.include?("://")which doesn't allow mailto links. You can replace this line with
if name.include?("://") or name.include?("mailto:")and it will work as you want... not exactly ideal, but that's all I've got right now.
更多推荐
发布评论