Skip to content

Commit

Permalink
Merge branch 'mp/fix-search' of github.com:JuliaDocs/Documenter.jl in…
Browse files Browse the repository at this point in the history
…to mp/fix-search
  • Loading branch information
mortenpi committed Nov 6, 2024
2 parents f22f9e7 + 5378ea1 commit fc84446
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ jobs:
with:
version: '1'
- name: Install dependencies
run: julia --color=yes --project -e'using Pkg; Pkg.instantiate()'
run: julia --color=yes --project=test/online -e'using Pkg; Pkg.instantiate()'
- name: Run online linkcheck tests
run: julia --color=yes --project --code-coverage test/online_linkcheck.jl
run: julia --color=yes --project=test/online --code-coverage test/online/runtests.jl
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
Expand Down
7 changes: 0 additions & 7 deletions test/docchecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ module TestModule
end

@testset "doc checks" begin
if haskey(ENV, "DOCUMENTER_TEST_ONLINE_LINKCHECK")
include("online_linkcheck.jl")
include("online_githubcheck.jl")
else
@info "Online linkchecks skipped (DOCUMENTER_TEST_ONLINE_LINKCHECK not set)"
end

@testset "allbindings" begin
# dep1_private has not been imported into TestModule, so the binding does not
# resolve to the Deps1 binding.
Expand Down
4 changes: 2 additions & 2 deletions test/examples/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ module Mod
\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}
```
Long equations in footnotes.[^longeq-footnote]
Long equations in footnotes.[^longeq_footnote]
[^longeq-footnote]:
[^longeq_footnote]:
Inline: ``\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}``
Expand Down
18 changes: 6 additions & 12 deletions test/examples/references/latex_showcase.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\newcommand{\DocMainTitle}{Documenter LaTeX Showcase}
\newcommand{\DocVersion}{1.2.3}
\newcommand{\DocAuthors}{}
\newcommand{\JuliaVersion}{1.9.3}
\newcommand{\JuliaVersion}{1.11.1}

% ---- Insert preamble
\input{preamble.tex}
Expand Down Expand Up @@ -1235,21 +1235,15 @@ \section{An index of docstrings}
\begin{equation*}
\begin{split}\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}\end{split}\end{equation*}
\end{tcolorbox}
Long equations in footnotes.[{\textasciicircum}longeq-footnote]
Long equations in footnotes.\footnotemark[1]
[{\textasciicircum}longeq-footnote]:
\begin{minted}{text}
Inline: ``\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}``
\footnotetext[1]{Inline: \(\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}\)
Display equation:
```math
\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}
```
\end{minted}
\begin{equation*}
\begin{split}\frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2} + \frac{1+2+3+4+5+6}{\sigma^2}\end{split}\end{equation*}
}
\href{https://example.org/Repository.jl/blob/make.jl#L44-74}{\texttt{source}}
Expand Down
2 changes: 1 addition & 1 deletion test/examples/references/latex_simple.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\newcommand{\DocMainTitle}{Documenter LaTeX Simple Non-Docker}
\newcommand{\DocVersion}{1.2.3}
\newcommand{\DocAuthors}{}
\newcommand{\JuliaVersion}{1.9.3}
\newcommand{\JuliaVersion}{1.11.1}

% ---- Insert preamble
\input{preamble.tex}
Expand Down
11 changes: 11 additions & 0 deletions test/online/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
MarkdownAST = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RegistryInstances = "2792f1a3-b283-48e8-9a74-f99dce5104f3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
Documenter = {path = "../.."}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ using Documenter.HTMLWriter: render_article, HTMLContext, HTML
using Markdown
using Test

include("repolink_helpers.jl")
include("../repolink_helpers.jl")

@testset "Online githubcheck" begin
@testset "Success" begin
src = convert(
MarkdownAST.Node,
md"""
```@meta
CurrentModule = Main.DocCheckTests.OnlineGithubCheckTests.TestHelperModule
CurrentModule = Main.OnlineGithubCheckTests.TestHelperModule
```
```@docs
MarkdownAST.Node
Expand All @@ -35,7 +35,7 @@ include("repolink_helpers.jl")
MarkdownAST.Node,
md"""
```@meta
CurrentModule = Main.DocCheckTests.OnlineGithubCheckTests.TestHelperModule
CurrentModule = Main.OnlineGithubCheckTests.TestHelperModule
```
This doc will not pass the checks because this version isn't tagged
```@docs
Expand Down
31 changes: 27 additions & 4 deletions test/online_linkcheck.jl → test/online/online_linkcheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ module OnlineLinkcheckTests
using Documenter: Documenter, MarkdownAST, AbstractTrees
using Documenter: linkcheck
using Markdown
using HTTP
using Test

PORT = rand(10_000:40_000)
function lincheck_server_handler(req::HTTP.Request)
useragent = HTTP.header(req, "user-agent")
if startswith(useragent, "Mozilla/5.0")
return HTTP.Response(404)
elseif startswith(useragent, "curl")
return HTTP.Response(200)
end
return HTTP.Response(500)
end
server = HTTP.serve!(lincheck_server_handler, PORT)

@testset "Online linkcheck" begin

@testset "Successes" begin
Expand All @@ -25,14 +38,21 @@ using Test
end

@testset "Empty User-Agent" begin
# This used to point to
#
# https://www.intel.com/content/www/us/en/developer/tools/oneapi/mpi-library.html)
#
# but now we use a mock HTTP server, to guarantee that the server's behavior doesn't change.
src = convert(
MarkdownAST.Node,
md"""
[Linkcheck Empty UA](https://www.intel.com/content/www/us/en/developer/tools/oneapi/mpi-library.html)
"""
Markdown.parse(
"""
[Linkcheck Empty UA](http://localhost:$(PORT)/content/www/us/en/developer/tools/oneapi/mpi-library.html)
"""
)
)

# The default user-agent fails (intel servers block it)
# The default user-agent fails (server blocks it, returns a 500)
doc = Documenter.Document(; linkcheck = true, linkcheck_timeout = 20)
doc.blueprint.pages["testpage"] = Documenter.Page("", "", "", [], Documenter.Globals(), src)
@test_logs (:error,) @test linkcheck(doc) === nothing
Expand Down Expand Up @@ -65,4 +85,7 @@ using Test

end

# Close the mock HTTP server
close(server)

end # module
6 changes: 6 additions & 0 deletions test/online/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Test

@testset "Online Tests" begin
include("online_linkcheck.jl")
include("online_githubcheck.jl")
end

0 comments on commit fc84446

Please sign in to comment.