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: Add version switcher #265

Merged

Conversation

nicu1989
Copy link
Contributor

Improvement

Description

Use current theme(pydata_sphinx_theme) version switcher dropdown to display a version selector. Because the switcher requires a json, the versions file is parsed into versions.json.
Also a css update of the version switcher is required to proper display(vertical scrollbar) the list of versions.

Because of a current bug #194 this PR will not show the docs preview. However I created another PR for preview only: https://nicu1989.github.io/score/pr-7/

Here is also a picture of the dropdown:

image

Also there is a way to view the versions file in browser using the json file: https://eclipse-score.github.io/score/versions.json

Related ticket

closes [#250 ] (improvement ticket)

@nicu1989 nicu1989 requested a review from danwosq January 31, 2025 09:58
Copy link
Contributor

@danwos danwos left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the PR 👍

Copy link
Contributor

@dcalavrezo-qorix dcalavrezo-qorix left a comment

Choose a reason for hiding this comment

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

there is a docs-cleanup.yml workflow which handles removal of previews

I think you should update the JSON in there too

  steps:
      - uses: actions/checkout@v4
        with:
          ref: gh-pages
      - name: Remove version
        run: |
          if [[ ${{ github.event_name }} == "pull_request" ]]; then
            VERSION="pr-${{ github.event.pull_request.number }}"
          else
            VERSION="${{ github.ref_name }}"
          fi

          echo "VERSION=$VERSION" >> $GITHUB_ENV

          # Delete the folder and remove the version from the versions file
          rm -rf "${VERSION}"
          sed -i "/^$VERSION$/d" versions

@nicu1989 nicu1989 force-pushed the nicu1989_docs_version_switcher branch from 1bd5947 to 6a211be Compare February 5, 2025 08:57
@nicu1989
Copy link
Contributor Author

nicu1989 commented Feb 5, 2025

there is a docs-cleanup.yml workflow which handles removal of previews

I think you should update the JSON in there too

  steps:
      - uses: actions/checkout@v4
        with:
          ref: gh-pages
      - name: Remove version
        run: |
          if [[ ${{ github.event_name }} == "pull_request" ]]; then
            VERSION="pr-${{ github.event.pull_request.number }}"
          else
            VERSION="${{ github.ref_name }}"
          fi

          echo "VERSION=$VERSION" >> $GITHUB_ENV

          # Delete the folder and remove the version from the versions file
          rm -rf "${VERSION}"
          sed -i "/^$VERSION$/d" versions

true & done. thank you

@AlexanderLanin
Copy link
Member

This PR will maintain a versions and a versons.json file? Shouldn't we get rid of the first one then?

@AlexanderLanin AlexanderLanin added infrastructure General Score infrastructure topics docs-as-code labels Feb 5, 2025
@nicu1989 nicu1989 force-pushed the nicu1989_docs_version_switcher branch from 6a211be to 9bf5407 Compare February 6, 2025 09:48
Use current theme(pydata_sphinx_theme) version switcher dropdown to display a version selector.
Because the switcher requires a json, the versions file is parsed into versions.json.
Also a css update of the version switcher is required to proper display(vertical scrollbar) the list of versions.

Signed-off-by: Nicolae Dicu <Nicolae.Dicu.ext@qorix.ai>
@nicu1989 nicu1989 force-pushed the nicu1989_docs_version_switcher branch from 9bf5407 to 0fec7e5 Compare February 6, 2025 09:51
@nicu1989
Copy link
Contributor Author

nicu1989 commented Feb 6, 2025

This PR will maintain a versions and a versons.json file? Shouldn't we get rid of the first one then?

You are right, versions is published only for information and we have now versions.json which can be easily viewed in browser. I removed versions handling. All new PR will be stored in versions.json.

@AlexanderLanin AlexanderLanin merged commit 734265e into eclipse-score:main Feb 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-as-code infrastructure General Score infrastructure topics
Projects
Development

Successfully merging this pull request may close these issues.

5 participants