8000 fix: Update/Release for Quarto v1.2 (#4) · mcanouil/quarto-animate@f063c83 · GitHub
[go: up one dir, main page]

Skip to content

Commit f063c83

Browse files
authored
fix: Update/Release for Quarto v1.2 (#4)
Fixes #3
1 parent 06c2451 commit f063c83

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.DS_Store
22
example_files/
33
example.html
4+
5+
/.luarc.json

_extensions/animate/_extension.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
title: Animate.css support
22
author: Mickaël Canouil
3-
version: 0.1.0
3+
version: 1.0.0
4+
quarto-required: ">=1.2.280"
45
contributes:
56
shortcodes:
67
- animate-shortcodes.lua

_extensions/animate/animate-shortcodes.lua

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
local function ensureHtmlDeps()
2-
quarto.doc.addHtmlDependency({
1+
local function ensure_html_deps()
2+
quarto.doc.add_html_dependency({
33
name = 'animate',
44
version = '4.1.1',
55
stylesheets = {"animate.min.css"}
66
})
77
end
88

9-
local function isEmpty(s)
9+
local function is_empty(s)
1010
return s == nil or s == ''
1111
end
1212

13-
local function isValidAnimation(effect)
14-
if isEmpty(effect) then
13+
local function is_valid_animation(effect)
14+
if is_empty(effect) then
1515
return ''
1616
end
1717
local animation_array = {
@@ -126,13 +126,13 @@ local yamlAniDelay = "2s"
126126
local yamlAniRepeat = "1"
127127

128128
function setAniOptions(meta)
129-
if not isEmpty(meta['ani-delay']) then
129+
if not is_empty(meta['ani-delay']) then
130130
yamlAniDelay = meta['ani-delay']
131131
end
132-
if not isEmpty(meta['ani-duration']) then
132+
if not is_empty(meta['ani-duration']) then
133133
yamlAniDuration = meta['ani-duration']
134134
end
135-
if not isEmpty(meta['ani-repeat']) then
135+
if not is_empty(meta['ani-repeat']) then
136136
yamlAniRepeat = meta['ani-repeat']
137137
end
138138
meta['ani-delay'] = yamlAniDelay
@@ -145,27 +145,27 @@ return {
145145
{Meta = setAniOptions},
146146
["animate"] = function(args, kwargs)
147147
-- detect html (excluding epub which won't handle fa)
148-
if quarto.doc.isFormat("html:js") then
149-
ensureHtmlDeps()
150-
quarto.doc.includeText(
148+
if quarto.doc.is_format("html:js") then
149+
ensure_html_deps()
150+
quarto.doc.include_text(
151151
"in-header",
152152
"<style>:root{--animate-duration:" .. yamlAniDuration .. ";--animate-delay:" .. yamlAniDelay .. ";--animate-repeat:" .. yamlAniRepeat .. "}</style>"
153153
)
154154

155-
local animation = isValidAnimation(pandoc.utils.stringify(args[1]))
156-
if isEmpty(animation) then
155+
local animation = is_valid_animation(pandoc.utils.stringify(args[1]))
156+
if is_empty(animation) then
157157
return pandoc.Null()
158158
end
159159

160160
local aniDelay = pandoc.utils.stringify(kwargs["delay"])
161-
if isEmpty(aniDelay) then
161+
if is_empty(aniDelay) then
162162
attr_delay = ''
163163
else
164164
attr_delay = ' animate__delay-' .. aniDelay
165165
end
166166

167167
local aniRepeat = pandoc.utils.stringify(kwargs["repeat"])
168-
if isEmpty(aniRepeat) then
168+
if is_empty(aniRepeat) then
169169
attr_repeat = ''
170170
else
171171
if (aniRepeat == "infinite") then
@@ -176,7 +176,7 @@ return {
176176
end
177177

178178
local aniDuration = pandoc.utils.stringify(kwargs["duration"])
179-
if isEmpty(aniDuration) then
179+
if is_empty(aniDuration) then
180180
attr_duration = 'style="display: inline-block;"'
181181
else
182182
attr_duration = 'style="display: inline-block;animation-duration:' .. aniDuration .. '"'

0 commit comments

Comments
 (0)
0