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

Serve OCaml Compiler Manuals #2150

Merged
merged 7 commits into from
Apr 15, 2024
Merged

Conversation

mtelvers
Copy link
Contributor

@mtelvers mtelvers commented Mar 8, 2024

  • Include the precompiled html manuals from ocaml-web/html-compiler-manuals into the Dockerfile. The RUN line determines which branches exist and clones them all into local directories: /manual/4.14, /manual/5.0, etc; updating this is unnecessary when a new version is released.
  • Updated the code to serve /manual and below from the local filesystem
  • Added default name index.html when the directory is requested
  • Updated the default manual link /manual to serve from these files rather than redirect to v2.ocaml.org

@@ -449,6 +449,25 @@ let from_v2 =
("/releases/latest/api/index.html", Url.api_with_version latest_version);
]

let default_index_html =
[
("/manual", Url.manual_lang latest_version);
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to add one for latest.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need a redirect for latest, we need to serve this via Dream under /manual/latest. A redirect would mean that the URL in the browser would change to the specific version.

src/global/url.ml Outdated Show resolved Hide resolved
@cuihtlauac
Copy link
Collaborator

Using the following on the upstream https://github.com/ocaml-web:

git grep -ho 'href=\"https://[._a-z0-9/\-]*' | sort -u

I found the following hardcoded urls:

https://ocaml.org/
https://ocaml.org/releases/
https://ocaml.org/releases/4.13/ocaml-4.13-refman-html.tar.gz
https://ocaml.org/releases/4.13/ocaml-4.13-refman.info.tar.gz
https://ocaml.org/releases/4.13/ocaml-4.13-refman.pdf
https://ocaml.org/releases/4.13/ocaml-4.13-refman.txt
https://ocaml.org/releases/4.14/ocaml-4.14-refman-html.tar.gz
https://ocaml.org/releases/4.14/ocaml-4.14-refman.info.tar.gz
https://ocaml.org/releases/4.14/ocaml-4.14-refman.pdf
https://ocaml.org/releases/4.14/ocaml-4.14-refman.txt
https://ocaml.org/releases/5.0/ocaml-5.0-refman-html.tar.gz
https://ocaml.org/releases/5.0/ocaml-5.0-refman.info.tar.gz
https://ocaml.org/releases/5.0/ocaml-5.0-refman.pdf
https://ocaml.org/releases/5.0/ocaml-5.0-refman.txt
https://ocaml.org/releases/5.1/ocaml-5.1-refman-html.tar.gz
https://ocaml.org/releases/5.1/ocaml-5.1-refman.info.tar.gz
https://ocaml.org/releases/5.1/ocaml-5.1-refman.pdf
https://ocaml.org/releases/5.1/ocaml-5.1-refman.txt
https://ocaml.org/releases/5.2/ocaml-5.2-refman-html.tar.gz
https://ocaml.org/releases/5.2/ocaml-5.2-refman.info.tar.gz
https://ocaml.org/releases/5.2/ocaml-5.2-refman.pdf
https://ocaml.org/releases/5.2/ocaml-5.2-refman.txt
https://ocaml.org/releases/5.3/ocaml-5.3-refman-html.tar.gz
https://ocaml.org/releases/5.3/ocaml-5.3-refman.info.tar.gz
https://ocaml.org/releases/5.3/ocaml-5.3-refman.pdf
https://ocaml.org/releases/5.3/ocaml-5.3-refman.txt

All but the first two trampolines to v2. We should all turn them into relative links.

Dockerfile Outdated Show resolved Hide resolved
src/global/url.ml Outdated Show resolved Hide resolved
@cuihtlauac
Copy link
Collaborator

The changes I'm proposing to handle api urls are in this branch: https://github.com/ocaml/ocaml.org/tree/html-compiler-manuals-api

@sabine
Copy link
Collaborator

sabine commented Apr 9, 2024

@cuihtlauac I don't see a reason why we should introduce a config variable OCAMLORG_MANUAL_PATH for the manual path. The rest looks useful on first glance, but haven't checked in detail.

@cuihtlauac
Copy link
Collaborator

@cuihtlauac I don't see a reason why we should introduce a config variable OCAMLORG_MANUAL_PATH for the manual path. The rest looks useful on first glance, but haven't checked in detail.

That allows developers to put their local copy of html-compiler-manual wherever they want/need (not only /).

Cuihtlauac ALVARADO and others added 2 commits April 10, 2024 15:49
* Repair broken API links to v2
* Deduplicate
  - Url.manual_lang into Url.manual_with_version
  - Url.manual_api into Url.api_with_version
@mtelvers
Copy link
Contributor Author

I have added @cuihtlauac latest commit to this PR and included a commit to update line 50 of src/global/url.ml as the refactoring of these lines has made api_with_version the same as manual_with_version where they should be different:

-let api_with_version v = "/manual/" ^ minor v ^ "/index.html"
+let api_with_version v = "/manual/" ^ minor v ^ "/api/index.html"

@shakthimaan I note that search_icon.svg is missing from the api folder for all the versions of the manuals except for 4.12 and 4.13. I think it needs to be included.

@shakthimaan
Copy link
Contributor

search_icon.svg is missing from the api folder

The search_icon.svg has been added to the respective api/ folders.

@sabine sabine changed the title Added local serving of HTML manuals Serve OCaml Compiler Manuals Apr 15, 2024
sabine added a commit that referenced this pull request Apr 15, 2024
Copy link
Collaborator

@sabine sabine left a comment

Choose a reason for hiding this comment

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

LGTM, on staging this seems to work fine

@sabine sabine merged commit 87f1858 into ocaml:main Apr 15, 2024
3 checks passed
@Octachron
Copy link
Member

Thanks a lot for the hard work on integrating the reference manual !

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

5 participants