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

[DOCS] Sphinx 4.x.y compatibility fixes #11420

Merged
merged 5 commits into from Jun 22, 2021

Conversation

cameel
Copy link
Member

@cameel cameel commented May 20, 2021

Depends on #11565.

Sphinx 4.0.0 has been released recently and deprecated some of the older features. Now scripts/docs.sh fails for me locally on that version. This PR adds some minor tweaks to make our docs work with both Sphinx 3 and Sphinx 4:

Bug in pygments-lexer-solidity

add_lexer() has a weird quirk:

  • When it gets an instance of the lexer, syntax errors are ignored and snippets with errors still get highlighted (the error just gets a red outline)
  • When it gets a class, syntax errors result in a warning on the command-line (WARNING: Could not lex literal_block as "Solidity". Highlighting skipped.) and highlighting is completely disabled for the buggy code snippet.

This has exposed a bug in pygments-lexer-solidity. The lexer apparently has problems handling assembly blocks that are followed by other Solidity instructions (but extra instructions before them are fine). Note for example the red outline in one of the examples in our current docs:

solidity-by-example-lexer-error-after-assembly-block

The error goes away only if I remove the return statement or the assembly block. We have 3 snippets like this. The snippets look fine to me and do compile so it must be a bug in the lexer rather than in the snippet.

I originally wanted to use the :force: option of the code-block directive to suppress these errors until the lexer is fixed. But it turns out that switching from :: to code-block was enough to suppress them. EDIT: Weird, it only works locally. I did need :force: to make it build in CI.

@cameel cameel self-assigned this May 20, 2021
Comment on lines +5 to +6
# Sphinx 2.1.0 is the oldest version that accepts a lexer class in add_lexer()
sphinx>=2.1.0
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this because b_docs job is failing. Apparently there is an ancient version of Sphinx (v1.8.5) already installed in the image.

@cameel cameel force-pushed the docs-sphinx-4-compatibility-fixes branch from 5eff7b5 to 1ee64f4 Compare May 20, 2021 20:03
@cameel
Copy link
Member Author

cameel commented May 20, 2021

This needs more work. Looks like isolate_tests.py treats the :force: option as a part of the snippet.

@cameel cameel marked this pull request as draft May 20, 2021 20:09
@cameel
Copy link
Member Author

cameel commented May 20, 2021

Lexer problem reported in pygments-lexer-solidity project on gitlab: https://gitlab.com/veox/pygments-lexer-solidity/-/issues/2

@chriseth
Copy link
Contributor

Looks good, but I think the test extractor needs to be updated.

@cameel cameel force-pushed the docs-sphinx-4-compatibility-fixes branch from 1ee64f4 to 98c4830 Compare June 21, 2021 18:55
@cameel cameel changed the base branch from develop to fix-isolate-tests-parsing-sphinx-block-parameters June 21, 2021 18:59
@cameel
Copy link
Member Author

cameel commented Jun 21, 2021

Extractor fixed in #11565. This PR is now based on it. I'll mark it as reviewable once the dependency is merged.

Base automatically changed from fix-isolate-tests-parsing-sphinx-block-parameters to develop June 22, 2021 09:01
@chriseth chriseth marked this pull request as ready for review June 22, 2021 09:02
@chriseth chriseth merged commit 6324688 into develop Jun 22, 2021
@chriseth chriseth deleted the docs-sphinx-4-compatibility-fixes branch June 22, 2021 09:02
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.

None yet

2 participants