Skip to content

Commit

Permalink
use new style quarto api functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Oct 9, 2022
1 parent a5acccc commit e252d7f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.luarc.json
/example.html
/example_files/
1 change: 1 addition & 0 deletions _extensions/quarto-ext/lightbox/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: Lightbox
author: RStudio, PBC
version: 0.1.4
quarto-required: ">=1.2.198"
contributes:
filters:
- lightbox.lua
6 changes: 3 additions & 3 deletions _extensions/quarto-ext/lightbox/lightbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ return {
},
{
Image = function(imgEl)
if quarto.doc.isFormat("html:js") then
if quarto.doc.is_format("html:js") then
local isAlreadyLinked = imagesWithinLinks:includes(imgEl)
if (not isAlreadyLinked and auto and not imgEl.classes:includes(kNoLightboxClass))
or imgEl.classes:includes('lightbox') then
Expand Down Expand Up @@ -161,7 +161,7 @@ return {
-- we need to include the dependencies
if needsLightbox then
-- add the dependency
quarto.doc.addHtmlDependency({
quarto.doc.add_html_dependency({
name = 'glightbox',
scripts = {'resources/js/glightbox.min.js'},
stylesheets = {'resources/css/glightbox.min.css', 'lightbox.css'}
Expand Down Expand Up @@ -230,7 +230,7 @@ return {
local scriptTag = "<script>var lightboxQuarto = GLightbox(" .. optionsJson .. ");</script>"

-- inject the rendering code
quarto.doc.includeText("after-body", scriptTag)
quarto.doc.include_text("after-body", scriptTag)

end
end
Expand Down
1 change: 0 additions & 1 deletion example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: Example Lightbox Document
filters:
- lightbox
lightbox: auto
keep-md: true
---

## Chilmark
Expand Down

0 comments on commit e252d7f

Please sign in to comment.