Skip to content

Commit

Permalink
Use note-square class for icon box
Browse files Browse the repository at this point in the history
Co-authored-by: Zhian N. Kamvar <[email protected]>
  • Loading branch information
tobyhodges and zkamvar committed Aug 22, 2023
1 parent 6ce0822 commit b79930a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions inst/rmarkdown/lua/lesson.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ local button_headings = {
{{title}}
</h4>]],
["spoiler"] = [[
<h4 class="accordion-header" id="heading{{id}}">
<h3 class="accordion-header" id="heading{{id}}">
<div class="note-square"><i aria-hidden="true" class="callout-icon" data-feather="eye"></i></div>
{{title}}
</h4>]],
</h3>]],
}

local accordion_titles = {
Expand Down Expand Up @@ -225,18 +226,10 @@ accordion = function(el, class)
if title == CLASS or title == nil or title == "" then
title = accordion_titles[class]
end
-- insert icon before heading if this is a spoiler accordion --
if class ~= "spoiler" then
heading = button_headings[class]
else
local this_icon = blocks["spoiler"]
heading = button_headings[class]
heading = "<i class='spoiler-icon' data-feather='"..this_icon.."'></i>"..heading
end

-- constructing the button that contains a heading
local this_button = accordion_button
this_button = this_button:gsub("{{heading}}", heading)
this_button = this_button:gsub("{{heading}}", button_headings[class])
this_button = this_button:gsub("{{title}}", title)
this_button = this_button:gsub("{{class}}", class)
this_button = this_button:gsub("{{id}}", label)
Expand Down

0 comments on commit b79930a

Please sign in to comment.