anydoc-ruby 0.1.7 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b73a92386a7dc619a85892686d5fb139df873bd2c762be8e78c29f602261e405
4
- data.tar.gz: 694607679a045c2599469b6b499c8970aa4963134364b9aebf1904a321518f50
3
+ metadata.gz: a2086cb8f0c30c724ca64d4d5aeb00072189a51357edfb881709de9af72217cf
4
+ data.tar.gz: e35914998d4551c7d708804e6160f8b71d843cb06ec0c0ad1aced211798a4b3e
5
5
  SHA512:
6
- metadata.gz: 6fef910cd6101ca804b3e6d58b3fbcd4cb6250238349d0b0c387c57e040ed4a4d141e1f8b6814790847d7e070e01ac550547ed43b144ca4e7dc1a4b2ddc8e9ce
7
- data.tar.gz: 736c2870384cf448e7fc504e328ce835ac1b255bd6f09fff10011ba6a63b6852b544d6af9643bfa2088d15d80ae6c1c793b2019dedbbbaf3fb3864d29738e71f
6
+ metadata.gz: 66306a144c36a1bf378f98f0555de76d203c316b396ca60da5ce476d83f3ba46be47e225d276dc6295e053daba7f35572c8889a3dddc3f89515fe0bb4b1d6251
7
+ data.tar.gz: 3fd87984463be1fa6ecc379288a3b0e2f05e7768b45f7a811df0b682c5772e6826a7d3a238622db3031a9dea44dc0f0efcf83988bb579f28267f25a5bab738ae
data/README.md CHANGED
@@ -144,6 +144,18 @@ bundle exec rake gems:all # the source gem and all seven platforms
144
144
 
145
145
  Run these through Rake rather than calling `rb-sys-dock` from this directory: the container mounts the shell's working directory, and the build needs the crate one level above it, so the tasks run the CLI from the repository root with `--directory ruby`. The first build of each platform pulls a multi-gigabyte image.
146
146
 
147
+ ### Releasing
148
+
149
+ The gem version tracks the version of the crate it wraps, so a release starts from a crate version bump:
150
+
151
+ 1. Bump `lib/anydoc/version.rb` and the `anydoc` dependency in `ext/anydoc/Cargo.toml` to the crate's version.
152
+ 2. `sh scripts/check-versions.sh` from the repository root, which fails unless all seven version locations agree.
153
+ 3. Tag `ruby-v<version>` and push it.
154
+
155
+ The tag runs [`.github/workflows/release-ruby.yml`](../.github/workflows/release-ruby.yml), which cross-compiles every platform gem, installs and tests each one, pushes them through RubyGems trusted publishing, and attaches them to a GitHub release. A `workflow_dispatch` run does everything except publish.
156
+
157
+ Because the versions are locked together, a fix that touches only the bindings waits for the next crate release. Shipping one sooner means relaxing the version gate for that release.
158
+
147
159
  ## License
148
160
 
149
161
  [MIT](https://github.com/honzasterba/anydoc/blob/main/LICENSE)
@@ -16,7 +16,7 @@ crate-type = ["cdylib"]
16
16
  # From crates.io, so an installed source gem builds anywhere. Builds inside
17
17
  # this repository redirect it to the local crate through ruby/.cargo/config.toml,
18
18
  # and scripts/check-versions.sh keeps this requirement on the release version.
19
- anydoc = "0.1.7"
19
+ anydoc = "0.2.3"
20
20
  magnus = "0.8"
21
21
  # For rb_thread_call_without_gvl; magnus resolves to the same major version.
22
22
  rb-sys = "0.9"
@@ -95,6 +95,7 @@ impl Build<'_> {
95
95
  BlockFields { lang, text: Some(text), ..BlockFields::of("code_block") }
96
96
  }
97
97
  model::Block::Rule => BlockFields::of("rule"),
98
+ model::Block::Math(tex) => BlockFields { text: Some(tex), ..BlockFields::of("math") },
98
99
  };
99
100
  self.classes.block.funcall(
100
101
  "new",
@@ -136,6 +137,12 @@ impl Build<'_> {
136
137
  InlineFields { note_id: Some(id), ..InlineFields::of("note_ref") }
137
138
  }
138
139
  model::Inline::LineBreak => InlineFields::of("line_break"),
140
+ model::Inline::Math(tex) => {
141
+ InlineFields { text: Some(tex), ..InlineFields::of("math") }
142
+ }
143
+ model::Inline::Checkbox(checked) => {
144
+ InlineFields { checked: Some(checked), ..InlineFields::of("checkbox") }
145
+ }
139
146
  };
140
147
  self.classes.inline.funcall(
141
148
  "new",
@@ -149,6 +156,7 @@ impl Build<'_> {
149
156
  fields.source,
150
157
  fields.anchor,
151
158
  fields.note_id,
159
+ fields.checked,
152
160
  ),
153
161
  )
154
162
  }
@@ -190,7 +198,7 @@ impl Build<'_> {
190
198
 
191
199
  fn list_item(&self, item: model::ListItem) -> Result<Value, Error> {
192
200
  let blocks = self.array(item.blocks, Self::block)?;
193
- self.classes.list_item.funcall("new", (blocks, item.checked, item.marker_label))
201
+ self.classes.list_item.funcall("new", (blocks, item.marker_label))
194
202
  }
195
203
 
