Skip to content

Commit

Permalink
feat(typst): make functions follow kebab-case naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowee committed Aug 12, 2024
1 parent 45fbf43 commit 1d810a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion typst/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ zhconv-typst converts Chinese text between Traditional, Simplified and regional
To use the `zhconv` plugin in your Typst project, import it as follows:

```typst
#import "@preview/zhconv:0.0.0": zhconv
#import "@preview/zhconv:0.3.1": zhconv
```

### Text Conversion
Expand Down
10 changes: 5 additions & 5 deletions typst/zhconv.typ
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#let zhconv-wasm = plugin("./zhconv_typst.wasm")

#let zhconv_str(text, target, wikitext: false) = {
let wikitext_flag = if wikitext { (1,) } else { (0,) }
str(zhconv-wasm.zhconv(bytes(text), bytes(target), bytes(wikitext_flag)))
#let zhconv-str(text, target, wikitext: false) = {
let wikitext-flag = if wikitext { (1,) } else { (0,) }
str(zhconv-wasm.zhconv(bytes(text), bytes(target), bytes(wikitext-flag)))
}

#let is_hans_str(text) = {
#let is-hans-str(text) = {
zhconv-wasm.is_hans(bytes(text)).at(0) != 0
}

#let zhconv(document, target, wikitext: false) = {
if type(document) == str {
zhconv_str(document, target, wikitext: wikitext)
zhconv-str(document, target, wikitext: wikitext)
}
else if type(document) == content and document.has("children") { // container
for child in document.children [
Expand Down

0 comments on commit 1d810a0

Please sign in to comment.