1
- local function ensureHtmlDeps ()
2
- quarto .doc .addHtmlDependency ({
1
+ local function ensure_html_deps ()
2
+ quarto .doc .add_html_dependency ({
3
3
name = ' animate' ,
4
4
version = ' 4.1.1' ,
5
5
stylesheets = {" animate.min.css" }
6
6
})
7
7
end
8
8
9
- local function isEmpty (s )
9
+ local function is_empty (s )
10
10
return s == nil or s == ' '
11
11
end
12
12
13
- local function isValidAnimation (effect )
14
- if isEmpty (effect ) then
13
+ local function is_valid_animation (effect )
14
+ if is_empty (effect ) then
15
15
return ' '
16
16
end
17
17
local animation_array = {
@@ -126,13 +126,13 @@ local yamlAniDelay = "2s"
126
126
local yamlAniRepeat = " 1"
127
127
128
128
function setAniOptions (meta )
129
- if not isEmpty (meta [' ani-delay' ]) then
129
+ if not is_empty (meta [' ani-delay' ]) then
130
130
yamlAniDelay = meta [' ani-delay' ]
131
131
end
132
- if not isEmpty (meta [' ani-duration' ]) then
132
+ if not is_empty (meta [' ani-duration' ]) then
133
133
yamlAniDuration = meta [' ani-duration' ]
134
134
end
135
- if not isEmpty (meta [' ani-repeat' ]) then
135
+ if not is_empty (meta [' ani-repeat' ]) then
136
136
yamlAniRepeat = meta [' ani-repeat' ]
137
137
end
138
138
meta [' ani-delay' ] = yamlAniDelay
@@ -145,27 +145,27 @@ return {
145
145
{Meta = setAniOptions },
146
146
[" animate" ] = function (args , kwargs )
147
147
-- 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 (
151
151
" in-header" ,
152
152
" <style>:root{--animate-duration:" .. yamlAniDuration .. " ;--animate-delay:" .. yamlAniDelay .. " ;--animate-repeat:" .. yamlAniRepeat .. " }</style>"
153
153
)
154
154
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
157
157
return pandoc .Null ()
158
158
end
159
159
160
160
local aniDelay = pandoc .utils .stringify (kwargs [" delay" ])
161
- if isEmpty (aniDelay ) then
161
+ if is_empty (aniDelay ) then
162
162
attr_delay = ' '
163
163
else
164
164
attr_delay = ' animate__delay-' .. aniDelay
165
165
end
166
166
167
167
local aniRepeat = pandoc .utils .stringify (kwargs [" repeat" ])
168
- if isEmpty (aniRepeat ) then
168
+ if is_empty (aniRepeat ) then
169
169
attr_repeat = ' '
170
170
else
171
171
if (aniRepeat == " infinite" ) then
@@ -176,7 +176,7 @@ return {
176
176
end
177
177
178
178
local aniDuration = pandoc .utils .stringify (kwargs [" duration" ])
179
- if isEmpty (aniDuration ) then
179
+ if is_empty (aniDuration ) then
180
180
attr_duration = ' style="display: inline-block;"'
181
181
else
182
182
attr_duration = ' style="display: inline-block;animation-duration:' .. aniDuration .. ' "'
0 commit comments