Skip to content
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

Compatibility with Documenter 1.0 #3

Merged
merged 1 commit into from
Sep 16, 2023
Merged

Compatibility with Documenter 1.0 #3

merged 1 commit into from
Sep 16, 2023

Conversation

fredrikekre
Copy link
Member

@fredrikekre fredrikekre commented Jul 11, 2023

Edit (@goerz):

As a side-effect:

Closes #19

Copy link
Member Author

@fredrikekre fredrikekre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass and docs build, but some things don't quite work yet.

src/bibliography.jl Outdated Show resolved Hide resolved
src/citations.jl Outdated Show resolved Hide resolved
@goerz
Copy link
Member

goerz commented Jul 11, 2023

I’ll have a look at these (on my phone right now). As a heads-up: I already adapted the documentation this morning, and I’ll push that branch and make a PR later today.

src/bibliography.jl Outdated Show resolved Hide resolved
@goerz
Copy link
Member

goerz commented Jul 12, 2023

This is the least important aspect of this PR, but just for the record: To get the "Codestyle" CI to pass, run make codestyle in your checkout. Or, to do it manually (if you don't have make):

julia --project=test
julia> using JuliaFormatter
julia> format(["src", "docs", "test"])

The relevant rules are in the .JuliaFormatter.toml file in the root of the repo. I'm not particular to any specific setting, but having everything auto-formatted for consistency makes life much easier, and especially keeps out stuff like trailing whitespace.

@fredrikekre fredrikekre changed the title WIP: Compat with Documenter master. Compat with Documenter master. Jul 12, 2023
@fredrikekre
Copy link
Member Author

Okay, this branch is ready now I think but let's leave it unmerged until Documenter is released. Users that want to use Documenter#master can use this branch for now.

@fredrikekre
Copy link
Member Author

Looks like this branch does not expand citations in docstrings. I wonder if the order within documenter have changed.

@fredrikekre
Copy link
Member Author

@mortenpi it looks like the tree iterator here doesn't reach all the way to the docstrings now, but stop at Documenter.DocsNode([...]). Any ideas how to fix?

@goerz
Copy link
Member

goerz commented Jul 12, 2023

Thanks so much for helping with adapting this to the upcoming Documenter release, guys!

Okay, this branch is ready now I think but let's leave it unmerged until Documenter is released.

Yes, let's slow down with this a little for now, if that's ok… Especially because I gotta go and work on my JuliaCon talk for a bit 😉. But after that, I'll need to get my head back into the internals and look through everything in detail.

I'd like to add a test that the issue that I described in https://discourse.julialang.org/t/running-makedocs-overwrites-repl-docstrings/95982 is gone with the new Documenter version, and that the workaround in

const _CACHED_CITATIONS = OrderedDict{String,Int64}()
const _CACHED_PAGE_CITATIONS = OrderedDict{String,Set{String}}()
# The caching is used to get around a Bug in Documenter 0.27, see
# https://discourse.julialang.org/t/running-makedocs-overwrites-repl-docstrings
# Even though it doesn't *really* solve the problem, caching `bib.citations`
# and `bib.page_citation` in practice gets around the plugin not being able to
# detect citations in docstring on a second call to `makedocs`. The caching
# feature should be removed when Documenter 0.28 is released.

is no longer necessary. That is, one can hopefully run docs/make.jl twice in the same REPL without it causing any problems.

I'd also want to think through the implications of #6 for how exactly format_citation should tie into the internals with the new Documenter version.

@goerz goerz marked this pull request as draft July 12, 2023 15:39
@mortenpi
Copy link
Member

@mortenpi it looks like the tree iterator here doesn't reach all the way to the docstrings now, but stop at Documenter.DocsNode([...]). Any ideas how to fix?

You need to explicitly dive into the .element: https://github.com/JuliaDocs/Documenter.jl/blob/7c97a86a31e360d7d22082a9a783b0cab24163b5/src/documents.jl#L145-L148

E.g. something like what is done here: https://github.com/JuliaDocs/Documenter.jl/blob/7c97a86a31e360d7d22082a9a783b0cab24163b5/src/CrossReferences.jl#L31-L53

This should eventually be changed though, and the docstrings should become proper child nodes.

@goerz
Copy link
Member

goerz commented Sep 11, 2023

Just a heads-up: I was able to rebase this on top of #32 and make further modifications that get everything working perfectly with today's master of Documenter.

This includes expanding citations in docstrings. The caching workaround is no longer needed. Also, #19 solved itself 🎉. Not sure yet about #16.

I'll wait with force-pushing the changes to this PR until after #32 is merged (stacking more than two PRs just gets a little too messy).

In any case, I think I can take it from here, and there shouldn't be any problem whatsoever with being compatible with Documenter 1.0 as soon as it's released.

Thanks again for helping me to get the conversion started!

@fredrikekre
Copy link
Member Author

Great, thanks. Wanted to pick this up but didn't find the time.

@goerz
Copy link
Member

goerz commented Sep 15, 2023

@fredrikekre @mortenpi Congratulations on the Documenter 1.0 release!

I would still like to merge #35 first and make a 1.1 release based on that (still compatible with Documenter 0.27).

But after that, this PR should be ready to merge, and would then be the 1.2 release. There is of course a "breaking change" in that the plugin now has to be passed to makedocs via the plugin keyword argument instead of as a positional argument, but I would consider that a breaking change in Documenter, not DocumenterCitations. So a minor release should be okay.

Two small details that still need to be fixed in this PR:

  • There's a failing test on Windows (I tink due to an issue with platfrom-specific line endings, for a file I'm loading to compare output against)
  • We should remove the dev-install of Documenter in the CI and local tooling

@goerz goerz marked this pull request as ready for review September 15, 2023 17:39
@goerz
Copy link
Member

goerz commented Sep 15, 2023

Ok, fixed those two remaining issues…

This should now be ready for final review. It would still have to be rebased after merging #35 and making the 1.1 release.

@goerz
Copy link
Member

goerz commented Sep 15, 2023

Oh, and NEWS.md will have to be updated

@goerz
Copy link
Member

goerz commented Sep 15, 2023

Copy link
Member Author

@fredrikekre fredrikekre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't approve my own PR but looks good.

@mortenpi
Copy link
Member

There is of course a "breaking change" in that the plugin now has to be passed to makedocs via the plugin keyword argument instead of as a positional argument, but I would consider that a breaking change in Documenter, not DocumenterCitations. So a minor release should be okay.

Agreed, this is a change in Documenter's interface, not DocumenterCitations'. Documenter users should have an explicit compat on Documenter to avoid any issues with this.

@goerz goerz changed the title Compat with Documenter master. Compatibility with Documenter 1.0 Sep 16, 2023
This patch updates the code base so that it works with the breaking
release of Documenter 1.0.
@goerz goerz merged commit 5a66543 into master Sep 16, 2023
21 checks passed
@goerz goerz deleted the fe/Documenter-v1 branch September 16, 2023 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible with linkcheck
4 participants