Skip to content

Bugfix/kbd adoc bad input #12499

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Apr 11, 2025
Merged

Bugfix/kbd adoc bad input #12499

merged 4 commits into from
Apr 11, 2025

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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants