Skip to content

Commit

Permalink
doctest_fix: try setting fixed default terminal size (#4171)
Browse files Browse the repository at this point in the history
* doctest_fix: try setting fixed default terminal size

* build_doc: also set terminal size
  • Loading branch information
benlorenz authored Oct 2, 2024
1 parent 3862e78 commit f8edfcb
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions src/utils/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ function doctest_fix(f::Function; set_meta::Bool = false)
S = Symbol(f)
doc, doctest = get_document(set_meta)

with_unicode(false) do
#essentially inspired by Documenter/src/DocTests.jl
pm = parentmodule(f)
bm = Base.Docs.meta(pm)
md = bm[Base.Docs.Binding(pm, S)]
for s in md.order
doctest(md.docs[s], Oscar, doc)
withenv("COLUMNS"=>80, "LINES"=>24) do
with_unicode(false) do
#essentially inspired by Documenter/src/DocTests.jl
pm = parentmodule(f)
bm = Base.Docs.meta(pm)
md = bm[Base.Docs.Binding(pm, S)]
for s in md.order
doctest(md.docs[s], Oscar, doc)
end
end
end
end
Expand All @@ -97,14 +99,16 @@ julia> Oscar.doctest_fix("/Rings/")
function doctest_fix(path::String; set_meta::Bool=false)
doc, doctest = get_document(set_meta)

with_unicode(false) do
walkmodules(Oscar) do m
#essentially inspired by Documenter/src/DocTests.jl
bm = Base.Docs.meta(m)
for (_, md) in bm
for s in md.order
if occursin(path, md.docs[s].data[:path])
doctest(md.docs[s], Oscar, doc)
withenv("COLUMNS"=>80, "LINES"=>24) do
with_unicode(false) do
walkmodules(Oscar) do m
#essentially inspired by Documenter/src/DocTests.jl
bm = Base.Docs.meta(m)
for (_, md) in bm
for s in md.order
if occursin(path, md.docs[s].data[:path])
doctest(md.docs[s], Oscar, doc)
end
end
end
end
Expand Down Expand Up @@ -218,11 +222,13 @@ function build_doc(; doctest::Union{Symbol, Bool} = false, warnonly = true, open
if !isdefined(Main, :BuildDoc)
doc_init()
end
with_unicode(false) do
Pkg.activate(docsproject) do
Base.invokelatest(
Main.BuildDoc.doit, Oscar; warnonly=warnonly, local_build=true, doctest=doctest
)
withenv("COLUMNS"=>80, "LINES"=>24) do
with_unicode(false) do
Pkg.activate(docsproject) do
Base.invokelatest(
Main.BuildDoc.doit, Oscar; warnonly=warnonly, local_build=true, doctest=doctest
)
end
end
end
if start_server
Expand Down

0 comments on commit f8edfcb

Please sign in to comment.