-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.jl
34 lines (31 loc) · 1.29 KB
/
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
29
30
31
32
33
34
using Dates
using Glob
using Mustache
using Markdown
include("_0.helpers_and_metadata/code_metadata.jl")
using .CodeMetadata.Helpers: typenameof, skipredundantfix # TODO weird namespacing issue -- method resolution gets confused if I go straight for using .Helpers
function hfun_allcodes()
io = IOBuffer()
for (codetype, metadata) in pairs(CodeMetadata.code_metadata)
codetypename = typenameof(codetype)
decoders = unique(skipredundantfix.(typenameof.(metadata[:decoders])))
setups = skipredundantfix.(typenameof.(metadata[:setups]))
description = Markdown.html(Markdown.parse(get(metadata, :description, "")))
write(io, render(mt"""
<div class="card">
<h5 class="card-header"><a href="../codes/{{{:codetypename}}}">{{:codetypename}}</a></h5>
<div class="card-body">
<p class="card-text">{{{:description}}}</p>
</div>
<div class="card-footer text-muted">
{{#:decoders}} <span class="badge badge-dark">{{.}}</span> {{/:decoders}}
<br>
{{#:setups}} <span class="badge badge-light">{{.}}</span> {{/:setups}}
</div>
</div>
<br>
""", (;codetypename, decoders, setups, description)))
write(io, "\n")
end
return String(take!(io))
end