Created
July 31, 2018 09:58
-
-
Save SimonDanisch/68eacd2ded13f119e8e0c8d02956a2c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, "[]($url)") | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment