Skip to content

Commit

Permalink
chore(syntax)!: updated type checks
Browse files Browse the repository at this point in the history
From Typst 0.8.0 release notes:
> Types are now first-class values
  • Loading branch information
Andrew15-5 committed Nov 24, 2023
1 parent 4faf667 commit b452004
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to

## [Unreleased]

## [0.10.0] - 2023-11-24

### Changed

- Values are now compared with "first-class values" types instead of strings
(see [Typst 0.8.0 release notes](https://github.com/typst/typst/releases/tag/v0.8.0))
(**breaking change**).

### Added

- Added minimal Typst version to `0.8.0` (see the reason above).

## [0.9.2] - 2023-09-14

### Fixed
Expand All @@ -34,6 +46,10 @@ Now kebab case is used instead of snake case.

Initial release.

[0.10.0]: https://github.com/Andrew15-5/rubby/releases/tag/v0.10.0

[0.9.2]: https://github.com/Andrew15-5/rubby/releases/tag/v0.9.2

[0.9.1]: https://github.com/Andrew15-5/rubby/releases/tag/v0.9.1

[0.9.0]: https://github.com/Andrew15-5/rubby/releases/tag/v0.9.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Usage

```typ
#import "@preview/rubby:0.9.2": get-ruby
#import "@preview/rubby:0.10.0": get-ruby
#let ruby = get-ruby(
size: 0.5em, // Ruby font size
Expand Down
2 changes: 1 addition & 1 deletion example.typ
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
font: ("Liberation Sans", "Noto Sans CJK JP")
) // Optional

#import "@preview/rubby:0.9.2": get-ruby
#import "@preview/rubby:0.10.0": get-ruby
#let ruby = get-ruby()

```typst
Expand Down
12 changes: 6 additions & 6 deletions rubby.typ
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
)
}

let rt-array = if type(rt) == "content" {
let rt-array = if type(rt) == content {
let (inner, func) = extract-content(rt)
add-spacing-if-enabled(inner).split(delimiter).map(func)
} else if type(rt) == "string" {
} else if type(rt) == str {
add-spacing-if-enabled(rt).split(delimiter)
} else {(rt,)}
assert(type(rt-array) == "array")
assert(type(rt-array) == array)

let rb-array = if type(rb) == "content" {
let rb-array = if type(rb) == content {
let (inner, func) = extract-content(rb)
add-spacing-if-enabled(inner).split(delimiter).map(func)
} else if type(rb) == "string" {
} else if type(rb) == str {
add-spacing-if-enabled(rb).split(delimiter)
} else {(rb,)}
assert(type(rb-array) == "array")
assert(type(rb-array) == array)

if rt-array.len() != rb-array.len() {
rt-array = (rt,)
Expand Down
3 changes: 2 additions & 1 deletion typst.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "rubby"
version = "0.9.2"
version = "0.10.0"
entrypoint = "rubby.typ"
authors = ["Andrew Voynov"]
license = "AGPL-3.0-only"
description = "Add ruby (furigana) next to base text."
repository = "https://github.com/Andrew15-5/rubby"
keywords = ["ruby", "furigana", "CJK", "Chinese", "Japanese", "Korean"]
compiler = "0.8.0"
exclude = ["example.typ"]

0 comments on commit b452004

Please sign in to comment.