Rename Documenter attribute
This commit is contained in:
parent
b4731273a0
commit
577a9a51ff
@ -19,13 +19,13 @@ function gen_plugin(plugin::Documenter, template::Template, pkg_name::AbstractSt
|
||||
path = joinpath(template.path, pkg_name)
|
||||
docs_dir = joinpath(path, "docs", "src")
|
||||
mkpath(docs_dir)
|
||||
if !isempty(plugin.css_files)
|
||||
if !isempty(plugin.assets)
|
||||
mkpath(joinpath(docs_dir, "assets"))
|
||||
for file in plugin.css_files
|
||||
for file in plugin.assets
|
||||
cp(file, joinpath(docs_dir, "assets", basename(file)))
|
||||
end
|
||||
end
|
||||
if isempty(plugin.css_files)
|
||||
if isempty(plugin.assets)
|
||||
assets = "[]"
|
||||
else
|
||||
# We want something that looks like the following:
|
||||
@ -36,7 +36,7 @@ function gen_plugin(plugin::Documenter, template::Template, pkg_name::AbstractSt
|
||||
|
||||
const TAB = repeat(" ", 4)
|
||||
assets = "[\n"
|
||||
for file in plugin.css_files
|
||||
for file in plugin.assets
|
||||
assets *= """$(TAB^2)"assets/$file",\n"""
|
||||
end
|
||||
assets *= "$TAB]"
|
||||
|
@ -1,24 +1,23 @@
|
||||
"""
|
||||
GitHubPages(; documenter_assets::Vector{AbstractString}=String[]) -> GitHubPages
|
||||
GitHubPages(; assets::Vector{AbstractString}=String[]) -> GitHubPages
|
||||
|
||||
Add GitHubPages to a template's plugins to add Documenter.jl support via GitHub Pages.
|
||||
|
||||
# Keyword Arguments
|
||||
* `documenter_assets::Vector{String}=String[]`: Array of paths to Documenter asset files.
|
||||
* `assets::Vector{String}=String[]`: Array of paths to Documenter asset files.
|
||||
"""
|
||||
struct GitHubPages <: Documenter
|
||||
@auto_hash_equals struct GitHubPages <: Documenter
|
||||
gitignore_files::Vector{AbstractString}
|
||||
documenter_assets::Vector{AbstractString}
|
||||
assets::Vector{AbstractString}
|
||||
|
||||
function GitHubPages(; css_files::Vector{String}=String[])
|
||||
for file in documenter_assets
|
||||
function GitHubPages(; assets::Vector{String}=String[])
|
||||
for file in assets
|
||||
if !isfile(file)
|
||||
throw(ArgumentError("Asset file $file does not exist"))
|
||||
end
|
||||
end
|
||||
# Windows Git recognizes these paths as well.
|
||||
new(["/docs/build/", "/docs/site/"], documenter_assets)
|
||||
new(["/docs/build/", "/docs/site/"], assets)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user