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] Fix highlighting and always use latest packages #11662

Merged
merged 6 commits into from Jul 29, 2021

Conversation

cameel
Copy link
Member

@cameel cameel commented Jul 14, 2021

Depends on #11660 (I put whitespace changes in a separate PR because they add tons of noise).

The main point of this PR is to make b_docs job in CI use latest versions of Python packages, in particular Pygments. Locally I get a lot of errors from the highlighter but they do not appear in CI. Turns out it's because the image we use (solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-6) has an old version of Sphinx with its dependencies in it and pip by default does not update a package unless it absolutely has to.

To be able to do this I had to fix these highlighting errors though. Looks like the lexer has a lot of problems parsing fairly mundane stuff like &&, ||, ? :, 1e18 or pragma solidity >x.y.z;. In case of pragmas I fixed it by switching to >= but for others I just had to use :force: to make it continue despite errors. This is the same thing I noticed with assembly blocks in #11420. pygments-lexer-solidity does not seem actively maintained so we'll probably have to fix it ourselves eventually.

While doing it I also found some :: style blocks, apparently missed in #11477 so I converted them. Some existing blocks were also labeled with wrong language. Finally, I enabled highlighting for some of our JSON blocks (especially the Standard JSON input/output). They did have some syntax errors I had to fix (missing commas or quotes) and also I highlight them as javascript rather than json because comments are technically not valid in JSON and the highliter does not accept them.

@cameel cameel self-assigned this Jul 14, 2021
@cameel cameel force-pushed the docs-fix-highlighting-and-upgrade-pygments branch from d72e713 to e15a86d Compare July 14, 2021 18:24
pip3 install -r requirements.txt
pip3 install -r requirements.txt --upgrade --upgrade-strategy eager
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the whole point of the PR. Default upgrade strategy is only-if-needed so if an older package happens to be already installed and fits the requirements but a newer version is also available, pip keeps the older one.

Looks like we install the outdated python3-sphinx ourselves in the Ubuntu image. I think we can safely remove it from there.

Comment on lines -1266 to 1269
::
.. code-block:: none

for { ... } 1 { ... } {
if iszero(c) { break }
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to use yul with :force: for this but I can't because we try to compile all yul snippets in cmdlineTests.sh and these obviously won't compile.

@cameel cameel force-pushed the docs-fix-badly-indented-lists-and-blocks branch from 76bbd45 to b513ca1 Compare July 15, 2021 08:14
@cameel cameel force-pushed the docs-fix-highlighting-and-upgrade-pygments branch from e15a86d to 0f7a185 Compare July 15, 2021 08:14
Base automatically changed from docs-fix-badly-indented-lists-and-blocks to develop July 21, 2021 16:35
@chriseth chriseth merged commit 62727f3 into develop Jul 29, 2021
@chriseth chriseth deleted the docs-fix-highlighting-and-upgrade-pygments branch July 29, 2021 09:29
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

3 participants