From 0b8b9e82398a61e2462ae54e5f9c1a7129772bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Tue, 14 May 2019 20:27:26 +0200 Subject: [PATCH] fix stale, improve formatting --- src/generate.jl | 10 +++------- src/plugins/citation.jl | 16 ++++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/generate.jl b/src/generate.jl index 2c07f51..2c31268 100644 --- a/src/generate.jl +++ b/src/generate.jl @@ -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 diff --git a/src/plugins/citation.jl b/src/plugins/citation.jl index 64f4957..233c55f 100644 --- a/src/plugins/citation.jl +++ b/src/plugins/citation.jl @@ -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