Skip to content

Commit

Permalink
Merge pull request #3 from sipbs-compbiol/2024-2025
Browse files Browse the repository at this point in the history
fix unavailable resources
  • Loading branch information
widdowquinn authored Nov 26, 2024
2 parents 3033f98 + 90253d2 commit fbfec28
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 2 deletions.
8 changes: 8 additions & 0 deletions _extensions/jmgirard/embedpdf/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: embedpdf
author: Jeffrey Girard
version: 0.4.1
quarto-required: ">=1.3.0"
contributes:
shortcodes:
- embedpdf.lua

65 changes: 65 additions & 0 deletions _extensions/jmgirard/embedpdf/embedpdf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
function pdf(args, kwargs)
local data = pandoc.utils.stringify(args[1]) or pandoc.utils.stringify(kwargs['file'])
local width = pandoc.utils.stringify(kwargs['width'])
local height = pandoc.utils.stringify(kwargs['height'])
local border = pandoc.utils.stringify(kwargs['border'])
local class = pandoc.utils.stringify(kwargs['class'])
local image = pandoc.utils.stringify(kwargs['image'])
local image_force = pandoc.utils.stringify(kwargs['image_force'])
local image_width = pandoc.utils.stringify(kwargs['image_width'])
local image_height = pandoc.utils.stringify(kwargs['image_height'])
local image_border = pandoc.utils.stringify(kwargs['image_border'])
local image_class = pandoc.utils.stringify(kwargs['image_class'])

if width ~= '' then
width = 'width="' .. width .. '" '
end

if height ~= '' then
height = 'height="' .. height .. '" '
end

if border ~= '' then
border = 'border="' .. border .. '" '
end

if class ~= '' then
class = 'class="' .. class .. '" '
end

if image_width ~= '' then
image_width = 'width="' .. image_width .. '" '
end

if image_height ~= '' then
image_height = 'height="' .. image_height .. '" '
end

if image_border ~= '' then
image_border = 'border="' .. image_border .. '" '
end

if image_class ~= '' then
image_class = 'class="' .. image_class .. '" '
end

-- detect html
if quarto.doc.isFormat("html:js") then
if image_force == 'TRUE' then
return pandoc.RawInline('html', '<a href="' .. data .. '" download><img src="' .. image .. '" ' .. image_width .. image_height .. image_class .. image_border .. ' /></a>')
end
if image ~= '' then
return pandoc.RawInline('html', '<object data="' .. data .. '" type="application/pdf"' .. width .. height .. class .. border .. '><a href="' .. data .. '" download><img src="' .. image .. '" ' .. image_width .. image_height .. image_class .. image_border .. ' /></a></object>')
else
return pandoc.RawInline('html', '<object data="' .. data .. '" type="application/pdf"' .. width .. height .. class .. border .. '><a href="' .. data .. '" download>Download PDF file.</a></object>')
end
else
return pandoc.Null()
end

end

-- Add alias shortcode
function embedpdf(...)
return pdf(...)
end
3 changes: 3 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
project:
type: website
resources:
- "assets/presentations/2024_slides.pdf"
- "assets/forms/SIPBS_Placement_Application_Form_2024-25_v2.docx"

website:
title: "SIPBS Internships"
Expand Down
2 changes: 1 addition & 1 deletion _variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ projects:
session:
date: "Friday 18th October 2024"
location: "SW105"
presentation: "assets/presentations/2024-25_introduction_to_SIPBS_Internships_v2.pdf"
presentation: "assets/presentations/2024_slides.pdf"
image: "assets/images/2024-25_slides.png"

form:
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ html:

This page provides a link to download the SIPBS internship matching presentation slides for {{< var ay >}}.

- [DOWNLOAD]({{< var session.presentation >}})
- [DOWNLOAD]({{< var session.presentation >}})

{{< pdf assets/presentations/2024_slides.pdf width=100% height=800 >}}

0 comments on commit fbfec28

Please sign in to comment.