Haddock、Cabal:如何包含源代码示例?
我是操作包的作者,其中包括示例代码。我希望将此示例代码进行 hscolored 并与由 Haddock 生成的 API 文档一起安装。
我可能必须使用自定义 Cabal 构建类型并为 Haddock 阶段创建用户挂钩。然而,我从未成功地完成这项工作。因此,我的问题是:
如何在 Haddock 中包含完整模块作为示例代码?
您能否给出一个 Cabal 用户挂钩的示例,该挂钩将 hscolor 应用于附加源代码文件
example.hs
并将结果与生成的 Haddock 文档连接起来?
I am the author of the operational package, which includes example code. I would like this example code to be hscolored and installed together with the API documentation, which is generated by Haddock.
I probably have to use a custom Cabal build type and create a user hook for the Haddock phase. However, I never managed to make this work. Hence, my question is:
How to include full modules as example code in Haddock?
Could you give an example of a Cabal user hook that applies hscolor to an additional source code file
example.hs
and joins the result with the generated Haddock documentation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是一个彻头彻尾的 Haskell nube,这是在黑暗中拍摄的,但是你不能使用 hscolour 将代码输出为 HTML,然后按照 cabal haddock --executables --hyperlink-source 的方式做一些事情吗 包含彩色 HTML?
I'm a total Haskell nube and this is a shot in the dark, but couldn't you use hscolour to output the code as HTML and then do something along the lines of cabal haddock --executables --hyperlink-source to include the colorized HTML?