我正在尝试用Racket的scribble/lp编写一个小例子程序.该项目的来源是在Github上.
我遇到的问题是编织html中的链接断开.我已将它作为gh页面提供.对于该项目.
使用命令'Sribble LPexample.scrbl'输出文档时,我收到以下警告:
2013 blog > scribble LPexample.scrbl [Output to LPexample.html] Warning: some cross references may be broken due to undefined tags: (dep ((lib "2htdp/image.rkt") ellipse)) (mod-path "racket") (dep ((lib "2htdp/image.rkt") beside/align)) (dep ((lib "2htdp/image.rkt") rectangle)) (mod-path "scribble/lp")
并且输出文件在断开的链接下放置红色下划线.
被潦草的文件是LPexample.scrbl.这很简单:
#lang scribble/manual @require[scribble/lp-include] @title{Literate Programming Example} // snip @lp-include["LPexample.rkt"]
获取断开链接的文字编程文档的部分是第69-86行:
which weaves to this: @chunk[(rectangle 100 100 "solid" "blue")] can be composed into other functions this way: @verbatim|{ @chunk[ (beside/align "bottom" (ellipse 20 70 "solid" "lightsteelblue") )]}| which weaves out to: @chunk[ (beside/align "bottom" (ellipse 20 70 "solid" "lightsteelblue") )]
当然,我一直在挖掘Racket文档.但即使使用直接涂鸦/核心或涂鸦/手动交叉链接文档也没有很好的例子,更不用说scribble/lp.
我也试过挖掘Racket文档的源代码,但是Guide和Reference的scribble文件使用了很多自定义函数和宏以及依赖项,我只是无法让我的脑子足够远,可以挖掘出来一个简单的"哦,这就是它的完成方式".
如果您希望源代码中的标识符自动超链接,您可能需要做两件事.
一个是您需要for-label
为任何希望Scribble识别的库添加需求.例如,您可能想要(require (for-label 2htdp/image))
.有关详细信息,请参阅文档的这一小节.
另一个是,如果您在线托管Scribble文档,文档链接需要指向某处,您需要指定位置.您可以使用命令行标志执行此操作.像这样的东西:
scribble --html +m --redirect-main http://docs.racket-lang.org/ document.scrbl
您可以使用不同的文档URL.例如,您可以改为链接到http://www.cs.utah.edu/plt/snapshots/current/doc/上的预发布快照文档.
有关更多详细信息,有关于处理交叉引用的Scribble文档的子部分:http://www.cs.utah.edu/plt/snapshots/current/doc/scribble/running.html#%28part._xref-flags %29