From 45fb128a4c5b808dde762cee9d3aca70ac018d17 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Mon, 29 Apr 2019 12:56:14 +1200 Subject: [PATCH] Handle non-existing files in find_block_in_file (#1002) Currently find_block_in_file will throw an error if the file does not exist, which can happen if a Base docstring is being included. --- CHANGELOG.md | 5 +++++ src/Utilities/Utilities.jl | 1 + 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b21f3d267..7a0232616c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Documenter.jl changelog +## Version `v0.22.4` + +* ![Bugfix][badge-bugfix] Documenter no longer crashes if the build includes doctests from docstrings that are defined in files that do not exist on the file system (e.g. if a Julia Base docstring is included when running a non-source Julia build). ([#1002][github-1002]) + ## Version `v0.22.3` * ![Bugfix][badge-bugfix] Fixed filepaths for images included in the .tex file for PDF output on Windows. ([#999][github-999]) @@ -299,6 +303,7 @@ [github-995]: https://github.com/JuliaDocs/Documenter.jl/pull/995 [github-996]: https://github.com/JuliaDocs/Documenter.jl/pull/996 [github-999]: https://github.com/JuliaDocs/Documenter.jl/pull/999 +[github-1002]: https://github.com/JuliaDocs/Documenter.jl/pull/1002 [documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl [documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl diff --git a/src/Utilities/Utilities.jl b/src/Utilities/Utilities.jl index 55f50c9436..cd6eb3a81b 100644 --- a/src/Utilities/Utilities.jl +++ b/src/Utilities/Utilities.jl @@ -16,6 +16,7 @@ regex_escape(str) = sprint(escape_string, str, "\\^\$.|?*+()[{") function find_block_in_file(code, file) source_file = Base.find_source_file(file) source_file === nothing && return nothing + isfile(source_file) || return nothing content = read(source_file, String) content = replace(content, "\r\n" => "\n") # make a regex of the code that matches leading whitespace