diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 21d9bee..97ae7dc 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -32,8 +32,8 @@ function gen_plugin(p::Documenter, t::Template, pkg_name::AbstractString) "[]" end - kwargs_string = if "additional_kwargs" in fieldnames(typeof(p)) - const set_kwargs = ["modules", "format", "pages", "repo", "sitename", "authors", "assets"] + kwargs_string = if :additional_kwargs in fieldnames(typeof(p)) + set_kwargs = ["modules", "format", "pages", "repo", "sitename", "authors", "assets"] # We want something that looks like the following: # key1="val1", diff --git a/test/runtests.jl b/test/runtests.jl index 8bcd9a8..13fa915 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,7 +7,7 @@ using Pkg import PkgTemplates: badges, version_floor, substitute, read_license, gen_file, gen_readme, gen_tests, gen_license, gen_require, gen_gitignore, gen_plugin, show_license, LICENSES, LICENSE_DIR, Plugin, GenericPlugin, CustomPlugin, Badge, format, interactive, - DEFAULTS_DIR + DEFAULTS_DIR, Documenter mktempdir() do temp_dir mkdir(joinpath(temp_dir, "dev")) diff --git a/test/tests.jl b/test/tests.jl index be1a9ae..aca2855 100644 --- a/test/tests.jl +++ b/test/tests.jl @@ -13,6 +13,11 @@ end struct Bar <: CustomPlugin end # A dummy Plugin subtype. struct Baz <: Plugin end +# A Documenter with extra kwargs +struct Bat <: Documenter + assets::Vector{AbstractString} + additional_kwargs::Vector{<:Pair} +end # Various options to be passed into templates. const me = "christopher-dG" @@ -397,4 +402,26 @@ end include(joinpath("plugins", "githubpages.jl")) end +@testset "Documenter add kwargs" begin + t = Template(; user=me) + pkg_dir = joinpath(t.dir, test_pkg) + p = Bat( + [], + ["strict"=>true, "checkdocs"=>:none, "format"=>:markdown, "stringarg"=>"string"] + ) + gen_plugin(p, t, test_pkg) + make = readchomp(joinpath(pkg_dir, "docs", "make.jl")) + @test occursin( + strip(""" + strict=true, + checkdocs=:none, + stringarg="string", + """), + make, + ) + @test !occursin("format=:markdown", make) + @test occursin("format=:html", make) + rm(pkg_dir; recursive=true) +end + rm(test_file)