为“cabal install”启用 --hyperlink-source

发布于 2024-08-26 06:00:35 字数 412 浏览 5 评论 0原文

命令 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

泪眸﹌ 2024-09-02 06:00:35

目前,在使用“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.

新雨望断虹 2024-09-02 06:00:35

对我来说,这有效:

cabal update
cabal install haddock

编辑配置文件 ~/.cabal/config

启用 Documentation: True (删除行开头的“--”就可以了)


Cabal Library:

cd ...someNicePlace...    

cabal unpack Cabal

编辑文件Distribution/Simple/Setup.hs,在其中找到defaultHaddockFlags = ...

我将其中一些从False切换为True:

... 
haddockHoogle       = Flag True,
...
haddockHtml         = Flag True,
...
haddockExecutables  = Flag True,
...
haddockHscolour     = Flag True,
...

具有<唯一重要的一个(如果不想,不必更改其他)。

安装更新的 Cabal 库:

sudo cabal install --global

cabal-install(cabal shell 命令)

为了让更新的 Cabal Libary 在 cabal shell 命令中工作,我还重新安装了 cabal-install:

cd ...someNicePlace...    

cabal unpack cabal-install

sudo cabal install --global

从那时起,shell 命令 cabal -- version 对我说:

cabal-install version 1.16.0.2 
using version 1.16.0.3 of the Cabal library 

而且,根据需要,任何新的 cabal 安装现在都会安装完整的 haddock html 文档,其中默认带有超链接的源代码。

For me this worked:

cabal update
cabal install haddock

Edit config file ~/.cabal/config

Enable Documentation: True (removing "-- " at the beginning of the line is fine)


Cabal Library:

cd ...someNicePlace...    

cabal unpack Cabal

Edit file Distribution/Simple/Setup.hs, therein find defaultHaddockFlags = ...

I switched some of them from False to True:

... 
haddockHoogle       = Flag True,
...
haddockHtml         = Flag True,
...
haddockExecutables  = Flag True,
...
haddockHscolour     = Flag True,
...

having haddockHscolour the only important one (don't have to change the others if not want to).

Install updated Cabal Library:

sudo cabal install --global

cabal-install (cabal shell command)

To get the updated Cabal Libary working within cabal shell command, I reinstalled cabal-install also:

cd ...someNicePlace...    

cabal unpack cabal-install

sudo cabal install --global

Since then the shell command cabal --version says to me:

cabal-install version 1.16.0.2 
using version 1.16.0.3 of the Cabal library 

And, as wanted, any new cabal install is now installing full haddock html documentation with source codes hyperlinked as default.

江城子 2024-09-02 06:00:35

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文