Skip to content

Commit

Permalink
Improve error messages (#262)
Browse files Browse the repository at this point in the history
* Add error for missing config.toml

* Fix missing bibliography error

* Fix tests
  • Loading branch information
rikhuijzer authored Dec 9, 2021
1 parent 8f63ad4 commit c84a74d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 0 additions & 1 deletion defaults/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ code-block-font-size: \scriptsize

titlepage: true
linkReferences: true
bibliography: bibliography.bib
link-citations: true

# These table of contents settings only affect the PDF.
Expand Down
2 changes: 2 additions & 0 deletions docs/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pdf-footer: ""
# Avoid adding a blank page before each chapter.
disable-cleardoublepage: true

bibliography: bibliography.bib

titlepage-top: >
\begin{tabular}{l}
Rik Huijzer\\
Expand Down
6 changes: 4 additions & 2 deletions src/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ Return the url prefix when `is_ci() == true`.
# Example
```jldoctest
julia> cd(pkgdir(Books)) do
julia> docs_dir = joinpath(pkgdir(Books), "docs");
julia> cd(docs_dir) do
Books.ci_url_prefix("default")
end
""
julia> cd(joinpath(pkgdir(Books), "docs")) do
julia> cd(docs_dir) do
Books.ci_url_prefix("test")
end
"/Example.jl"
Expand Down
12 changes: 11 additions & 1 deletion src/defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ end

function user_config(project::AbstractString)
path = "config.toml"
isfile(path) ? project_info(path, project) : nothing
if isfile(path)
return project_info(path, project)
else
default_config_path = joinpath(Books.DEFAULTS_DIR, "config.toml")
absolute_config_path = joinpath(pwd(), "config.toml")
msg = """
No file found at $absolute_config_path.
(See $default_config_path for an example configuration.)
"""
@warn msg
end
end

"""
Expand Down

0 comments on commit c84a74d

Please sign in to comment.