-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecation fixes #643
Deprecation fixes #643
Changes from all commits
b54e8f9
d8a0368
0c94ba5
b257ade
d15cec0
f439aca
d00eaea
61834e6
98756df
e56c99c
55dcbc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
julia 0.6 | ||
Compat 0.47.0 | ||
Compat 0.54.0 | ||
DocStringExtensions 0.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import ..Documenter: | |
IdDict | ||
|
||
using Compat, DocStringExtensions | ||
import Compat.Markdown | ||
|
||
# Missing docstrings. | ||
# ------------------- | ||
|
@@ -79,7 +80,7 @@ meta(m) = Docs.meta(m) | |
nameof(x::Function) = typeof(x).name.mt.name | ||
nameof(b::Base.Docs.Binding) = b.var | ||
nameof(x::DataType) = x.name.name | ||
nameof(m::Module) = module_name(m) | ||
nameof(m::Module) = Compat.nameof(m) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this could actually just extend the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we should actually remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did extend at first but that a bit weird. Either we leave it as is here, or upstream the other |
||
|
||
sigs(x::Base.Docs.MultiDoc) = x.order | ||
sigs(::Any) = Type[Union{}] | ||
|
@@ -240,7 +241,7 @@ end | |
|
||
# Regex used here to replace gensym'd module names could probably use improvements. | ||
function checkresult(sandbox::Module, result::Result, meta::Dict, doc::Documents.Document) | ||
sandbox_name = module_name(sandbox) | ||
sandbox_name = nameof(sandbox) | ||
mod_regex = Regex("(Main\\.)?(Symbol\\(\"$(sandbox_name)\"\\)|$(sandbox_name))[,.]") | ||
mod_regex_nodot = Regex(("(Main\\.)?$(sandbox_name)")) | ||
if isdefined(result, :bt) # An error was thrown and we have a backtrace. | ||
|
@@ -311,22 +312,22 @@ function report(result::Result, str, doc::Documents.Document) | |
buffer = IOBuffer() | ||
println(buffer, "=====[Test Error]", "="^30) | ||
println(buffer) | ||
print_with_color(:cyan, buffer, "> File: ", result.file, "\n") | ||
print_with_color(:cyan, buffer, "\n> Code block:\n") | ||
printstyled(buffer, "> File: ", result.file, "\n", color=:cyan) | ||
printstyled(buffer, "\n> Code block:\n", color=:cyan) | ||
println(buffer, "\n```jldoctest") | ||
println(buffer, result.code) | ||
println(buffer, "```") | ||
if !isempty(result.input) | ||
print_with_color(:cyan, buffer, "\n> Subexpression:\n") | ||
printstyled(buffer, "\n> Subexpression:\n", color=:cyan) | ||
print_indented(buffer, result.input; indent = 4) | ||
end | ||
warning = Base.have_color ? "" : " (REQUIRES COLOR)" | ||
print_with_color(:cyan, buffer, "\n> Output Diff", warning, ":\n\n") | ||
printstyled(buffer, "\n> Output Diff", warning, ":\n\n", color=:cyan) | ||
diff = TextDiff.Diff{TextDiff.Words}(result.output, rstrip(str)) | ||
Utilities.TextDiff.showdiff(buffer, diff) | ||
println(buffer, "\n\n", "=====[End Error]=", "="^30) | ||
push!(doc.internal.errors, :doctest) | ||
print_with_color(:normal, Utilities.takebuf_str(buffer)) | ||
printstyled(Utilities.takebuf_str(buffer), color=:normal) | ||
end | ||
|
||
function print_indented(buffer::IO, str::AbstractString; indent = 4) | ||
|
@@ -379,7 +380,7 @@ function repl_splitter(code) | |
end | ||
|
||
function savebuffer!(out, buf) | ||
n = nb_available(seekstart(buf)) | ||
n = bytesavailable(seekstart(buf)) | ||
n > 0 ? push!(out, rstrip(Utilities.takebuf_str(buf))) : out | ||
end | ||
|
||
|
@@ -476,13 +477,13 @@ function linkcheck(doc::Documents.Document) | |
return nothing | ||
end | ||
|
||
function linkcheck(link::Base.Markdown.Link, doc::Documents.Document) | ||
function linkcheck(link::Markdown.Link, doc::Documents.Document) | ||
INDENT = " "^6 | ||
|
||
# first, make sure we're not supposed to ignore this link | ||
for r in doc.user.linkcheck_ignore | ||
if linkcheck_ismatch(r, link.url) | ||
print_with_color(:normal, INDENT, "--- ", link.url, "\n") | ||
printstyled(INDENT, "--- ", link.url, "\n", color=:normal) | ||
return false | ||
end | ||
end | ||
|
@@ -500,19 +501,19 @@ function linkcheck(link::Base.Markdown.Link, doc::Documents.Document) | |
if contains(result, STATUS_REGEX) | ||
status = parse(Int, match(STATUS_REGEX, result).captures[1]) | ||
if status < 300 | ||
print_with_color(:green, INDENT, "$(status) ", link.url, "\n") | ||
printstyled(INDENT, "$(status) ", link.url, "\n", color=:green) | ||
elseif status < 400 | ||
LOCATION_REGEX = r"^Location: (.+)$"m | ||
if contains(result, LOCATION_REGEX) | ||
location = strip(match(LOCATION_REGEX, result).captures[1]) | ||
print_with_color(:yellow, INDENT, "$(status) ", link.url, "\n") | ||
print_with_color(:yellow, INDENT, " -> ", location, "\n\n") | ||
printstyled(INDENT, "$(status) ", link.url, "\n", color=:yellow) | ||
printstyled(INDENT, " -> ", location, "\n\n", color=:yellow) | ||
else | ||
print_with_color(:yellow, INDENT, "$(status) ", link.url, "\n") | ||
printstyled(INDENT, "$(status) ", link.url, "\n", color=:yellow) | ||
end | ||
else | ||
push!(doc.internal.errors, :linkcheck) | ||
print_with_color(:red, INDENT, "$(status) ", link.url, "\n") | ||
printstyled(INDENT, "$(status) ", link.url, "\n", color=:red) | ||
end | ||
else | ||
push!(doc.internal.errors, :linkcheck) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently this actually made sense back when Documenter still supported 0.4. Good to get rid of this. 😆