Skip to content

Commit

Permalink
add bluesky icon
Browse files Browse the repository at this point in the history
  • Loading branch information
yohann committed Nov 13, 2024
1 parent c84794f commit 6cd1b74
Show file tree
Hide file tree
Showing 42 changed files with 245 additions and 1,207 deletions.
21 changes: 21 additions & 0 deletions _extensions/mcanouil/iconify/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 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.
7 changes: 7 additions & 0 deletions _extensions/mcanouil/iconify/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Iconify support
author: Mickaël Canouil
version: 2.1.2
quarto-required: ">=1.2.280"
contributes:
shortcodes:
- iconify.lua
13 changes: 13 additions & 0 deletions _extensions/mcanouil/iconify/iconify-icon.min.js

Large diffs are not rendered by default.

156 changes: 156 additions & 0 deletions _extensions/mcanouil/iconify/iconify.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
--[[
# 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 = '2.1.0',
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 icon = pandoc.utils.stringify(args[1])
local set = "fluent-emoji"

if #args > 1 and string.find(pandoc.utils.stringify(args[2]), ":") then
quarto.log.warning(
'Use "set:icon" or "set icon" syntax, not both! ' ..
'Using "set:icon" syntax and discarding first argument!'
)
icon = pandoc.utils.stringify(args[2])
end

if string.find(icon, ":") then
set = string.sub(icon, 1, string.find(icon, ":") - 1)
icon = string.sub(icon, string.find(icon, ":") + 1)
elseif #args > 1 then
set = icon
icon = pandoc.utils.stringify(args[2])
end

local attributes = ' icon="' .. set .. ':' .. icon .. '"'
local default_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="' .. default_label .. '"'
else
aria_label = ' aria-label="' .. aria_label .. '"'
end

local title = pandoc.utils.stringify(kwargs["title"])
if is_empty(title) then
title = ' title="' .. default_label .. '"'
else
title = ' title="' .. title .. '"'
end

attributes = attributes .. aria_label .. title

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

local inline = pandoc.utils.stringify(kwargs["inline"])
if is_empty(inline) or inline ~= "false" then
attributes = ' inline ' .. attributes
end


return pandoc.RawInline(
'html',
'<iconify-icon role="img"' .. attributes .. '></iconify-icon>'
)
else
return pandoc.Null()
end
end
}
2 changes: 1 addition & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ website:
href: https://github.com/
- icon: linkedin
href: https://www.linkedin.com/in/yohann-mansiaux-1816aa20/
- text: Bluesky
- text: "{{< iconify logos:bluesky >}}"
href: https://bsky.app/profile/yosky.bsky.social
- icon: envelope
url: "mailto:[email protected]"
Expand Down
3 changes: 0 additions & 3 deletions _site/bluesky.svg

This file was deleted.

5 changes: 1 addition & 4 deletions about.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ image: moi.jpg
about:
template: jolla
links:
- text: Bluesky
- text: "{{< iconify logos:bluesky >}}"
href: https://bsky.app/profile/yosky.bsky.social
- icon: linkedin
text: LinkedIn
href: https://www.linkedin.com/in/yohann-mansiaux-1816aa20/
- icon: github
text: Github
href: https://github.com/ymansiaux
- icon: envelope
text: [email protected]
url: "mailto:[email protected]"

---
Expand Down
3 changes: 0 additions & 3 deletions bluesky.svg

This file was deleted.

11 changes: 6 additions & 5 deletions docs/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<script src="site_libs/bootstrap/bootstrap.min.js"></script>
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script src="site_libs/quarto-contrib/iconify-2.1.0/iconify-icon.min.js"></script>
<script id="quarto-search-options" type="application/json">{
"location": "navbar",
"copy-button": false,
Expand Down Expand Up @@ -142,7 +143,7 @@
</li>
<li class="nav-item">
<a class="nav-link" href="https://bsky.app/profile/yosky.bsky.social">
<span class="menu-text">Bluesky</span></a>
<span class="menu-text"><iconify-icon role="img" inline="" icon="logos:bluesky" aria-label="Icon bluesky from logos Iconify.design set." title="Icon bluesky from logos Iconify.design set."></iconify-icon></span></a>
</li>
<li class="nav-item compact">
<a class="nav-link" href="mailto:[email protected]"> <i class="bi bi-envelope" role="img">
Expand Down Expand Up @@ -189,19 +190,19 @@ <h1 class="title">About</h1>
<hr class="about-sep">
<div class="about-links">
<a href="https://bsky.app/profile/yosky.bsky.social" class="about-link" rel="" target="">
<span class="about-link-text">Bluesky</span>
<span class="about-link-text"><iconify-icon role="img" inline="" icon="logos:bluesky" aria-label="Icon bluesky from logos Iconify.design set." title="Icon bluesky from logos Iconify.design set."></iconify-icon></span>
</a>
<a href="https://www.linkedin.com/in/yohann-mansiaux-1816aa20/" class="about-link" rel="" target="">
<i class="bi bi-linkedin"></i>
<span class="about-link-text">LinkedIn</span>
<span class="about-link-text"></span>
</a>
<a href="https://github.com/ymansiaux" class="about-link" rel="" target="">
<i class="bi bi-github"></i>
<span class="about-link-text">Github</span>
<span class="about-link-text"></span>
</a>
<a href="mailto:[email protected]" class="about-link" rel="" target="">
<i class="bi bi-envelope"></i>
<span class="about-link-text">[email protected]</span>
<span class="about-link-text"></span>
</a>
</div>
</div>
Expand Down
Loading

0 comments on commit 6cd1b74

Please sign in to comment.