Skip to content

Conversation

cscheid
Copy link
Collaborator

@cscheid cscheid commented Apr 9, 2025

Calling the kbd shortcode in asciidoc format with bad inputs would cause a crash. This turns the crash into a shortcode error message.

Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I looked into that, as we are producing some RawInline, I would have expected a pandoc.write so that proper escaping for ASCIIDOC is used
We have stringEscape(shortcutText, FORMAT) for that

-- escape string by converting using Pandoc
function stringEscape(str, format)
local doc = pandoc.Pandoc({pandoc.Para(str)})
return pandoc.write(doc, format)
end

@cscheid
Copy link
Collaborator Author

cscheid commented Apr 10, 2025

Actually, the previous code was correct, and we can't use pandoc.write. + needs to stay as + according to the docs, and pandoc.write produces {plus}.

@cscheid cscheid merged commit e95a894 into main Apr 11, 2025
49 checks passed
@cscheid cscheid deleted the bugfix/kbd-adoc-bad-input branch April 11, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants