Skip to content

Commit

Permalink
fix monkey patching
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg authored Nov 13, 2024
1 parent cd54e3c commit ac540f9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ const GEN_DIR = joinpath(WORK_DIR, "generated")
const ATTRIBUTE_SEARCH = Dict{String,Any}() # search terms

# monkey patch `Documenter` - note that this could break on minor `Documenter` releases
@eval Documenter.Writers.HTMLWriter domify(ctx, navnode) = begin
# github.com/JuliaDocs/Documenter.jl/blob/327d155f992ec7c63e35fa2cb08f7f7c2d33409a/src/Writers/HTMLWriter.jl#L1448-L1455
page = getpage(ctx, navnode)
map(page.elements) do elem
rec = SearchRecord(ctx, navnode, elem)
@eval Documenter.Writers.HTMLWriter domify(dctx::DCtx) = begin
ctx, navnode = dctx.ctx, dctx.navnode
return map(getpage(ctx, navnode).mdast.children) do node
rec = SearchRecord(ctx, navnode, node, node.element)
############################################################
# begin addition
info = "[src=$(rec.src) fragment=$(rec.fragment) title=$(rec.title) page_title=$(rec.page_title)]"
Expand All @@ -43,7 +42,7 @@ const ATTRIBUTE_SEARCH = Dict{String,Any}() # search terms
end
# end addition
############################################################
domify(ctx, navnode, page.mapping[elem])
domify(dctx, node, node.element)
end
end

Expand Down

0 comments on commit ac540f9

Please sign in to comment.