Skip to content

Commit

Permalink
typst lines work
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Oct 26, 2024
1 parent ce44396 commit d03e029
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions R/style_typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,19 @@ style_apply_typst <- function(x) {
}

vlines <- function(x) {
j <- sort(x$i)
idx <- split_chunks(x$i)
color <- if (is.na(x$line_color[1])) "black" else x$line_color[1]
width <- if (is.na(x$line_width[1])) 0.1 else x$line_width[1]
width <- sprintf("%sem", width)
out <- ""
if (grepl("l", x$line[1])) {
tmp <- "table.vline(x: %s, start: %s, end: %s, stroke: %s + %s),"
tmp <- sprintf(tmp, x$i[1], idx$min, idx$max, width, color)
tmp <- sprintf(tmp, x$j[1], idx$min, idx$max, width, color)
out <- paste(out, tmp)
}
if (grepl("r", x$line[1])) {
tmp <- "table.hline(y: %s, start: %s, end: %s, stroke: %s + %s),"
tmp <- sprintf(tmp, x$i[1] + 1, idx$min, idx$max, width, color)
tmp <- "table.vline(x: %s, start: %s, end: %s, stroke: %s + %s),"
tmp <- sprintf(tmp, x$j[1] + 1, idx$min, idx$max, width, color)
out <- paste(out, tmp)
}
return(out)
Expand Down

0 comments on commit d03e029

Please sign in to comment.