196
204
  fn table(&self, table: model::Table) -> Result<Value, Error> {
@@ -291,6 +299,7 @@ struct InlineFields {
291
299
  source: Option<Value>,
292
300
  anchor: Option<String>,
293
301
  note_id: Option<String>,
302
+ checked: Option<bool>,
294
303
  }
295
304
 
296
305
  impl InlineFields {
@@ -305,6 +314,7 @@ impl InlineFields {
305
314
  source: None,
306
315
  anchor: None,
307
316
  note_id: None,
317
+ checked: None,
308
318
  }
309
319
  }
310
320
  }
@@ -32,7 +32,7 @@ module Anydoc
32
32
  #
33
33
  # @!attribute [r] kind
34
34
  # @return [Symbol] +:heading+, +:paragraph+, +:list+, +:table+,
35
- # +:block_quote+, +:code_block+, or +:rule+.
35
+ # +:block_quote+, +:code_block+, +:rule+, or +:math+.
36
36
  # @!attribute [r] level
37
37
  # @return [Integer, nil] heading: 1-6.
38
38
  # @!attribute [r] anchor
@@ -49,7 +49,8 @@ module Anydoc
49
49
  # @!attribute [r] lang
50
50
  # @return [String, nil] code_block.
51
51
  # @!attribute [r] text
52
- # @return [String, nil] code_block.
52
+ # @return [String, nil] code_block, math (LaTeX source without
53
+ # delimiters).
53
54
  class Block < Data.define(
54
55
  :kind, :level, :anchor, :content, :list, :table, :blocks, :lang, :text
55
56
  )
@@ -59,10 +60,10 @@ module Anydoc
59
60
  #
60
61
  # @!attribute [r] kind
61
62
  # @return [Symbol] +:text+, +:link+, +:image+, +:anchor+ (a zero-width
62
- # marker for an internal link target at this position), +:note_ref+, or
63
- # +:line_break+.
63
+ # marker for an internal link target at this position), +:note_ref+,
64
+ # +:line_break+, +:math+, or +:checkbox+.
64
65
  # @!attribute [r] text
65
- # @return [String, nil] text.
66
+ # @return [String, nil] text; math (LaTeX source without delimiters).
66
67
  # @!attribute [r] style
67
68
  # @return [Style, nil] text.
68
69
  # @!attribute [r] content
@@ -78,8 +79,11 @@ module Anydoc
78
79
  # @!attribute [r] note_id
79
80
  # @return [String, nil] note_ref: the id of the note in
80
81
  # {Document#notes}.
82
+ # @!attribute [r] checked
83
+ # @return [Boolean, nil] checkbox: its state.
81
84
  class Inline < Data.define(
82
- :kind, :text, :style, :content, :target, :alt, :source, :anchor, :note_id
85
+ :kind, :text, :style, :content, :target, :alt, :source, :anchor, :note_id,
86
+ :checked
83
87
  )
84
88
  end
85
89
 
@@ -141,14 +145,11 @@ module Anydoc
141
145
  #
142
146
  # @!attribute [r] blocks
143
147
  # @return [Array<Block>]
144
- # @!attribute [r] checked
145
- # @return [Boolean, nil] task-list state, when the item carries a
146
- # checkbox.
147
148
  # @!attribute [r] marker_label
148
149
  # @return [String, nil] literal marker text that overrides the list marker
149
150
  # when the source number text cannot be reproduced from the marker and
150
151
  # position alone (composite number text such as +1-a)+).
151
- class ListItem < Data.define(:blocks, :checked, :marker_label)
152
+ class ListItem < Data.define(:blocks, :marker_label)
152
153
  end
153
154
 
154
155
  # A table as a canonical grid: every logical grid position appears exactly
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Anydoc
4
4
  # The gem version, which is the version of the anydoc crate it wraps.
5
- VERSION = "0.1.7"
5
+ VERSION = "0.2.3"
6
6
  end
data/sig/anydoc.rbs CHANGED
@@ -61,7 +61,7 @@ module Anydoc
61
61
  end
62
62
 
63
63
  class Block < ::Data
64
- # :heading | :paragraph | :list | :table | :block_quote | :code_block | :rule
64
+ # :heading | :paragraph | :list | :table | :block_quote | :code_block | :rule | :math
65
65
  attr_reader kind: Symbol
66
66
  attr_reader level: Integer?
67
67
  attr_reader anchor: String?
@@ -74,7 +74,7 @@ module Anydoc
74
74
  end
75
75
 
76
76
  class Inline < ::Data
77
- # :text | :link | :image | :anchor | :note_ref | :line_break
77
+ # :text | :link | :image | :anchor | :note_ref | :line_break | :math | :checkbox
78
78
  attr_reader kind: Symbol
79
79
  attr_reader text: String?
80
80
  attr_reader style: Style?
@@ -84,6 +84,7 @@ module Anydoc
84
84
  attr_reader source: ImageSource?
85
85
  attr_reader anchor: String?
86
86
  attr_reader note_id: String?
87
+ attr_reader checked: bool?
87
88
  end
88
89
 
89
90
  class Style < ::Data
@@ -122,7 +123,6 @@ module Anydoc
122
123
 
123
124
  class ListItem < ::Data
124
125
  attr_reader blocks: Array[Block]
125
- attr_reader checked: bool?
126
126
  attr_reader marker_label: String?
127
127
  end
128
128
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anydoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Sterba
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 4.0.17
74
+ rubygems_version: 3.6.9
75
75
  specification_version: 4
76
76
  summary: Convert documents (doc, docx, odt, rtf, epub, pdf, presentations, spreadsheets,
77
77
  csv) to GitHub-Flavored Markdown