Skip to content

Commit

Permalink
updated DefList
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey White committed Feb 6, 2025
1 parent ac5c3d8 commit 36e5a67
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions utils/pandoc_codeblock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,38 +101,40 @@ end
-- return pandoc.Para({pandoc.RawInline("markdown", "![" .. alt_text .. "](" .. src .. ")")})
-- end

function DefinitionList(el)
local new_blocks = {}

for _, item in ipairs(el.content) do
local term = item[1] -- Term (<dt>)
local definitions = item[2] -- Definitions (<dd>)

-- Split the term into separate parts: first word as header, rest as sub-item
if #term > 1 then
-- First part of the term becomes the header (###)
-- term[1] = term[1].src
table.insert(new_blocks, pandoc.Header(3, term[1], {}))

-- Remaining parts are combined and formatted (e.g., italicized)
local sub_term = {}
for i = 2, #term do
table.insert(sub_term, term[i])
end
table.insert(new_blocks, pandoc.Para(sub_term))
else
-- If the term is simple, just use it as a header
table.insert(new_blocks, pandoc.Header(3, term, {}))
end
-- function DefinitionList(el)
-- local new_blocks = {}

-- Process the definitions and convert to blockquote format
for _, def in ipairs(definitions) do
table.insert(new_blocks, pandoc.BlockQuote(def))
end
end
-- for _, item in ipairs(el.content) do
-- local term = item[1] -- Term (<dt>)
-- local definitions = item[2] -- Definitions (<dd>)

-- -- Split the term into separate parts: first word as header, rest as sub-item
-- if #term > 1 then
-- -- First part of the term becomes the header (###)
-- -- term[1] = term[1].src
-- table.insert(new_blocks, pandoc.Header(3, term[1], {}))

-- -- Remaining parts are combined and formatted (e.g., italicized)
-- local sub_term = {}
-- for i = 2, #term do
-- table.insert(sub_term, term[i])
-- end
-- table.insert(new_blocks, pandoc.Para(sub_term))
-- else
-- -- If the term is simple, just use it as a header
-- table.insert(new_blocks, pandoc.Header(3, term, {}))
-- end

-- -- table.insert(new_blocks, pandoc.HorizontalRule(definitions))

-- -- Process the definitions and convert to blockquote format
-- for _, def in ipairs(definitions) do
-- table.insert(new_blocks, pandoc.HorizontalRule(def))
-- end
-- end

return new_blocks
end
-- return new_blocks
-- end

function TableCell(el)
-- Remove inline styles from table cells
Expand Down

0 comments on commit 36e5a67

Please sign in to comment.