我是朱莉娅的新手。我有兴趣使用Docile.jl向现有的Julia项目添加文档。根据{{3}},文档字符串已添加到Julia 0.4中,但我希望文档字符串能够在0.3中工作。
上述帖子中的示例并不适用于0.3。 help(f)
没有显示文档字符串,@doc f
会返回错误。有人能帮我看看缺少什么吗?
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.6 (2015-01-08 22:33 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org release
|__/ | x86_64-linux-gnu
julia> using Docile
julia> @doc """
Compute 2 times x minus y squared.
""" ->
function f(x::Float64, y::Float64)
return 2x - y^2
end
f (generic function with 1 method)
julia> help(f)
INFO: Loading help data...
f (generic function with 1 method)
julia> @doc f
ERROR: @doc: use `->` to separate docs/object:
(:f,)
答案 0 :(得分:1)
您可能希望将Docile.jl与Lexicon.jl结合使用。下面的会话显示,如果您只记录没有using Lexicon
的函数,则任何函数的帮助文本都不会更改。输入using Lexicon
后,帮助文本仅反映您的文档。请注意,在下面,我通过在repl处键入?
来获取帮助文本,而不是使用函数help
。
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.6 (2015-02-17 22:12 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-unknown-linux-gnu
julia> using Docile
julia>
julia> @doc """
Compute 2 times x minus y squared.
""" ->
function f(x::Float64, y::Float64)
return 2x - y^2
end
f (generic function with 1 method)
help?> f
INFO: Loading help data...
f (generic function with 1 method)
julia> using Lexicon
help?> f
f (generic function with 1 method)
INFO: Parsing documentation for Docile.
INFO: Parsing documentation for Lexicon.
INFO: Parsing documentation for Docile.Interface.
[method]
.f(x::Float64, y::Float64)
Compute 2 times x minus y squared.
Details:
source: (3,"none")