1
- local function ensureHtmlDeps ()
2
- quarto .doc .addHtmlDependency ({
1
+ local function ensure_html_deps ()
2
+ quarto .doc .add_html_dependency ({
3
3
name = ' iconify' ,
4
4
version = ' 1.0.0-beta.2' ,
5
5
scripts = {" iconify-icon.min.js" }
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 isValidSize (size )
14
- if isEmpty (size ) then
13
+ local function is_valid_size (size )
14
+ if is_empty (size ) then
15
15
return ' '
16
16
end
17
17
local size_table = {
53
53
return {
54
54
[" iconify" ] = function (args , kwargs )
55
55
-- detect html (excluding epub which won't handle fa)
56
- if quarto .doc .isFormat (" html:js" ) then
57
- ensureHtmlDeps ()
56
+ if quarto .doc .is_format (" html:js" ) then
57
+ ensure_html_deps ()
58
58
local set = " fluent-emoji"
59
59
local icon = pandoc .utils .stringify (args [1 ])
60
60
if # args > 1 then
@@ -65,41 +65,41 @@ return {
65
65
local attributes = ' icon="' .. set .. ' :' .. icon .. ' "'
66
66
local label = ' "Icon ' .. icon .. ' from ' .. set .. ' Iconify.design set."'
67
67
68
- local size = isValidSize (pandoc .utils .stringify (kwargs [" size" ]))
69
- if not isEmpty (size ) then
68
+ local size = is_valid_size (pandoc .utils .stringify (kwargs [" size" ]))
69
+ if not is_empty (size ) then
70
70
attributes = attributes .. ' style="' .. size .. ' "'
71
71
end
72
72
73
73
local aria_label = pandoc .utils .stringify (kwargs [" label" ])
74
- if isEmpty (aria_label ) then
74
+ if is_empty (aria_label ) then
75
75
aria_label = ' aria-label="' .. label .. ' "'
76
76
else
77
77
attributes = attributes .. aria_label
78
78
end
79
79
local title = pandoc .utils .stringify (kwargs [" title" ])
80
- if isEmpty (title ) then
80
+ if is_empty (title ) then
81
81
title = ' title="' .. label .. ' "'
82
82
else
83
83
attributes = attributes .. title
84
84
end
85
85
-- local style = pandoc.utils.stringify(kwargs["style"])
86
- -- if not isEmpty (style) then
86
+ -- if not is_empty (style) then
87
87
-- local attributes = attributes .. ' style="' .. style .. '"'
88
88
-- end
89
89
local width = pandoc .utils .stringify (kwargs [" width" ])
90
- if not isEmpty (width ) and isEmpty (size ) then
90
+ if not is_empty (width ) and is_empty (size ) then
91
91
attributes = attributes .. ' width="' .. width .. ' "'
92
92
end
93
93
local height = pandoc .utils .stringify (kwargs [" height" ])
94
- if not isEmpty (height ) and isEmpty (size ) then
94
+ if not is_empty (height ) and is_empty (size ) then
95
95
attributes = attributes .. ' height="' .. height .. ' "'
96
96
end
97
97
local flip = pandoc .utils .stringify (kwargs [" flip" ])
98
- if not isEmpty (flip ) then
98
+ if not is_empty (flip ) then
99
99
attributes = attributes .. ' flip="' .. flip .. ' "'
100
100
end
101
101
local rotate = pandoc .utils .stringify (kwargs [" rotate" ])
102
- if not isEmpty (rotate ) then
102
+ if not is_empty (rotate ) then
103
103
attributes = attributes .. ' rotate="' .. rotate .. ' "'
104
104
end
105
105
0 commit comments