为“cabal install”启用 --hyperlink-source
命令 cabal haddock
有非常有用的 --hyperlink-source 选项。 我希望在使用cabal install
构建文档时具有源超链接。
票证 #517 似乎就是这样: http://hackage.haskell.org/ trac/hackage/ticket/517
但是,也许可以通过 ~/.cabal/config 文件设置此标志?
如果没有,如何在不安装 Cabal-1.9 的情况下使用 #517 的补丁进行 cabal-install 构建,而 Cabal-1.9 目前是强制性的(由于 12 月的一个补丁)?
The command cabal haddock
has very useful --hyperlink-source option.
I would like to have the source hyperlinked when building documentation with cabal install
.
The ticket #517 seems to be just about it: http://hackage.haskell.org/trac/hackage/ticket/517
However, perhaps it is possible to set this flag via ~/.cabal/config file?
If not, how can I get working cabal-install build with the patch from #517 without installing Cabal-1.9, which is currently mandatory (due to one patch from December)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
目前,在使用“all in one”
cabal install
命令时,您无法获得与--hyperlink-source
选项等效的选项。您引用的票正是关于这个问题的。Currently you cannot get the equivalent of the
--hyperlink-source
option when using the "all in one"cabal install
command. The ticket you cite is exactly about this issue.对我来说,这有效:
编辑配置文件
~/.cabal/config
启用
Documentation: True
(删除行开头的“--”就可以了)Cabal Library:
编辑文件
Distribution/Simple/Setup.hs
,在其中找到defaultHaddockFlags = ...
我将其中一些从False切换为True:
具有<唯一重要的一个(如果不想,不必更改其他)。
安装更新的 Cabal 库:
cabal-install(cabal shell 命令)
为了让更新的 Cabal Libary 在 cabal shell 命令中工作,我还重新安装了 cabal-install:
从那时起,shell 命令
cabal -- version
对我说:而且,根据需要,任何新的 cabal 安装现在都会安装完整的 haddock html 文档,其中默认带有超链接的源代码。
For me this worked:
Edit config file
~/.cabal/config
Enable
Documentation: True
(removing "-- " at the beginning of the line is fine)Cabal Library:
Edit file
Distribution/Simple/Setup.hs
, therein finddefaultHaddockFlags = ...
I switched some of them from False to True:
having haddockHscolour the only important one (don't have to change the others if not want to).
Install updated Cabal Library:
cabal-install (cabal shell command)
To get the updated Cabal Libary working within cabal shell command, I reinstalled cabal-install also:
Since then the shell command
cabal --version
says to me:And, as wanted, any new cabal install is now installing full haddock html documentation with source codes hyperlinked as default.
Ticket #517 是关于通过 cabal 传递 haddock 选项,例如如果您有特殊需求,例如构建 hoogle 数据库或使用不同的 CSS,
大多数用户会对标准 haddock 和超链接源感到满意,这在 Cabal-1.8 中是可能的。票号#517适用于您有更大需求的情况。
只需调用 cabal haddock --hyperlink-source 就可以解决问题。
如果您希望将此设置为默认值,您可以按照您提到的方式编辑
~/.cabal/config
。Ticket #517 is about passing haddock options via cabal, like if you have special needs like building a hoogle database or usa a different CSS
Most users will be happy with standard haddock and hyperlinked sources though, which is possible with Cabal-1.8. Ticket #517 is if you have bigger needs.
Simply calling
cabal haddock --hyperlink-source
should do the trick.If you want this as the default, you can edit
~/.cabal/config
as you mentioned.