djotter 0.1.0
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 +7 -0
- data/Cargo.lock +361 -0
- data/Cargo.toml +3 -0
- data/README.md +70 -0
- data/ext/djotter/Cargo.toml +13 -0
- data/ext/djotter/extconf.rb +6 -0
- data/ext/djotter/src/lib.rs +15 -0
- data/lib/djotter/version.rb +5 -0
- data/lib/djotter.rb +20 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 433ef073aa3e066d58351e2c5fac853597b0f47cdf9694c2c07c70b4ced2a223
|
4
|
+
data.tar.gz: 7ca2e23aa9ca5b8d3d3a2f4ea086efbb11e07d85f1cf53b12a7e7fc8f59734ef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67201e66f491e89a9c23ef094481bef27713488f1bee45d261f423a1c4f205437df4e7c0be81975b788f6f66d1cef8326123bf4235b86516b414f995a9a88f57
|
7
|
+
data.tar.gz: e763d61f1dbbbe13a847302183bd7dc6c37586140fd24ca537cea788989f9bd4b94e0c8c1013c6ea907e5f0854c19e855ec07c89685e4a2f38f703cca1862e28
|
data/Cargo.lock
ADDED
@@ -0,0 +1,361 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 4
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "aho-corasick"
|
7
|
+
version = "1.1.3"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
10
|
+
dependencies = [
|
11
|
+
"memchr",
|
12
|
+
]
|
13
|
+
|
14
|
+
[[package]]
|
15
|
+
name = "bindgen"
|
16
|
+
version = "0.69.5"
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
18
|
+
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
19
|
+
dependencies = [
|
20
|
+
"bitflags",
|
21
|
+
"cexpr",
|
22
|
+
"clang-sys",
|
23
|
+
"itertools",
|
24
|
+
"lazy_static",
|
25
|
+
"lazycell",
|
26
|
+
"proc-macro2",
|
27
|
+
"quote",
|
28
|
+
"regex",
|
29
|
+
"rustc-hash",
|
30
|
+
"shlex",
|
31
|
+
"syn",
|
32
|
+
]
|
33
|
+
|
34
|
+
[[package]]
|
35
|
+
name = "bitflags"
|
36
|
+
version = "2.9.1"
|
37
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
38
|
+
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
39
|
+
|
40
|
+
[[package]]
|
41
|
+
name = "cexpr"
|
42
|
+
version = "0.6.0"
|
43
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
44
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
45
|
+
dependencies = [
|
46
|
+
"nom",
|
47
|
+
]
|
48
|
+
|
49
|
+
[[package]]
|
50
|
+
name = "cfg-if"
|
51
|
+
version = "1.0.1"
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
53
|
+
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
54
|
+
|
55
|
+
[[package]]
|
56
|
+
name = "clang-sys"
|
57
|
+
version = "1.8.1"
|
58
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
59
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
60
|
+
dependencies = [
|
61
|
+
"glob",
|
62
|
+
"libc",
|
63
|
+
"libloading",
|
64
|
+
]
|
65
|
+
|
66
|
+
[[package]]
|
67
|
+
name = "djotter"
|
68
|
+
version = "0.1.0"
|
69
|
+
dependencies = [
|
70
|
+
"jotdown",
|
71
|
+
"magnus",
|
72
|
+
]
|
73
|
+
|
74
|
+
[[package]]
|
75
|
+
name = "either"
|
76
|
+
version = "1.15.0"
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
78
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
79
|
+
|
80
|
+
[[package]]
|
81
|
+
name = "glob"
|
82
|
+
version = "0.3.2"
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
84
|
+
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
85
|
+
|
86
|
+
[[package]]
|
87
|
+
name = "itertools"
|
88
|
+
version = "0.12.1"
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
90
|
+
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
91
|
+
dependencies = [
|
92
|
+
"either",
|
93
|
+
]
|
94
|
+
|
95
|
+
[[package]]
|
96
|
+
name = "jotdown"
|
97
|
+
version = "0.8.0"
|
98
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
99
|
+
checksum = "c519aad5c5d1057c0c5e71370c6c61ec997af47597d66c4bd7c3dbd5543aef65"
|
100
|
+
|
101
|
+
[[package]]
|
102
|
+
name = "lazy_static"
|
103
|
+
version = "1.5.0"
|
104
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
105
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
106
|
+
|
107
|
+
[[package]]
|
108
|
+
name = "lazycell"
|
109
|
+
version = "1.3.0"
|
110
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
111
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
112
|
+
|
113
|
+
[[package]]
|
114
|
+
name = "libc"
|
115
|
+
version = "0.2.174"
|
116
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
117
|
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
118
|
+
|
119
|
+
[[package]]
|
120
|
+
name = "libloading"
|
121
|
+
version = "0.8.8"
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
123
|
+
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
|
124
|
+
dependencies = [
|
125
|
+
"cfg-if",
|
126
|
+
"windows-targets",
|
127
|
+
]
|
128
|
+
|
129
|
+
[[package]]
|
130
|
+
name = "magnus"
|
131
|
+
version = "0.6.4"
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
133
|
+
checksum = "b1597ef40aa8c36be098249e82c9a20cf7199278ac1c1a1a995eeead6a184479"
|
134
|
+
dependencies = [
|
135
|
+
"magnus-macros",
|
136
|
+
"rb-sys",
|
137
|
+
"rb-sys-env",
|
138
|
+
"seq-macro",
|
139
|
+
]
|
140
|
+
|
141
|
+
[[package]]
|
142
|
+
name = "magnus-macros"
|
143
|
+
version = "0.6.0"
|
144
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
145
|
+
checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
|
146
|
+
dependencies = [
|
147
|
+
"proc-macro2",
|
148
|
+
"quote",
|
149
|
+
"syn",
|
150
|
+
]
|
151
|
+
|
152
|
+
[[package]]
|
153
|
+
name = "memchr"
|
154
|
+
version = "2.7.5"
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
156
|
+
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
157
|
+
|
158
|
+
[[package]]
|
159
|
+
name = "minimal-lexical"
|
160
|
+
version = "0.2.1"
|
161
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
162
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
163
|
+
|
164
|
+
[[package]]
|
165
|
+
name = "nom"
|
166
|
+
version = "7.1.3"
|
167
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
168
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
169
|
+
dependencies = [
|
170
|
+
"memchr",
|
171
|
+
"minimal-lexical",
|
172
|
+
]
|
173
|
+
|
174
|
+
[[package]]
|
175
|
+
name = "proc-macro2"
|
176
|
+
version = "1.0.95"
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
178
|
+
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
179
|
+
dependencies = [
|
180
|
+
"unicode-ident",
|
181
|
+
]
|
182
|
+
|
183
|
+
[[package]]
|
184
|
+
name = "quote"
|
185
|
+
version = "1.0.40"
|
186
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
187
|
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
188
|
+
dependencies = [
|
189
|
+
"proc-macro2",
|
190
|
+
]
|
191
|
+
|
192
|
+
[[package]]
|
193
|
+
name = "rb-sys"
|
194
|
+
version = "0.9.117"
|
195
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
196
|
+
checksum = "f900d1ce4629a2ebffaf5de74bd8f9c1188d4c5ed406df02f97e22f77a006f44"
|
197
|
+
dependencies = [
|
198
|
+
"rb-sys-build",
|
199
|
+
]
|
200
|
+
|
201
|
+
[[package]]
|
202
|
+
name = "rb-sys-build"
|
203
|
+
version = "0.9.117"
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
205
|
+
checksum = "ef1e9c857028f631056bcd6d88cec390c751e343ce2223ddb26d23eb4a151d59"
|
206
|
+
dependencies = [
|
207
|
+
"bindgen",
|
208
|
+
"lazy_static",
|
209
|
+
"proc-macro2",
|
210
|
+
"quote",
|
211
|
+
"regex",
|
212
|
+
"shell-words",
|
213
|
+
"syn",
|
214
|
+
]
|
215
|
+
|
216
|
+
[[package]]
|
217
|
+
name = "rb-sys-env"
|
218
|
+
version = "0.1.2"
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
220
|
+
checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
221
|
+
|
222
|
+
[[package]]
|
223
|
+
name = "regex"
|
224
|
+
version = "1.11.1"
|
225
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
226
|
+
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
227
|
+
dependencies = [
|
228
|
+
"aho-corasick",
|
229
|
+
"memchr",
|
230
|
+
"regex-automata",
|
231
|
+
"regex-syntax",
|
232
|
+
]
|
233
|
+
|
234
|
+
[[package]]
|
235
|
+
name = "regex-automata"
|
236
|
+
version = "0.4.9"
|
237
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
238
|
+
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
239
|
+
dependencies = [
|
240
|
+
"aho-corasick",
|
241
|
+
"memchr",
|
242
|
+
"regex-syntax",
|
243
|
+
]
|
244
|
+
|
245
|
+
[[package]]
|
246
|
+
name = "regex-syntax"
|
247
|
+
version = "0.8.5"
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
249
|
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
250
|
+
|
251
|
+
[[package]]
|
252
|
+
name = "rustc-hash"
|
253
|
+
version = "1.1.0"
|
254
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
255
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
256
|
+
|
257
|
+
[[package]]
|
258
|
+
name = "seq-macro"
|
259
|
+
version = "0.3.6"
|
260
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
261
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
262
|
+
|
263
|
+
[[package]]
|
264
|
+
name = "shell-words"
|
265
|
+
version = "1.1.0"
|
266
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
267
|
+
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
268
|
+
|
269
|
+
[[package]]
|
270
|
+
name = "shlex"
|
271
|
+
version = "1.3.0"
|
272
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
273
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
274
|
+
|
275
|
+
[[package]]
|
276
|
+
name = "syn"
|
277
|
+
version = "2.0.104"
|
278
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
279
|
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
280
|
+
dependencies = [
|
281
|
+
"proc-macro2",
|
282
|
+
"quote",
|
283
|
+
"unicode-ident",
|
284
|
+
]
|
285
|
+
|
286
|
+
[[package]]
|
287
|
+
name = "unicode-ident"
|
288
|
+
version = "1.0.18"
|
289
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
290
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
291
|
+
|
292
|
+
[[package]]
|
293
|
+
name = "windows-link"
|
294
|
+
version = "0.1.3"
|
295
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
296
|
+
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
297
|
+
|
298
|
+
[[package]]
|
299
|
+
name = "windows-targets"
|
300
|
+
version = "0.53.3"
|
301
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
302
|
+
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
|
303
|
+
dependencies = [
|
304
|
+
"windows-link",
|
305
|
+
"windows_aarch64_gnullvm",
|
306
|
+
"windows_aarch64_msvc",
|
307
|
+
"windows_i686_gnu",
|
308
|
+
"windows_i686_gnullvm",
|
309
|
+
"windows_i686_msvc",
|
310
|
+
"windows_x86_64_gnu",
|
311
|
+
"windows_x86_64_gnullvm",
|
312
|
+
"windows_x86_64_msvc",
|
313
|
+
]
|
314
|
+
|
315
|
+
[[package]]
|
316
|
+
name = "windows_aarch64_gnullvm"
|
317
|
+
version = "0.53.0"
|
318
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
319
|
+
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
320
|
+
|
321
|
+
[[package]]
|
322
|
+
name = "windows_aarch64_msvc"
|
323
|
+
version = "0.53.0"
|
324
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
325
|
+
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
326
|
+
|
327
|
+
[[package]]
|
328
|
+
name = "windows_i686_gnu"
|
329
|
+
version = "0.53.0"
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
331
|
+
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
332
|
+
|
333
|
+
[[package]]
|
334
|
+
name = "windows_i686_gnullvm"
|
335
|
+
version = "0.53.0"
|
336
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
337
|
+
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
338
|
+
|
339
|
+
[[package]]
|
340
|
+
name = "windows_i686_msvc"
|
341
|
+
version = "0.53.0"
|
342
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
343
|
+
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
344
|
+
|
345
|
+
[[package]]
|
346
|
+
name = "windows_x86_64_gnu"
|
347
|
+
version = "0.53.0"
|
348
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
349
|
+
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
350
|
+
|
351
|
+
[[package]]
|
352
|
+
name = "windows_x86_64_gnullvm"
|
353
|
+
version = "0.53.0"
|
354
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
355
|
+
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
356
|
+
|
357
|
+
[[package]]
|
358
|
+
name = "windows_x86_64_msvc"
|
359
|
+
version = "0.53.0"
|
360
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
361
|
+
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
data/Cargo.toml
ADDED
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Djotter
|
2
|
+
|
3
|
+
Ruby wrapper for Rust's [jotdown][djot-rs] crate.
|
4
|
+
|
5
|
+
Initially, djotter is designed to strictly generate HTML from a Djot document. The gem does not support features such as manipulating the AST generated by the underlying parser and the conversion of such intermediate representation to construct any type of output format other than HTML.
|
6
|
+
|
7
|
+
> [!NOTE]
|
8
|
+
> Even though `jotdown` aims to be feature complete and match the [reference implementation][djot-js], some edge cases are not yet dealt with. Since this wrapper mirrors the crate behavior, it is important to draw attention to that.
|
9
|
+
>
|
10
|
+
> For more information, see [the documentation below](#correctness)
|
11
|
+
|
12
|
+
[djot-rs]: https://github.com/hellux/jotdown
|
13
|
+
[djot-js]: https://github.com/jgm/djot.js
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'djotter'
|
20
|
+
|
21
|
+
and then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install djotter
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
This gem expects to receive UTF-8 strings. Ensure your strings are the right encoding before passing them into `Djotter`.
|
32
|
+
|
33
|
+
### Converting to HTML
|
34
|
+
|
35
|
+
Call `to_html` on a string to convert it to HTML:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
require 'djotter'
|
39
|
+
|
40
|
+
puts Djotter.to_html('a *b{#id key="*"}*')
|
41
|
+
|
42
|
+
# <p>a <strong><span id="id" key="*">b</span></strong></p>
|
43
|
+
```
|
44
|
+
|
45
|
+
### Correctness
|
46
|
+
|
47
|
+
Even though the underlying implementation supports all the current features of the Djot syntax, the authors explicitly state that:
|
48
|
+
|
49
|
+
> The HTML output is in some cases not exactly identical to the reference implementation.
|
50
|
+
|
51
|
+
Taking that into consideration, the test cases against which the crate is submitted to are not as exhaustive as the [JavaScript][djot-js] and [Lua][djot-lua] versions. To address that, all the `.test` files from those parsers were [added][test-cases] to this wrapper for an extra layer of inspection. With that said, not all cases matched exactly the expected output, some just because of formatting shenanigans and others due to not completely handling edge cases. The exact cases where that happened were edited out.
|
52
|
+
|
53
|
+
Some of those are actually pointed out by the crate author, such as [issue #51][issue-51].
|
54
|
+
|
55
|
+
[djot-lua]: https://github.com/jgm/djot.lua
|
56
|
+
[test-cases]: ./spec/cases/
|
57
|
+
[issue-51]: https://github.com/hellux/jotdown/issues/51
|
58
|
+
|
59
|
+
## Development
|
60
|
+
|
61
|
+
After cloning the repo:
|
62
|
+
|
63
|
+
$ bundle install
|
64
|
+
$ bundle exec rake compile
|
65
|
+
|
66
|
+
If there were no errors, that's it! Otherwise, make sure you have all the tools required for both Ruby and Rust: `bundle`, `cargo`.
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Issues, bug reports and pull requests are welcome.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[package]
|
2
|
+
name = "djotter"
|
3
|
+
version = "0.1.0"
|
4
|
+
edition = "2021"
|
5
|
+
authors = ["gustavodiasag <gustavodias.aguiar1@gmail.com>"]
|
6
|
+
publish = false
|
7
|
+
|
8
|
+
[lib]
|
9
|
+
crate-type = ["cdylib"]
|
10
|
+
|
11
|
+
[dependencies]
|
12
|
+
magnus = { version = "0.6.2" }
|
13
|
+
jotdown = { version = "0.8.0" }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
use magnus::{function, Error, Ruby};
|
2
|
+
|
3
|
+
fn djot_to_html(src: String) -> String {
|
4
|
+
use jotdown::*;
|
5
|
+
|
6
|
+
let events = Parser::new(&src);
|
7
|
+
html::render_to_string(events)
|
8
|
+
}
|
9
|
+
|
10
|
+
#[magnus::init]
|
11
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
12
|
+
let djotter = ruby.define_module("Djotter")?;
|
13
|
+
djotter.define_module_function("djot_to_html", function!(djot_to_html, 1))?;
|
14
|
+
Ok(())
|
15
|
+
}
|
data/lib/djotter.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "djotter/version"
|
4
|
+
require "djotter/djotter"
|
5
|
+
|
6
|
+
module Djotter
|
7
|
+
class << self
|
8
|
+
# Public: Parses and converts a Djot string into an HTML string.
|
9
|
+
#
|
10
|
+
# content - A {String} of text
|
11
|
+
#
|
12
|
+
# Returns a {String} of converted HTML.
|
13
|
+
def to_html(content)
|
14
|
+
raise TypeError, "text must be as String; got #{content.class}" unless content.is_a?(String)
|
15
|
+
raise TypeError, "text must e UTF-8 encoded; got #{content.encoding}" unless content.encoding.name == "UTF-8"
|
16
|
+
|
17
|
+
djot_to_html(content)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: djotter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gustavo Aguiar
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rb_sys
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0.9'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '0.9'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '13.3'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '13.3'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rake-compiler
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.3'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rspec
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.13'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.13'
|
68
|
+
description: A wrapper for the jotdown Rust crate, solely for HTML generation
|
69
|
+
executables: []
|
70
|
+
extensions:
|
71
|
+
- ext/djotter/extconf.rb
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- Cargo.lock
|
75
|
+
- Cargo.toml
|
76
|
+
- README.md
|
77
|
+
- ext/djotter/Cargo.toml
|
78
|
+
- ext/djotter/extconf.rb
|
79
|
+
- ext/djotter/src/lib.rs
|
80
|
+
- lib/djotter.rb
|
81
|
+
- lib/djotter/version.rb
|
82
|
+
homepage: https://github.com/gustavodiasag/djotter
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '3.7'
|
99
|
+
requirements: []
|
100
|
+
rubygems_version: 3.7.1
|
101
|
+
specification_version: 4
|
102
|
+
summary: Shallow wrapper for a Djot implementation written in Rust
|
103
|
+
test_files: []
|