Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add extra characters to Typst escapes #54

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Add extra escape characters to Typst [#54](https://github.com/PumasAI/SummaryTables.jl/pull/54).

## 3.0.1 - 2024-10-24

- Added single-argument method to `table_one` which summarizes all columns in the passed table except those used for grouping [#48](https://github.com/PumasAI/SummaryTables.jl/pull/48).
Expand Down
2 changes: 1 addition & 1 deletion src/typst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function _showas(io::IO, ::MIME"text/typst", s::Subscript)
end

function _str_typst_escaped(io::IO, s::AbstractString)
escapable_special_chars = raw"\$#*_"
escapable_special_chars = raw"\$#*_<@`"
a = Iterators.Stateful(s)
for c in a
if c in escapable_special_chars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
</w:pPr>
<w:r>
<w:rPr/>
<w:t xml:space="preserve">&amp; % $ # _ { } ~ ^ \ &lt; &gt; " ' </w:t>
MichaelHatherly marked this conversation as resolved.
Show resolved Hide resolved
<w:t>&amp; % $ # _ { } ~ ^ \ &lt; &gt; " ' @ `</w:t>
</w:r>
</w:p>
</w:tc>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
\begin{threeparttable}
\begin{tabular}{@{\extracolsep{2ex}}*{1}{c}}
\toprule
\& \% \$ \# \_ \{ \} \textasciitilde{} \textasciicircum{} \textbackslash{} < > " ' \\
\& \% \$ \# \_ \{ \} \textasciitilde{} \textasciicircum{} \textbackslash{} < > " ' @ ` \\
\bottomrule
\end{tabular}
\end{threeparttable}
Expand Down
14 changes: 7 additions & 7 deletions test/references/character_escaping/problematic_characters.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<table class="st-4d26b3b4">
<table class="st-10cadcb1">
<style>
.st-4d26b3b4 {
.st-10cadcb1 {
border: none;
margin: 0 auto;
padding: 0.25rem;
Expand All @@ -9,28 +9,28 @@
line-height: 1.2em;
}

.st-4d26b3b4 tr td {
.st-10cadcb1 tr td {
vertical-align: top;
padding: 0;
border: none;
}

.st-4d26b3b4 br {
.st-10cadcb1 br {
line-height: 0em;
margin: 0;
}

.st-4d26b3b4 sub {
.st-10cadcb1 sub {
line-height: 0;
}

.st-4d26b3b4 sup {
.st-10cadcb1 sup {
line-height: 0;
}
</style>
<tr><td colspan="1" style="border-bottom: 1.5px solid black; padding: 0"></td></tr>
<tr>
<td style="text-align:center;">&amp; % $ # _ { } ~ ^ \\ &lt; &gt; &quot; &apos; </td>
<td style="text-align:center;">&amp; % $ # _ { } ~ ^ \\ &lt; &gt; &quot; &apos; @ `</td>
</tr>
<tr><td colspan="1" style="border-bottom: 1.5px solid black; padding: 0"></td></tr>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
align: (center),
stroke: none,
table.hline(y: 0, stroke: 1pt),
[& % \$ \# \_ { } ~ ^ \\ < > " ' ],
[& % \$ \# \_ { } ~ ^ \\ \< > " ' \@ \`],
table.hline(y: 1, stroke: 1pt),
)
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ end

@testset "Character escaping" begin
cells = [
SpannedCell(1, 1, "& % \$ # _ { } ~ ^ \\ < > \" ' ")
SpannedCell(1, 1, "& % \$ # _ { } ~ ^ \\ < > \" ' @ `")
]
t = Table(
cells,
Expand Down