From b36ef11dfb21d65181c7fd40dcd1338c99a12b31 Mon Sep 17 00:00:00 2001 From: t-bltg <13423344+t-bltg@users.noreply.github.com> Date: Mon, 12 Jul 2021 13:32:23 +0200 Subject: [PATCH] Autogen unicodeplots and inspectdr (#246) * autogen unicodeplots and inspectdr * fix generation for unicodeplots - add ansi color support * bypass svg for :inspectdr Co-authored-by: t-bltg --- docs/make.jl | 11 +++++++---- src/PlotDocs.jl | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 6f440be342..4f4ff72a8f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -4,6 +4,8 @@ using Documenter, PlotDocs, Plots, PlotThemes ENV["MPLBACKEND"] = "agg" # Initialize backends +inspectdr() +unicodeplots() pyplot() pgfplotsx() plotly() @@ -59,8 +61,8 @@ const PAGES = Any[ "Plotly" => "generated/plotly.md", "PyPlot" => "generated/pyplot.md", "PGFPlotsX" => "generated/pgfplotsx.md", - "UnicodePlots" => "examples/unicodeplots.md", - "InspectDR" => "examples/inspectdr.md", + "UnicodePlots" => "generated/unicodeplots.md", + "InspectDR" => "generated/inspectdr.md", ], ] @@ -68,13 +70,14 @@ generate_attr_markdown() generate_supported_markdown() generate_graph_attr_markdown() generate_colorschemes_markdown() -for be in (:gr, :plotly, :pyplot, :pgfplotsx) +for be in (:gr, :plotly, :pyplot, :pgfplotsx, :unicodeplots, :inspectdr) generate_markdown(be) end @time makedocs( format = Documenter.HTML( prettyurls = get(ENV, "CI", nothing) == "true", - assets = ["assets/favicon.ico"] + assets = ["assets/favicon.ico"], + ansicolor = true ), sitename = "Plots", authors = "Thomas Breloff", diff --git a/src/PlotDocs.jl b/src/PlotDocs.jl index eeb27b6cdf..3b7df87e6f 100644 --- a/src/PlotDocs.jl +++ b/src/PlotDocs.jl @@ -82,17 +82,28 @@ function generate_markdown(pkgname::Symbol; skip = get(Plots._backend_skips, pkg ```@example $pkgname Plots.reset_defaults() # hide """) + if pkgname ∈ (:unicodeplots, :inspectdr) + write(md, """ + using Logging # hide + Logging.disable_logging(Logging.Warn) # hide + """) + end for expr in example.exprs pretty_print_expr(md, expr) end + if pkgname == :unicodeplots + write(md, """ + Plots._show(stdout, MIME("text/plain"), current()) # hide + """) + end if i in (2, 31) write(md, "gif(anim, \"anim_$(pkgname)_ex$i.gif\") # hide\n") end - if pkgname ∈ (:plotly, :plotlyjs) + if pkgname ∈ (:plotly, :plotlyjs, :inspectdr) write(md, "png(\"$(pkgname)_ex$i\") # hide\n") end write(md, "```\n") - if pkgname ∈ (:plotly, :plotlyjs) + if pkgname ∈ (:plotly, :plotlyjs, :inspectdr) write(md, "![]($(pkgname)_ex$i.png)\n") end end