diff --git a/tests/docs/smoke-all/typst/gt-islands.qmd b/tests/docs/smoke-all/typst/gt-islands.qmd new file mode 100644 index 00000000000..1135ad87154 --- /dev/null +++ b/tests/docs/smoke-all/typst/gt-islands.qmd @@ -0,0 +1,51 @@ +--- +title: "gt - Islands" +format: + typst: + quality: 1 + keep-typ: true + html: + quality: 1 + format-links: false +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - ['#set text\(size: 1.25em , fill: rgb\("#333333"\)\); Large Landmasses of the World'] + - [] +--- + +```{r} +library(gt) +library(dplyr) + +islands_tbl <- + tibble( + name = names(islands), + size = islands + ) |> + arrange(desc(size)) |> + slice(1:10) + +gt_tbl <- gt(islands_tbl) + +gt_tbl <- + gt_tbl |> + tab_header( + title = "Large Landmasses of the World", + subtitle = "The top ten largest are presented" + ) + +gt_tbl <- + gt_tbl |> + tab_source_note( + source_note = "Source: The World Almanac and Book of Facts, 1975, page 406." + ) |> + tab_source_note( + source_note = md("Reference: McNeil, D. R. (1977) *Interactive Data Analysis*. Wiley.") + ) + +# Show the gt table +gt_tbl + +``` \ No newline at end of file diff --git a/tests/docs/smoke-all/typst/pandas-cell-css-rules.qmd b/tests/docs/smoke-all/typst/pandas-cell-css-rules.qmd new file mode 100644 index 00000000000..ccf52d08534 --- /dev/null +++ b/tests/docs/smoke-all/typst/pandas-cell-css-rules.qmd @@ -0,0 +1,45 @@ +--- +title: "Pandas - Acting on Data" +format: + typst: + quality: 1 + keep-typ: true + html: + quality: 1 + format-links: false +references: + - type: website + id: pandas-user-guide + url: https://pandas.pydata.org/pandas-docs/version/2.2.2/user_guide/style.html#Acting-on-the-Index-and-Column-Headers +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - [ + 'table.cell\(fill: rgb\("#ffc0cb"\)\)\[#set text\(fill: white\); 1.867558\]', + '\[#set text\(fill: rgb\("#ff413633"\)\); -0.151357\]' + ] + - [] +--- + +```{python} +import pandas as pd +import numpy as np + +np.random.seed(0) +df2 = pd.DataFrame(np.random.randn(10,4), columns=['A','B','C','D']) + +def style_negative(v, props=''): + return props if v < 0 else None +s2 = df2.style.map(style_negative, props='color:red;')\ + .map(lambda v: 'opacity: 20%;' if (v < 0.3) and (v > -0.3) else None) + +def highlight_max(s, props=''): + return np.where(s == np.nanmax(s.values), props, '') + +# darkblue, pink +s2.apply(highlight_max, props='color:white;background-color:#00008b', axis=0)\ +.apply(highlight_max, props='color:white;background-color: #ffc0cb;', axis=1)\ +.apply(highlight_max, props='color:white;background-color:purple', axis=None) + +``` \ No newline at end of file diff --git a/tests/docs/smoke-all/typst/tbl-align/issue10086.qmd b/tests/docs/smoke-all/typst/tbl-align-issue10086.qmd similarity index 100% rename from tests/docs/smoke-all/typst/tbl-align/issue10086.qmd rename to tests/docs/smoke-all/typst/tbl-align-issue10086.qmd