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

Embed images into HTML document #523

Closed
cofinoa opened this issue Jun 5, 2024 · 11 comments · Fixed by #522
Closed

Embed images into HTML document #523

cofinoa opened this issue Jun 5, 2024 · 11 comments · Fixed by #522
Labels
enhancement Proposals to add new capabilities, improve existing ones in the conventions, improve style or format GitHub Improvement to how we use GitHub for this repository

Comments

@cofinoa
Copy link
Contributor

cofinoa commented Jun 5, 2024

Associated pull request

PR #522

The proposed PR #522 modifies the Github action which renders the HTML document of the convention, to embed images into the HTML document, instead of refer images as external file.

This has the advantage of having just one file, for the whole HTML convention document, like the PDF rendered version.

@cofinoa
Copy link
Contributor Author

cofinoa commented Jun 5, 2024

The PR #522 also includes a version update for the GH actions

@JonathanGregory JonathanGregory added enhancement Proposals to add new capabilities, improve existing ones in the conventions, improve style or format GitHub Improvement to how we use GitHub for this repository labels Jun 5, 2024
@JonathanGregory
Copy link
Contributor

Thank you, Antonio @cofinoa. Do you have an example of what the HTML looks like?

@cofinoa
Copy link
Contributor Author

cofinoa commented Jun 5, 2024

@JonathanGregory in PR #522 run checks summary and artifacts has been uploaded to:
https://github.com/cf-convention/cf-conventions/actions/runs/9383208743?pr=522

where you can find an artifact for the conformance document, and the artifact for the PDF and HTML documents.

@JonathanGregory
Copy link
Contributor

JonathanGregory commented Jun 5, 2024

Ah, I see. Each image is included as a string representation of its image data in the src of the img tags. That makes the html file bigger, I suppose, but it is still only half the size of the pdf. Thanks.

@cofinoa
Copy link
Contributor Author

cofinoa commented Jun 5, 2024

Yes!, it makes the HTML file itself bigger.

Also, the image content is BASE64 encoded, adding and overhead between 33%-37% with respect to the original binary data.

But, the good side it's that only on file it's needed for the HTML document. Therefore, it's trade-off

@larsbarring
Copy link
Contributor

The advantage is when one wants to download the html for offline access it is one file (~3.2 Mb), instead of either getting the html file without images (~840 kb), or the html file and an image directory (~840kb + ~1.9 Mb) depending on how the download is done. As it now is, If I uses Firefox to download the HTML link on the webpage I get the former, but if I open the html document in Firefox and then save the the document I get the latter. But I imagine this may differ between web browsers.

Anyway, the size difference is about 1 Mb, which is not excessive, and I think there is merit to always get the full document without having to think of a separate image subdirectory. Thanks Antonio. I will have a look at the PR, but I am far from an expert on gh workflows.

@JonathanGregory
Copy link
Contributor

Thanks for implementing this in #522, Antonio @cofinoa. I agree with you that it'll be a good improvement, and I don't know a reason why it shouldn't be included in 1.12. Jonathan

@JonathanGregory
Copy link
Contributor

Is it ready to be merged, Antonio @cofinoa? @larsbarring and I expressed for support for it more than three months ago, so it qualifies to be accepted, I think. I'd like to have @davidhassell's opinion, as the person in charge of the conventions document.

@cofinoa
Copy link
Contributor Author

cofinoa commented Sep 24, 2024

I'm updating the build process taking into account some comments from @davidhassell

After that, @davidhassell will review the PR and check that it's OK

@davidhassell
Copy link
Contributor

Hi Antonio,

I have just fetched a copy of your PR [*], typed make in the my local cf-conventions directory ... and it work perfectly! I.e. it created the following files, all of which had the correct images embedded in them:

conformance_build/conformance.html
conformance_build/conformance.pdf
conventions_build/cf-conventions.html
conventions_build/cf-conventions.pdf

I also tried

$ make clean; make
$ make clean; make html
$ make clean; make pdf
$ make clean; make html pdf
$ make clean; make all
$ make clean; make conformance
$ make clean; make conventions

which also worked as expected.

This is marvellous - thank you! I'm happy for this to be merged.

We should make it known that this capability exists, as as it will be useful to anyone writing PRs.

Cheers,
David

[*]

$ git fetch upstream pull/522/head:cofinoa-embed-html-img
$ git checkout cofinoa-embed-html-img

@JonathanGregory
Copy link
Contributor

Thanks again for this, Antonio @cofinoa. @davidhassell is quite right to describe it as "marvellous" - maybe even magical! Now that he's checked it too, and since it's received more than enough support to be accepted, I will merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Proposals to add new capabilities, improve existing ones in the conventions, improve style or format GitHub Improvement to how we use GitHub for this repository
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants