diff --git a/Makefile.am b/Makefile.am index 3da4d65..ddd401b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -85,6 +85,8 @@ sile/readme_%.sil: sile/README.md $(CODEBLOCK_FILTER) TYPSTASSETS = typst/decasify.wasm typst/readme_1.svg typst/readme_2.svg typst/LICENSE +TYPST_EXPECTATIONS = tests/styled.html + .PHONY: typst-universe typst-universe: $(TYPSTASSETS) @@ -111,8 +113,13 @@ typst/decasify.wasm: typst/src/lib.rs $(TYPST) compile -f svg $< $@ $(SVGO) --multipass --precision 2 --pretty --indent 2 $@ +%.html: %.typ typst-universe + $(TYPST) compile --root $(top_srcdir) --features html --format html $< + SILEASSETS = sile/readme_1.svg sile/readme_2.svg +SILE_EXPECTATIONS = tests/styled.txt + .PHONY: sile-docs sile-docs: $(SILEASSETS) @@ -122,16 +129,24 @@ sile-docs: $(SILEASSETS) %.pdf: %.sil cp $< target/ cd target - $(SILE) $(' $@ -check: busted pytest +%.txt: %.sil sile-docs + cp $< target/ + cd target + $(SILE) -b debug -o ../$@ $( + + + + + + + + + + + +
Sourcethis sample has bold and italic underlined bits.
+

Sentencecase

+ + + + + + + + + +
ActualThis sample has bold and italic underlined bits.
ExpectedThis sample has bold and italic underlined bits.
+

Titlecase

+ + + + + + + + + +
ActualThis Sample Has Bold and Italic Underlined Bits.
ExpectedThis Sample Has Bold and Italic Underlined Bits.
+ + diff --git a/tests/styled.sil b/tests/styled.sil new file mode 100644 index 0000000..b5c5047 --- /dev/null +++ b/tests/styled.sil @@ -0,0 +1,18 @@ +\begin{document} +\nofolios +\neverindent +\language[main=en] +\use[module=packages.rules] +\use[module=packages.decasify] +\define[command=sample]{this sample \strong{has bold} and \em{italic \underline{underlined}} bits.} +\define[command=group]{\bigskip\font[size=16pt,weight=800]{\process}\par} + +\sample + +\group{Sentencecase} +\decasify[case=sentence]{this sample \strong{has bold} and \em{italic \underline{underlined}} bits.} + +\group{Titlecase} +\decasify[case=title]{this sample \strong{has bold} and \em{italic \underline{underlined}} bits.} + +\end{document} diff --git a/tests/styled.typ b/tests/styled.typ new file mode 100644 index 0000000..1780347 --- /dev/null +++ b/tests/styled.typ @@ -0,0 +1,23 @@ +#import "../typst/decasify.typ": sentencecase, titlecase + +#set text(lang: "en") + +#let sample = [this sample *has bold* and _italic #underline[underlined]_ bits.] + +#table(columns: (2cm, 9cm))[Source][#sample] + += Sentencecase + +#table(columns: (2cm, 9cm))[Actual][ + #sentencecase[#sample] +][Expected][ + This sample *has bold* and _italic #underline[underlined]_ bits. +] + += Titlecase + +#table(columns: (2cm, 9cm))[Actual][ + #titlecase[#sample] +][Expected][ + This Sample *Has Bold* and _Italic #underline[Underlined]_ Bits. +]