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)
|
path = joinpath(template.path, pkg_name)
|
||||||
docs_dir = joinpath(path, "docs", "src")
|
docs_dir = joinpath(path, "docs", "src")
|
||||||
mkpath(docs_dir)
|
mkpath(docs_dir)
|
||||||
if !isempty(plugin.css_files)
|
if !isempty(plugin.assets)
|
||||||
mkpath(joinpath(docs_dir, "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)))
|
cp(file, joinpath(docs_dir, "assets", basename(file)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if isempty(plugin.css_files)
|
if isempty(plugin.assets)
|
||||||
assets = "[]"
|
assets = "[]"
|
||||||
else
|
else
|
||||||
# We want something that looks like the following:
|
# 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)
|
const TAB = repeat(" ", 4)
|
||||||
assets = "[\n"
|
assets = "[\n"
|
||||||
for file in plugin.css_files
|
for file in plugin.assets
|
||||||
assets *= """$(TAB^2)"assets/$file",\n"""
|
assets *= """$(TAB^2)"assets/$file",\n"""
|
||||||
end
|
end
|
||||||
assets *= "$TAB]"
|
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.
|
Add GitHubPages to a template's plugins to add Documenter.jl support via GitHub Pages.
|
||||||
|
|
||||||
# Keyword Arguments
|
# 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
|
@auto_hash_equals struct GitHubPages <: Documenter
|
||||||
gitignore_files::Vector{AbstractString}
|
gitignore_files::Vector{AbstractString}
|
||||||
documenter_assets::Vector{AbstractString}
|
assets::Vector{AbstractString}
|
||||||
|
|
||||||
function GitHubPages(; css_files::Vector{String}=String[])
|
function GitHubPages(; assets::Vector{String}=String[])
|
||||||
for file in documenter_assets
|
for file in assets
|
||||||
if !isfile(file)
|
if !isfile(file)
|
||||||
throw(ArgumentError("Asset file $file does not exist"))
|
throw(ArgumentError("Asset file $file does not exist"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Windows Git recognizes these paths as well.
|
# Windows Git recognizes these paths as well.
|
||||||
new(["/docs/build/", "/docs/site/"], documenter_assets)
|
new(["/docs/build/", "/docs/site/"], assets)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user