Skip to content

Commit

Permalink
Merge pull request #249 from Witiko/feature/map-unicode-nbsp-to-nbsp-…
Browse files Browse the repository at this point in the history
…renderer

Map non-breaking space to `writer->nbsp`
  • Loading branch information
github-actions[bot] authored Jan 13, 2023
2 parents 31d90e6 + 7db18b0 commit 522e75d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Documentation:
Fixes:

- Map U+0000 to U+FFFD in strings. (lostenderman#34, #247)
- Map non-breaking space to `writer->nbsp` in strings. (lostenderman#99, #247)
- Map non-breaking space to `writer->nbsp` in strings.
(lostenderman#99, #247, #249)

Default Renderer Prototypes:

Expand Down
38 changes: 24 additions & 14 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -20828,24 +20828,35 @@ function M.writer.new(options)
%
% \end{markdown}
% \begin{macrocode}
self.escaped_uri_chars = {
["{"] = "\\markdownRendererLeftBrace{}",
["}"] = "\\markdownRendererRightBrace{}",
["\\"] = "\\markdownRendererBackslash{}",
}
self.escaped_minimal_strings = {
["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ",
["☒"] = "\\markdownRendererTickedBox{}",
["⌛"] = "\\markdownRendererHalfTickedBox{}",
["☐"] = "\\markdownRendererUntickedBox{}",
}
self.escaped_uri_chars = {
["{"] = "\\markdownRendererLeftBrace{}",
["}"] = "\\markdownRendererRightBrace{}",
["\\"] = "\\markdownRendererBackslash{}",
}
self.escaped_minimal_strings = {
["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ",
["☒"] = "\\markdownRendererTickedBox{}",
["⌛"] = "\\markdownRendererHalfTickedBox{}",
["☐"] = "\\markdownRendererUntickedBox{}",
}
% \end{macrocode}
% \par
% \begin{markdown}
%
% Define table \luamdef{writer->escaped_strings} containing the mapping from
% character strings that need to be escaped in typeset content.
%
% \end{markdown}
% \begin{macrocode}
self.escaped_strings = util.table_copy(self.escaped_minimal_strings)
self.escaped_strings[entities.hex_entity('00A0')] = self.nbsp
% \end{macrocode}
% \par
% \begin{markdown}
%
% Define a table \luamdef{writer->escaped_chars} containing the mapping from
% special plain \TeX{} characters (including the active pipe character (`|`)
% of \Hologo{ConTeXt}) that need to be escaped for typeset content.
% of \Hologo{ConTeXt}) that need to be escaped in typeset content.
%
% \end{markdown}
% \begin{macrocode}
Expand All @@ -20862,7 +20873,6 @@ function M.writer.new(options)
["~"] = "\\markdownRendererTilde{}",
["|"] = "\\markdownRendererPipe{}",
[entities.hex_entity('0000')] = entities.hex_entity('FFFD'),
[entities.hex_entity('00A0')] = self.nbsp,
}
% \end{macrocode}
% \par
Expand All @@ -20875,7 +20885,7 @@ function M.writer.new(options)
%
% \end{markdown}
% \begin{macrocode}
self.escape = util.escaper(self.escaped_chars, self.escaped_minimal_strings)
self.escape = util.escaper(self.escaped_chars, self.escaped_strings)
self.escape_uri = util.escaper(self.escaped_uri_chars, self.escaped_minimal_strings)
self.escape_minimal = util.escaper({}, self.escaped_minimal_strings)
% \end{macrocode}
Expand Down

0 comments on commit 522e75d

Please sign in to comment.