-
Notifications
You must be signed in to change notification settings - Fork 13
/
utils.jl
28 lines (26 loc) · 898 Bytes
/
utils.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Thanks @tlienart
using Markdown
function hfun_doc(params)
fname = params[1]
head = length(params) > 1 ? params[2] : fname
type = length(params) == 3 ? params[3] : ""
mod = length(params) == 4 ? params[4] : ""
if mod != ""
doc = eval(Meta.parse("using Groebner; @doc Groebner.$mod.$fname"))
else
doc = eval(Meta.parse("using Groebner; @doc Groebner.$fname"))
end
txt = Markdown.plain(doc)
# jldoctest blocks don't get syntax highlighting in Franklin.jl.
txt = replace(txt, "```jldoctest" => "```")
# possibly further processing here
body = Franklin.fd2html(txt, internal=true)
return """
<div class="docstring">
<h2 class="doc-header" id="$fname">
<a href="#$fname">$head</a>
<div class="doc-type">$type</div></h2>
<div class="doc-content">$body</div>
</div>
"""
end