Skip to content

Instantly share code, notes, and snippets.

@SimonDanisch
Created July 31, 2018 09:58
Show Gist options
  • Select an option

  • Save SimonDanisch/68eacd2ded13f119e8e0c8d02956a2c7 to your computer and use it in GitHub Desktop.

Select an option

Save SimonDanisch/68eacd2ded13f119e8e0c8d02956a2c7 to your computer and use it in GitHub Desktop.
using HTTP
function url_exists(url)
try
r = HTTP.request("GET", url)
return r.status == 200
catch e
return false
end
end
dir = readdir(Pkg.dir("Makie", "docs", "build", "media"))
database = include(Pkg.dir("Makie", "examples", "library.jl"))
files = filter(dir) do name
endswith(name, "jpg") && startswith(name, "thumb")
end
url_base = joinpath()
plotting_functions = string.((AbstractPlotting.atomic_function_symbols..., :contour, :arrows, :barplot, :poly))
open(Pkg.dir("Makie", "test.md"), "w") do io
for elem in files
uname = replace(replace(elem, ".jpg", ""), "thumb-", "")
entries = filter(x-> x.unique_name == Symbol(uname), database)
isempty(entries) && continue
entry = first(entries)
idx = findfirst(x-> x in entry.tags, plotting_functions)
idx == 0 && continue
tag = plotting_functions[idx]
title = replace(entry.title, " ", "-")
url = "http://makie.juliaplots.org/stable/examples-$tag.html#$title-1"
thumb = "http://makie.juliaplots.org/stable/media/$elem"
println(io, "[![]($thumb)]($url)")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment