Skip to content

Commit

Permalink
fix: Propagate Djot attributes to the blockquote implementation
Browse files Browse the repository at this point in the history
So the latter might implement a different behavior depending on them.
As of now, SILE's default blockquote (from SILE 0.15.0) and resilient's
style-aware blockquote don't support options, so this would not do anything
yet, but it paves the way for more customization or alternate
implementations.
N.B. It's also what we were already doing for the captioned quotes
(via the epigraph environment, which does support several options), so
it also fixes a small API discrepancy...
  • Loading branch information
Omikhleia authored and Didier Willis committed Dec 30, 2024
1 parent ef83934 commit 75fd989
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion inputters/djot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function Renderer:blockquote (node)
createCommand("caption", {}, caption)
}, pos)
else
out = createCommand("markdown:internal:blockquote", {}, content, pos)
out = createCommand("markdown:internal:blockquote", node.attr or {}, content, pos)
end
if node.attr then
-- Add a div when containing attributes
Expand Down
15 changes: 8 additions & 7 deletions packages/markdown/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -618,18 +618,19 @@ Please consider using a resilient-compatible class!]])
end
end, "Raw native block in Markdown (internal)")

self:registerCommand("markdown:internal:blockquote", function (_, content)
-- Would be nice NOT having to do this, but SILE's plain class only has a "quote"
-- environment that doesn't really nest, and hard-codes all its values, skips, etc.
self:registerCommand("markdown:internal:blockquote", function (options, content)
-- NOTE: The comment below applies to SILE 0.14.x.
-- SILE's plain class only has a "quote" environment that doesn't really nest, and
-- hard-codes all its values, skips, etc.
-- So we might have a better version provided by a user-class or package.
-- Otherwise, use our own fallback (with hard-coded choices too, but a least
-- it does some proper nesting)
-- NOTE: The above applies to SILE 0.14.x.
-- SILE 0.15 is expected to provide a blockquote environment.
-- SILE 0.15.0 provides a blockquote environment, so eventually this fallback
-- will be removed when we officially drop support for SILE 0.14.x.
if not self.hasCommandSupport.blockquote then
SILE.call("markdown:fallback:blockquote", {}, content)
SILE.call("markdown:fallback:blockquote", options, content)
else
SILE.call("blockquote", {}, content)
SILE.call("blockquote", options, content)
end
end, "Block quote in Markdown (internal)")

Expand Down

0 comments on commit 75fd989

Please sign in to comment.