anydoc-ruby 0.1.8 → 0.2.4
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 +4 -4
- data/ext/anydoc/Cargo.toml +1 -1
- data/ext/anydoc/src/document.rs +11 -1
- data/lib/anydoc/document.rb +11 -10
- data/lib/anydoc/version.rb +1 -1
- data/sig/anydoc.rbs +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44577cdca647638842074953974e1d7fdc3bd2fa4c4989c0488169bd3999de1c
|
|
4
|
+
data.tar.gz: 3dc7624de9e706fe36973afa040053746a3a1ab4ed36d70978de918f760ea484
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a0faaed4eb6f4693b36d9670c93008efd6d84371a51f429bc32113c7982e7a99ec8fc4dc996f8bcc3ed823320c42bbab1f10dfb388c8eacea65c63ad8e279ce
|
|
7
|
+
data.tar.gz: 7df597e86d14f00b70e3d17d4eaea305a9ea4a779bbadf3dd98eaadc4bfc640bf01743056df677a5c68bcc1d9cb1bdf79c0369d2bc3ece07a8972e0cdf96d7d7
|
data/ext/anydoc/Cargo.toml
CHANGED
|
@@ -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.
|
|
19
|
+
anydoc = "0.2.4"
|
|
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"
|
data/ext/anydoc/src/document.rs
CHANGED
|
@@ -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.
|
|
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
|
}
|
data/lib/anydoc/document.rb
CHANGED
|
@@ -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 +:
|
|
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+,
|
|
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, :
|
|
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
|
data/lib/anydoc/version.rb
CHANGED
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
|
|