Skip to content

Commit

Permalink
Issue #646: typst no stroke + escape
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Aug 15, 2023
1 parent f1a1a53 commit 8ab4e27
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/factory_typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ typstable <- function(
} else {
cn <- NULL
}
cn <- gsub("\\*", "\\\\*", cn)
cn <- gsub("\\#", "\\\\#", cn)

# escape asterisks, which have a special delimiter meaning in Typst
for (i in seq_along(x)) {
x[[i]] <- gsub("\\*", "\\\\*", x[[i]])
x[[i]] <- gsub("\\#", "\\\\#", x[[i]])
}


# cells
tab <- data.frame(apply(x, 1:2, function(z) sprintf("[%s]", z)))
Expand All @@ -79,6 +88,7 @@ typstable <- function(
inset: %s,
columns: %s,
align: %s,
stroke: none,
%s
)",
inset, columns, align, tab)
Expand Down

0 comments on commit 8ab4e27

Please sign in to comment.