hugo-embed-pdf-shortcode icon indicating copy to clipboard operation
hugo-embed-pdf-shortcode copied to clipboard

Support For Multiple Embeds

Open chtzvt opened this issue 2 years ago • 6 comments

Hello all,

This PR adds support for multiple embeds as discussed in #25. I've rolled the changes I've made for this into the original shortcode, and added a new partial responsible for loading pdf.js and the shortcode styles.

Give it a test and let me know what you think.

chtzvt avatar Jun 05 '22 15:06 chtzvt

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarcloud[bot] avatar Jun 05 '22 15:06 sonarcloud[bot]

Note that out of necessity, this PR changes how the PDF.js library is loaded.

As such, particular consideration should be taken with respect to #19. It may be wise to add a flag in the Hugo configuration where a site owner could specify the location of their own PDF.js instance, or fetch it from a CDN otherwise inside of the dependency loader.

chtzvt avatar Jun 09 '22 21:06 chtzvt

@anvithks Any thoughts on this?

chtzvt avatar Jul 21 '22 02:07 chtzvt

@anvithks Any thoughts on this?

I am sorry but I haven't been able to test this yet. I will try to spend some time over the weekend and merge the PR if all OK.

Thanks @ctrezevant .

anvithks avatar Jul 21 '22 02:07 anvithks

Hi @ctrezevant , thanks for sharing this code!

PR #32 is a proposal mixing your code and this little trick: splitting the code into multiple files can be avoided. See 0b75911 and this discussion on discourse.gohugo.io.

I've tested #32 and it works fine. If it's not working for you, please double-check the commits https://github.com/anvithks/hugo-embed-pdf-shortcode/pull/32/commits/f7a8fecb847c1845d35683c7a85eb82f751aabd3 and https://github.com/anvithks/hugo-embed-pdf-shortcode/pull/32/commits/e3642f0d37a806d5735e5f670e3e31e1f4da6841. They are required to make this shortcode work with my theme (Papermod) but your setup may be different

RoneoOrg avatar Sep 30 '22 05:09 RoneoOrg

Glad to see this moving forward! Everything looks solid after a cursory review.

chtzvt avatar Sep 30 '22 12:09 chtzvt