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

Add versioned book on readthedocs.org #1036

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Kijewski
Copy link
Collaborator

@Kijewski Kijewski commented May 10, 2024

This PR adds the file .readthedocs.yaml, which is used by readthedocs.org to generate the book on their servers. RTD can be used to easily host docs for every Askama version, so users can explore how to use the current stable version, the current HEAD, and an older version.

For older versions then the current PR, the books won't be built, because we did not provided the needed .readthedocs.yaml.

Also an index.hbs is added to made mdbook and RTD work better together. Only the left sidebar was changed, but you have to override the whole file to make changes.

You can preview the book on: https://test-askama-rtd.readthedocs.io/pr-rtd/.

Resolves #1030.
Fixes #720.

This PR adds the file `.readthedocs.yaml`, which is used by
readthedocs.org to generate the book on their servers. RTD can be used
easily host docs for every Askama version, so users can explore how to
use the current stable version, the current HEAD, and an older version.

For older versions then the current PR, the books won't be built,
because we did not provided the needed `.readthedocs.yaml`.

Also an `index.hbs` is added to made mdbook and RTD work better
together. Only the left sidebar was changed, but you have to override
the whole file to make changes.
@GuillaumeGomez
Copy link
Collaborator

Just one question: can we generate it for older versions as well?

And also: we need to add a link to the book in the API documentation (at the crate level I suppose?).

@Kijewski
Copy link
Collaborator Author

Just one question: can we generate it for older versions as well?

Not really, not easily. You need a readthedocs.yaml file in the revision that you want to document. Readthedocs did allow to add the content of that file in a web form instead, but that feature was removed, for reproducibility's sake or something. They suggest that you create a branch v0.12.x.

I wouldn't like to add a branch just to document older releases, but maybe we could do a point release v0.12.2 that contains the file? But simply ignoring 0.12.x would would work for me, too. :)

@Kijewski
Copy link
Collaborator Author

@djc 👈🏻 👈🏻

It's not nice that only future versions will be documented, but I daresay that 0.13.0 won't be the last version, so better late than never?

@@ -0,0 +1,365 @@
<!DOCTYPE HTML>
Copy link
Owner

Choose a reason for hiding this comment

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

How was this generated? How do we keep it up to date in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How was this generated?

I copied https://github.com/rust-lang/mdBook/blob/master/src/theme/index.hbs, and edited inside nav#sidebar.

How do we keep it up to date in the future?

I guess we can write a reminder somewhere to look into https://github.com/rust-lang/mdBook/commits/master/src/theme/index.hbs before tagging a new version?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have a script to do it easily instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added.

@djc
Copy link
Owner

djc commented May 26, 2024

Sorry -- I'd prefer for the script to be written in Rust.

@Kijewski
Copy link
Collaborator Author

Kijewski commented May 26, 2024

Sure:

fn main() {
    if !std::process::Command::new("./update-theme.py")
        .spawn()
        .except("could not start")
        .status()
        .except("could not run")
        .success
    {
        panic!("script failed");
    }
}

:P Sorry, but feel free to translate the script.

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.

Publish all crate versions books Documentation site shows unreleased features
3 participants