From df484727fb43c52790e908b49db0d029712bd04c Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Mon, 8 Jul 2019 11:30:07 +1200 Subject: [PATCH 1/2] Do not declare writers <: Plugin Currently the HTML, Markdown and LaTeX objects can be passed as positional arguments to makedocs, but they do not have any effect, effectively failing silently. With this, they can only be passed via the format keyword. The Writer abstract type is currently not part of the public API. --- src/Documenter.jl | 1 + src/Documents.jl | 11 ++++++----- src/Writers/HTMLWriter.jl | 2 +- src/Writers/LaTeXWriter.jl | 2 +- src/Writers/MarkdownWriter.jl | 2 +- test/runtests.jl | 3 +++ 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Documenter.jl b/src/Documenter.jl index b2c7dac0a5..51fe691c3a 100644 --- a/src/Documenter.jl +++ b/src/Documenter.jl @@ -31,6 +31,7 @@ a new `T` object will be created. """ abstract type Plugin end +abstract type Writer end # Submodules # ---------- diff --git a/src/Documents.jl b/src/Documents.jl index 5cf48afdbb..2473ca0173 100644 --- a/src/Documents.jl +++ b/src/Documents.jl @@ -13,7 +13,8 @@ import ..Documenter: Documenter, Anchors, Utilities, - Plugin + Plugin, + Writer import ..Documenter.Utilities.Markdown2 using DocStringExtensions @@ -211,7 +212,7 @@ struct User source :: String # Parent directory is `.root`. Where files are read from. build :: String # Parent directory is also `.root`. Where files are written to. workdir :: Union{Symbol,String} # Parent directory is also `.root`. Where code is executed from. - format :: Vector{Plugin} # What format to render the final document with? + format :: Vector{Writer} # What format to render the final document with? clean :: Bool # Empty the `build` directory before starting a new build? doctest :: Union{Bool,Symbol} # Run doctests? linkcheck::Bool # Check external links.. @@ -285,7 +286,7 @@ function Document(plugins = nothing; Utilities.check_kwargs(others) if !isa(format, AbstractVector) - format = Plugin[format] + format = Writer[format] end if version == "git-commit" @@ -332,9 +333,9 @@ function Document(plugins = nothing; if plugins !== nothing for plugin in plugins plugin isa Plugin || - throw("$(typeof(plugin)) is not a subtype of `Documenter.Plugin`.") + throw(ArgumentError("$(typeof(plugin)) is not a subtype of `Documenter.Plugin`.")) haskey(plugin_dict, typeof(plugin)) && - throw("only one copy of $(typeof(plugin)) may be passed.") + throw(ArgumentError("only one copy of $(typeof(plugin)) may be passed.")) plugin_dict[typeof(plugin)] = plugin end end diff --git a/src/Writers/HTMLWriter.jl b/src/Writers/HTMLWriter.jl index 9b3d509abe..ee8a674a3c 100644 --- a/src/Writers/HTMLWriter.jl +++ b/src/Writers/HTMLWriter.jl @@ -125,7 +125,7 @@ The type of the asset (i.e. whether it is going to be included with a `