-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5a8deb
commit 502fcfb
Showing
32 changed files
with
5,610 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title: Lordicon support | ||
author: Jeffrey Girard | ||
version: 0.3.0 | ||
contributes: | ||
shortcodes: | ||
- lordicon.lua |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
function ensureHtmlDeps() | ||
quarto.doc.addHtmlDependency({ | ||
name = 'lord-icon-bundle', | ||
version = '3.4.4', | ||
scripts = {'assets/js/bundle.js'} | ||
}) | ||
end | ||
|
||
|
||
function li(args, kwargs) | ||
local code = pandoc.utils.stringify(args[1]) | ||
local trigger = pandoc.utils.stringify(kwargs['trigger']) | ||
local speed = pandoc.utils.stringify(kwargs['speed']) | ||
local delay = pandoc.utils.stringify(kwargs['delay']) | ||
local colors = pandoc.utils.stringify(kwargs['colors']) | ||
local stroke = pandoc.utils.stringify(kwargs['stroke']) | ||
local scale = pandoc.utils.stringify(kwargs['scale']) | ||
local x = pandoc.utils.stringify(kwargs['x']) | ||
local y = pandoc.utils.stringify(kwargs['y']) | ||
local class = pandoc.utils.stringify(kwargs['class']) | ||
|
||
local src = 'src="https://cdn.lordicon.com/' .. code .. '.json" ' | ||
|
||
if trigger ~= '' then | ||
trigger = 'trigger="' .. trigger .. '" ' | ||
end | ||
|
||
if speed ~= '' then | ||
speed = 'speed="' .. speed .. '" ' | ||
end | ||
|
||
if delay ~= '' then | ||
delay = 'delay="' .. delay .. '" ' | ||
end | ||
|
||
if colors ~= '' then | ||
colors = 'colors="' .. colors .. '" ' | ||
end | ||
|
||
if stroke ~= '' then | ||
stroke = 'stroke="' .. stroke .. '" ' | ||
end | ||
|
||
if scale ~= '' then | ||
scale = 'scale="' .. scale .. '" ' | ||
end | ||
|
||
if x ~= '' then | ||
x = 'axis-x="' .. x .. '" ' | ||
end | ||
|
||
if y ~= '' then | ||
y = 'axis-y="' .. y .. '" ' | ||
end | ||
|
||
if class ~= '' then | ||
class = 'class="' .. class .. '" ' | ||
end | ||
|
||
-- detect html | ||
if quarto.doc.isFormat("html:js") then | ||
ensureHtmlDeps() | ||
return pandoc.RawInline('html', '<lord-icon ' .. speed .. delay .. colors .. stroke .. scale .. x .. y .. class .. src .. trigger .. '></lord-icon>') | ||
else | ||
return pandoc.Null() | ||
end | ||
|
||
end | ||
|
||
|
||
function lif(args, kwargs) | ||
local file = pandoc.utils.stringify(args[1]) | ||
local trigger = pandoc.utils.stringify(kwargs['trigger']) | ||
local speed = pandoc.utils.stringify(kwargs['speed']) | ||
local delay = pandoc.utils.stringify(kwargs['delay']) | ||
local colors = pandoc.utils.stringify(kwargs['colors']) | ||
local stroke = pandoc.utils.stringify(kwargs['stroke']) | ||
local scale = pandoc.utils.stringify(kwargs['scale']) | ||
local x = pandoc.utils.stringify(kwargs['x']) | ||
local y = pandoc.utils.stringify(kwargs['y']) | ||
local class = pandoc.utils.stringify(kwargs['class']) | ||
|
||
local src = 'src="' .. file .. '" ' | ||
|
||
if trigger ~= '' then | ||
trigger = 'trigger="' .. trigger .. '" ' | ||
end | ||
|
||
if speed ~= '' then | ||
speed = 'speed="' .. speed .. '" ' | ||
end | ||
|
||
if delay ~= '' then | ||
delay = 'delay="' .. delay .. '" ' | ||
end | ||
|
||
if colors ~= '' then | ||
colors = 'colors="' .. colors .. '" ' | ||
end | ||
|
||
if stroke ~= '' then | ||
stroke = 'stroke="' .. stroke .. '" ' | ||
end | ||
|
||
if scale ~= '' then | ||
scale = 'scale="' .. scale .. '" ' | ||
end | ||
|
||
if x ~= '' then | ||
x = 'axis-x="' .. x .. '" ' | ||
end | ||
|
||
if y ~= '' then | ||
y = 'axis-y="' .. y .. '" ' | ||
end | ||
|
||
if class ~= '' then | ||
class = 'class="' .. class .. '" ' | ||
end | ||
|
||
-- detect html | ||
if quarto.doc.isFormat("html:js") then | ||
ensureHtmlDeps() | ||
return pandoc.RawInline('html', '<lord-icon ' .. speed .. delay .. colors .. stroke .. scale .. x .. y .. class .. src .. trigger .. '></lord-icon>') | ||
else | ||
return pandoc.Null() | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Mickaël Canouil | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
title: Iconify support | ||
author: Mickaël Canouil | ||
version: 1.0.7 | ||
quarto-required: ">=1.2.280" | ||
contributes: | ||
shortcodes: | ||
- iconify.lua |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
--[[ | ||
# MIT License | ||
# | ||
# Copyright (c) Mickaël Canouil | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
]] | ||
|
||
local function ensure_html_deps() | ||
quarto.doc.add_html_dependency({ | ||
name = 'iconify', | ||
version = '1.0.7', | ||
scripts = {"iconify-icon.min.js"} | ||
}) | ||
end | ||
|
||
local function is_empty(s) | ||
return s == nil or s == '' | ||
end | ||
|
||
local function is_valid_size(size) | ||
if is_empty(size) then | ||
return '' | ||
end | ||
local size_table = { | ||
["tiny"] = "0.5em", | ||
["scriptsize"] = "0.7em", | ||
["footnotesize"] = "0.8em", | ||
["small"] = "0.9em", | ||
["normalsize"] = "1em", | ||
["large"] = "1.2em", | ||
["Large"] = "1.5em", | ||
["LARGE"] = "1.75em", | ||
["huge"] = "2em", | ||
["Huge"] = "2.5em", | ||
["1x"] = "1em", | ||
["2x"] = "2em", | ||
["3x"] = "3em", | ||
["4x"] = "4em", | ||
["5x"] = "5em", | ||
["6x"] = "6em", | ||
["7x"] = "7em", | ||
["8x"] = "8em", | ||
["9x"] = "9em", | ||
["10x"] = "10em", | ||
["2xs"] = "0.625em", | ||
["xs"] = "0.75em", | ||
["sm"] = "0.875em", | ||
["lg"] = "1.25em", | ||
["xl"] = "1.5em", | ||
["2xl"] = "2em" | ||
} | ||
for key, value in pairs(size_table) do | ||
if key == size then | ||
return 'font-size: ' .. value .. ';' | ||
end | ||
end | ||
return 'font-size: ' .. size .. ';' | ||
end | ||
|
||
return { | ||
["iconify"] = function(args, kwargs) | ||
-- detect html (excluding epub which won't handle fa) | ||
if quarto.doc.is_format("html:js") then | ||
ensure_html_deps() | ||
local set = "fluent-emoji" | ||
local icon = pandoc.utils.stringify(args[1]) | ||
if #args > 1 then | ||
set = icon | ||
icon = pandoc.utils.stringify(args[2]) | ||
end | ||
|
||
local attributes = ' icon="' .. set .. ':' .. icon .. '"' | ||
local label = '"Icon ' .. icon .. ' from ' .. set .. ' Iconify.design set."' | ||
|
||
local size = is_valid_size(pandoc.utils.stringify(kwargs["size"])) | ||
if not is_empty(size) then | ||
attributes = attributes .. ' style="' .. size .. '"' | ||
end | ||
|
||
local aria_label = pandoc.utils.stringify(kwargs["label"]) | ||
if is_empty(aria_label) then | ||
aria_label = ' aria-label="' .. label .. '"' | ||
else | ||
attributes = attributes .. aria_label | ||
end | ||
local title = pandoc.utils.stringify(kwargs["title"]) | ||
if is_empty(title) then | ||
title = ' title="' .. label .. '"' | ||
else | ||
attributes = attributes .. title | ||
end | ||
-- local style = pandoc.utils.stringify(kwargs["style"]) | ||
-- if not is_empty(style) then | ||
-- local attributes = attributes .. ' style="' .. style .. '"' | ||
-- end | ||
local width = pandoc.utils.stringify(kwargs["width"]) | ||
if not is_empty(width) and is_empty(size) then | ||
attributes = attributes .. ' width="' .. width .. '"' | ||
end | ||
local height = pandoc.utils.stringify(kwargs["height"]) | ||
if not is_empty(height) and is_empty(size) then | ||
attributes = attributes .. ' height="' .. height .. '"' | ||
end | ||
local flip = pandoc.utils.stringify(kwargs["flip"]) | ||
if not is_empty(flip) then | ||
attributes = attributes .. ' flip="' .. flip.. '"' | ||
end | ||
local rotate = pandoc.utils.stringify(kwargs["rotate"]) | ||
if not is_empty(rotate) then | ||
attributes = attributes .. ' rotate="' .. rotate .. '"' | ||
end | ||
|
||
return pandoc.RawInline( | ||
'html', | ||
'<iconify-icon inline' .. attributes .. '></iconify-icon>' | ||
) | ||
else | ||
return pandoc.Null() | ||
end | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title: Support for academicons | ||
author: David Schoch | ||
version: 0.2.3 | ||
contributes: | ||
shortcodes: | ||
- academicons.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
-- function ensureLatexDeps() | ||
-- quarto.doc.useLatexPackage("academicons") | ||
-- end | ||
|
||
local function ensureHtmlDeps() | ||
quarto.doc.addHtmlDependency({ | ||
name = "academicons", | ||
version = "1.9.2", | ||
stylesheets = { "assets/css/all.css", "assets/css/size.css" } | ||
}) | ||
end | ||
|
||
local function isEmpty(s) | ||
return s == nil or s == '' | ||
end | ||
|
||
local function isValidSize(size) | ||
local validSizes = { | ||
"tiny", "scriptsize", "footnotesize", "small", "normalsize", | ||
"large", "Large", "LARGE", "huge", "Huge", | ||
"1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x", | ||
"2xs", "xs", "sm", "lg", "xl", "2xl" | ||
} | ||
for _, v in ipairs(validSizes) do | ||
if v == size then | ||
return " ai-" .. size | ||
end | ||
end | ||
return "" | ||
end | ||
|
||
return { | ||
["ai"] = function(args, kwargs) | ||
local group = "" | ||
local icon = pandoc.utils.stringify(args[1]) | ||
if #args > 1 then | ||
group = icon | ||
icon = pandoc.utils.stringify(args[2]) | ||
end | ||
|
||
local size = isValidSize(pandoc.utils.stringify(kwargs["size"])) | ||
local color = pandoc.utils.stringify(kwargs["color"]) | ||
if not isEmpty(color) then | ||
color = " style=\"color:" .. color .. "\"" | ||
--else | ||
-- color = " style=\"color:" .. "black" .. "\"" | ||
end | ||
|
||
local title = pandoc.utils.stringify(kwargs["title"]) | ||
if not isEmpty(title) then | ||
title = " title=\"" .. title .. "\"" | ||
end | ||
|
||
-- detect html (excluding epub) | ||
if quarto.doc.isFormat("html:js") then | ||
ensureHtmlDeps() | ||
if isEmpty(size) then | ||
local csize = pandoc.utils.stringify(kwargs["size"]) | ||
if (isEmpty(csize)) then | ||
csize = "" | ||
else | ||
csize = " style=\"font-size:" .. csize .. "\"" | ||
end | ||
return pandoc.RawInline( | ||
'html', | ||
"<i class=\"ai " .. group .. " ai-" .. icon .. "\"" .. title .. color .. csize .. "></i>" | ||
) | ||
else | ||
return pandoc.RawInline( | ||
'html', | ||
"<i class=\"ai " .. group .. " ai-" .. icon .. size .. "\"" .. title .. color .. "></i>" | ||
) | ||
end | ||
-- detect pdf / beamer / latex / etc | ||
-- elseif quarto.doc.isFormat("pdf") then | ||
-- ensureLatexDeps() | ||
-- return pandoc.RawInline('tex', "\\aiIcon{" .. icon .. "}") | ||
else | ||
return pandoc.Null() | ||
end | ||
end | ||
} |
Oops, something went wrong.