Skip to content

Commit

Permalink
Update _extension.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed May 30, 2023
1 parent 9c71054 commit 571e25d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion _extensions/critic-markup/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: Critic-markup
author: mloubout
version: 1.0.1
version: 1.0.3
quarto-required: ">=1.2.198"
contributes:
filters:
Expand Down
16 changes: 10 additions & 6 deletions _extensions/critic-markup/critic-markup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ end


if FORMAT:match 'html' then

function Str (el)
local replaced = {el}
-- Check for standard substitutions
Expand All @@ -113,27 +114,30 @@ if FORMAT:match 'html' then
return replaced
end

function Strikeout (strk)
return strk.content
end

-- Check Inlines for Strikeout (~~) and remove brackets before/after for replacement
function Inlines (inlines)
for i = #inlines-1,2,-1 do
if inlines[i] and inlines[i].t == 'Strikeout' and inlines[i+1] then
if inlines[i+1].t == 'Str' then
if inlines[i+1].text == "}" then
inlines:remove(i+1)
if inlines[i+1].text == st_e then
inlines[i+1] = adde
end
end
end
if inlines[i] and inlines[i].t == 'Strikeout' and inlines[i-1] then
if inlines[i-1].t == 'Str' then
if inlines[i-1].text == "{" then
inlines:remove(i-1)
if inlines[i-1].text == st_b then
inlines[i-1] = rm
end
end
end
end
return inlines
end

end

--- From the lightbox filter
Expand Down Expand Up @@ -167,4 +171,4 @@ function criticheader (meta)
end

-- All pass with Meta first
return {{Meta = criticheader}, {Inlines = Inlines}, {Str = Str}}
return {{Meta = criticheader}, {Inlines = Inlines}, {Strikeout = Strikeout}, {Str = Str}}

0 comments on commit 571e25d

Please sign in to comment.