diff --git a/R/style_notes.R b/R/style_notes.R
index d5387576..a338d494 100644
--- a/R/style_notes.R
+++ b/R/style_notes.R
@@ -18,12 +18,7 @@ setMethod(
signature = "tinytable_bootstrap",
definition = function(x, ...) {
styles <- x@style_notes
- if (isTRUE(styles[["italic"]])) {
- x@notes <- lapply(x@notes, function(n) sprintf("%s", n))
- }
- if (isTRUE(styles[["bold"]])) {
- x@notes <- lapply(x@notes, function(n) sprintf("%s", n))
- }
+ x@notes <- lapply(x@notes, style_string_html, styles)
return(x)
})
@@ -34,12 +29,7 @@ setMethod(
signature = "tinytable_tabularray",
definition = function(x, ...) {
styles <- x@style_notes
- if (isTRUE(styles[["italic"]])) {
- x@notes <- lapply(x@notes, function(n) sprintf("\\emph{%s}", n))
- }
- if (isTRUE(styles[["bold"]])) {
- x@notes <- lapply(x@notes, function(n) sprintf("\\textbf{%s}", n))
- }
+ x@notes <- lapply(x@notes, style_string_html, styles)
return(x)
})
@@ -69,3 +59,30 @@ setMethod(
return(x)
})
+
+
+
+style_string_html <- function(n, styles) {
+ if (isTRUE(styles[["italic"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["strikeout"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["underline"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["bold"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["monospace"]])) {
+ n <- sprintf("%s
", n)
+ }
+ if (!is.null(styles[["color"]])) {
+ n <- sprintf("%s", styles[["color"]], n)
+ }
+ if (!is.null(styles[["fontsize"]])) {
+ n <- sprintf("%s", styles[["fontsize"]], n)
+ }
+ n
+}
diff --git a/R/style_string.R b/R/style_string.R
new file mode 100644
index 00000000..61bef358
--- /dev/null
+++ b/R/style_string.R
@@ -0,0 +1,50 @@
+style_string_html <- function(n, styles) {
+ if (isTRUE(styles[["italic"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["strikeout"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["underline"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["bold"]])) {
+ n <- sprintf("%s", n)
+ }
+ if (isTRUE(styles[["monospace"]])) {
+ n <- sprintf("%s
", n)
+ }
+ if (!is.null(styles[["color"]])) {
+ n <- sprintf("%s", styles[["color"]], n)
+ }
+ if (!is.null(styles[["fontsize"]])) {
+ n <- sprintf("%s", styles[["fontsize"]], n)
+ }
+ n
+}
+
+
+style_string_latex <- function(n, styles) {
+ if (isTRUE(styles[["italic"]])) {
+ n <- sprintf("\\textit{%s}", n)
+ }
+ if (isTRUE(styles[["strikeout"]])) {
+ n <- sprintf("\\sout{%s}", n)
+ }
+ if (isTRUE(styles[["underline"]])) {
+ n <- sprintf("\\underline{%s}", n)
+ }
+ if (isTRUE(styles[["bold"]])) {
+ n <- sprintf("\\textbf{%s}", n)
+ }
+ if (isTRUE(styles[["monospace"]])) {
+ n <- sprintf("\\texttt{%s}", n)
+ }
+ if (!is.null(styles[["color"]])) {
+ n <- sprintf("\\textcolor{%s}{%s}", styles[["color"]], n)
+ }
+ if (!is.null(styles[["fontsize"]])) {
+ n <- sprintf("{\\fontsize{%s}{%s}\\selectfont %s}", styles[["fontsize"]], styles[["fontsize"]], n)
+ }
+ n
+}
diff --git a/R/style_tt.R b/R/style_tt.R
index 69c8784b..4c47d88a 100644
--- a/R/style_tt.R
+++ b/R/style_tt.R
@@ -160,8 +160,12 @@ style_tt <- function(x,
if (identical(i, "notes")) {
out@style_notes <- list(
+ color = color,
+ fontsize = fontsize,
italic = italic,
- bold = bold
+ monospace = monospace,
+ strikeout = strikeout,
+ underline = underline
)
return(out)
}