fix stale, improve formatting

This commit is contained in:
Mathieu Besançon 2019-05-14 20:27:26 +02:00
parent 5eb911c35a
commit 0b8b9e8239
2 changed files with 11 additions and 15 deletions

View File

@ -63,7 +63,6 @@ function generate(
gen_require(pkg_dir, t),
gen_readme(pkg_dir, t),
gen_license(pkg_dir, t),
gen_citation(pkg_dir, t),
vcat(map(p -> gen_plugin(p, t, pkg), values(t.plugins))...),
)
@ -216,12 +215,9 @@ function gen_readme(pkg_dir::AbstractString, t::Template)
badges(t.plugins[plugin_type], t.user, pkg),
"\n",
)
if plugin_type <: Citation
c = t.plugins[plugin_type]
if c.readme_section
text *= "## Citing\n\nSee `CITATION.bib` for the relevant reference(s)\n"
end
end
end
if haskey(p.plugins, Citation) && p.plugins[Citation].readme_section
text *= "## Citing\n\nSee `CITATION.bib` for the relevant reference(s)\n"
end

View File

@ -30,14 +30,14 @@ interactive(::Type{Citation}) = interactive(Citation; readme_section=false)
function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString)
pkg_dir = joinpath(t.dir, pkg_name)
text = "@misc{$pkg_name.jl,\n"
text *= "\tauthor = {{$(t.author)}},\n"
text *= "\ttitle = {{$(pkg_name).jl}},\n"
text *= "\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n"
text *= "\tversion = {v0.0.1},\n"
text *= "\tyear = {$(year(today()))},\n"
text *= "\tmonth = {$(month(today()))},\n"
text *= "}"
text = """@misc{$pkg_name.jl,
\tauthor = {{$(t.author)}},\n
\ttitle = {{$(pkg_name).jl}},\n
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n
\tversion = {v0.0.1},\n
\tyear = {$(year(today()))},\n
\tmonth = {$(month(today()))}\n
}\n"""
gen_file(joinpath(pkg_dir, "CITATION.bib"), text)
return ["CITATION.bib"]
end