carve-lang 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/CHANGELOG.md +22 -0
- data/LICENSE +21 -0
- data/README.md +185 -0
- data/ext/carve/Cargo.lock +343 -0
- data/ext/carve/Cargo.toml +28 -0
- data/ext/carve/extconf.rb +9 -0
- data/ext/carve/src/ast_json.rs +508 -0
- data/ext/carve/src/lib.rs +288 -0
- data/lib/carve/version.rb +5 -0
- data/lib/carve.rb +120 -0
- metadata +112 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d63ffac925c5ff16de3889adf7e5e887cd816a4900cf46304f5da865e00998c2
|
|
4
|
+
data.tar.gz: cb52a4f8c5c3edca31be9e70c7093ff375aa07ae06d48f240bb15b76d8539691
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b7c2b1b33a8a979ac4ba2f4b8986e7876188ebe8105c5cb9beb9d55e7f068a04f9bcd785b5837309c5fd408670994c57e3706e39979b36adf1a0c8cbb8226738
|
|
7
|
+
data.tar.gz: a676302d1f1b343abf78e324bdd48dcedd5146e6637370ef3276f33cab5479c854d149f3b9365865867d1f008b1fe3af086b2201ac1b41e79dbb12c31a3f402c
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-07-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial release: `Carve.to_html` exposes the carve-rs engine as a native
|
|
15
|
+
Ruby extension (magnus + rb-sys), with the full extension/option surface,
|
|
16
|
+
the static/print render mode, and pluggable diagram/math renderers.
|
|
17
|
+
- `Carve.parse` returns the full parse tree as symbol-keyed Ruby Hashes and
|
|
18
|
+
Arrays (every AST node type is covered), enabling custom renderers such as
|
|
19
|
+
[carve-hexapdf](https://github.com/markup-carve/carve-hexapdf).
|
|
20
|
+
|
|
21
|
+
[Unreleased]: https://github.com/markup-carve/carve-rb/compare/v0.1.0...HEAD
|
|
22
|
+
[0.1.0]: https://github.com/markup-carve/carve-rb/releases/tag/v0.1.0
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) markup-carve
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# carve (Ruby)
|
|
2
|
+
|
|
3
|
+
Native Ruby bindings for the [Carve](https://github.com/markup-carve/carve)
|
|
4
|
+
markup language. This gem is a thin native extension built with
|
|
5
|
+
[magnus](https://github.com/matsadler/magnus) + [rb-sys](https://github.com/oxidize-rb/rb-sys)
|
|
6
|
+
over the [carve-rs](https://github.com/markup-carve/carve-rs) engine. The parser
|
|
7
|
+
is not reimplemented in Ruby; it calls into the Rust crate directly, mirroring
|
|
8
|
+
how Djot's `djotter` gem wraps the `jotdown` crate.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
# Gemfile
|
|
14
|
+
gem "carve-lang"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
bundle install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or install directly:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
gem install carve-lang
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then `require "carve"` as normal - the gem distribution name is `carve-lang`
|
|
28
|
+
but the require path stays `carve`.
|
|
29
|
+
|
|
30
|
+
Building from source requires a **Rust toolchain** (`cargo`, Rust >= 1.75) and
|
|
31
|
+
Ruby development headers. RubyGems compiles the native extension at install
|
|
32
|
+
time via `rb_sys`.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
require "carve"
|
|
38
|
+
|
|
39
|
+
Carve.to_html("# Hello *world*")
|
|
40
|
+
# => "<section id=\"Hello-world\">\n <h1>Hello <strong>world</strong></h1>\n</section>"
|
|
41
|
+
|
|
42
|
+
# Carve syntax note: *...* is STRONG (bold), /.../ is EMPHASIS (italic).
|
|
43
|
+
Carve.to_html("*bold* and /italic/")
|
|
44
|
+
|
|
45
|
+
# Enable opt-in extensions (Symbols or Strings, snake_case or hyphenated):
|
|
46
|
+
Carve.to_html(<<~CRV, extensions: [:math_block])
|
|
47
|
+
```math
|
|
48
|
+
a^2 + b^2 = c^2
|
|
49
|
+
```
|
|
50
|
+
CRV
|
|
51
|
+
|
|
52
|
+
Carve.to_html(src, extensions: %w[math-block list-table])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Recognized extensions
|
|
56
|
+
|
|
57
|
+
`autolink`, `details`, `list_table`, `math_block`, `heading_permalinks`,
|
|
58
|
+
`citations`, `code_callouts`, `tab_normalize`, `wikilinks`, `external_links`,
|
|
59
|
+
`fenced_render`, `fenced_render_graphviz`, `fenced_render_chart`, `spoiler`,
|
|
60
|
+
`table_of_contents` (see `Carve::EXTENSIONS`).
|
|
61
|
+
|
|
62
|
+
An unknown extension name raises `ArgumentError`.
|
|
63
|
+
|
|
64
|
+
## Parsing to an AST
|
|
65
|
+
|
|
66
|
+
`Carve.parse` returns the parsed document as a tree of Ruby Hashes and Arrays,
|
|
67
|
+
for consumers that want to walk or transform the document rather than render
|
|
68
|
+
HTML - for example a custom PDF renderer (see
|
|
69
|
+
[`carve-hexapdf`](https://github.com/markup-carve/carve-hexapdf)).
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
Carve.parse("# Hello *world*")
|
|
73
|
+
# => {type: "document", frontmatter: {}, footnote_defs: {},
|
|
74
|
+
# children: [{type: "heading", level: 1,
|
|
75
|
+
# children: [{type: "text", value: "Hello "},
|
|
76
|
+
# {type: "emphasis", kind: "strong",
|
|
77
|
+
# children: [{type: "text", value: "world"}], attrs: nil}],
|
|
78
|
+
# attrs: nil}],
|
|
79
|
+
# source_len: 15}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Every node is a Hash with a `:type` key plus its fields; child collections are
|
|
83
|
+
Arrays; `:attrs` is `nil` or a Hash of `{id:, classes:, key_values:}`. Keys are
|
|
84
|
+
symbols. This is the raw parse tree (default profile, no extensions), so
|
|
85
|
+
render-stage extension rewrites are not applied.
|
|
86
|
+
|
|
87
|
+
## Static render mode + renderers
|
|
88
|
+
|
|
89
|
+
By default `Carve.to_html` renders **interactive** HTML: client-script
|
|
90
|
+
constructs (Mermaid/Graphviz/Chart diagrams, math) emit hydration elements
|
|
91
|
+
(`<pre class="mermaid">`, ...) and disclosure stays collapsed (`<details>`).
|
|
92
|
+
|
|
93
|
+
Pass `mode: :static` to emit **self-contained** HTML for print, PDF, or
|
|
94
|
+
archival. Static mode forces disclosure (`<details open>`) and pre-renders
|
|
95
|
+
client-script constructs through the `renderers:` callables you supply.
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Carve.to_html(<<~CRV, extensions: [:fenced_render], mode: :static,
|
|
99
|
+
renderers: { mermaid: ->(src) { "<svg>#{src}</svg>" } })
|
|
100
|
+
```mermaid
|
|
101
|
+
graph TD; A-->B
|
|
102
|
+
```
|
|
103
|
+
CRV
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Renderer callable signatures
|
|
107
|
+
|
|
108
|
+
The `renderers:` Hash is keyed by Symbol or String (see
|
|
109
|
+
`Carve::RENDERER_KEYS`):
|
|
110
|
+
|
|
111
|
+
| Key | Callable signature | Receives |
|
|
112
|
+
| --- | ------------------ | -------- |
|
|
113
|
+
| `:mermaid` | `(String) -> String` | the diagram source |
|
|
114
|
+
| `:chart` | `(String) -> String` | the chart JSON source |
|
|
115
|
+
| `:graphviz` | `(String) -> String` | the DOT / Graphviz source |
|
|
116
|
+
| `:math` | `(String, display) -> String` | the TeX source and a `display` boolean (`true` for block / display math, `false` for inline) |
|
|
117
|
+
|
|
118
|
+
Each callable returns a self-contained HTML string (an `<svg>` / `<img>` for a
|
|
119
|
+
diagram, MathML / HTML for math) that the engine emits **verbatim** on the
|
|
120
|
+
static path.
|
|
121
|
+
|
|
122
|
+
### Source fallback (graceful degradation)
|
|
123
|
+
|
|
124
|
+
When the renderer a construct needs is **absent**, or a supplied renderer
|
|
125
|
+
**raises** or returns a **non-String**, the construct degrades to its source -
|
|
126
|
+
never blank, and never raw HTML. The fallback source is **HTML-escaped**, so a
|
|
127
|
+
construct body containing markup (e.g. `<img onerror=...>`) can never inject raw
|
|
128
|
+
HTML. This is part of the cross-implementation graceful-degradation rollout
|
|
129
|
+
(spec carve #205; siblings carve-js #242, carve-php #240, carve-rs #143,
|
|
130
|
+
carve-py #1).
|
|
131
|
+
|
|
132
|
+
An unknown `mode:` value or an unknown `renderers:` key raises `ArgumentError`.
|
|
133
|
+
|
|
134
|
+
## API
|
|
135
|
+
|
|
136
|
+
| Method | Description |
|
|
137
|
+
| ------ | ----------- |
|
|
138
|
+
| `Carve.to_html(source)` | Render Carve source to HTML. |
|
|
139
|
+
| `Carve.parse(source)` | Parse Carve source into an AST (tree of Ruby Hashes/Arrays). |
|
|
140
|
+
| `Carve.to_html(source, extensions: [...])` | Render with the named extensions enabled. |
|
|
141
|
+
| `Carve.to_html(source, mode: :static, renderers: {...})` | Render self-contained static HTML with build-time renderers. |
|
|
142
|
+
| `Carve.to_html_with_extensions(source, names_array)` | Native primitive (Array of Strings). |
|
|
143
|
+
| `Carve.to_html_full(source, names_array, mode_string, renderers_hash)` | Native static-mode primitive. |
|
|
144
|
+
| `Carve::VERSION` | Gem version. |
|
|
145
|
+
| `Carve::EXTENSIONS` | Array of recognized extension symbols. |
|
|
146
|
+
| `Carve::MODES` | Array of recognized render modes (`:interactive`, `:static`). |
|
|
147
|
+
| `Carve::RENDERER_KEYS` | Array of recognized `renderers:` keys. |
|
|
148
|
+
|
|
149
|
+
## Develop
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
bundle install
|
|
153
|
+
rake compile # builds the Rust extension into lib/carve/carve.so
|
|
154
|
+
rake test # runs the minitest suite
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> [!NOTE]
|
|
158
|
+
> The native build uses `rb_sys` + `bindgen` (libclang) to read Ruby's
|
|
159
|
+
> headers. On systems where libclang cannot find its builtin C headers (the
|
|
160
|
+
> `'stdarg.h' file not found` error), point it at the GCC builtin include dir:
|
|
161
|
+
>
|
|
162
|
+
> ```sh
|
|
163
|
+
> export BINDGEN_EXTRA_CLANG_ARGS="-I/usr/lib/gcc/x86_64-linux-gnu/13/include"
|
|
164
|
+
> ```
|
|
165
|
+
>
|
|
166
|
+
> (Adjust the GCC version directory to match your toolchain.)
|
|
167
|
+
|
|
168
|
+
## carve-rs dependency pin
|
|
169
|
+
|
|
170
|
+
`ext/carve/Cargo.toml` pins a specific carve-rs commit for reproducible gem
|
|
171
|
+
builds:
|
|
172
|
+
|
|
173
|
+
```toml
|
|
174
|
+
carve_rs = { package = "carve", git = "https://github.com/markup-carve/carve-rs", rev = "09c64118223c1574d136c308cfe2a70df8ab5128" }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The crate is imported under the alias `carve_rs`. Note: carve-rs has since
|
|
178
|
+
renamed its published crate to `carve-lang` on `main`; this pin predates that
|
|
179
|
+
rename, so `package = "carve"` is correct for this exact `rev`. When bumping to
|
|
180
|
+
a newer carve-rs commit (past the rename), update both the `rev` and
|
|
181
|
+
`package = "carve-lang"`.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT, markup-carve.
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 3
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aho-corasick"
|
|
7
|
+
version = "1.1.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "bindgen"
|
|
16
|
+
version = "0.72.1"
|
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
+
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
|
19
|
+
dependencies = [
|
|
20
|
+
"bitflags",
|
|
21
|
+
"cexpr",
|
|
22
|
+
"clang-sys",
|
|
23
|
+
"itertools",
|
|
24
|
+
"proc-macro2",
|
|
25
|
+
"quote",
|
|
26
|
+
"regex",
|
|
27
|
+
"rustc-hash",
|
|
28
|
+
"shlex",
|
|
29
|
+
"syn",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "bitflags"
|
|
34
|
+
version = "2.13.0"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "carve-lang"
|
|
40
|
+
version = "0.1.0"
|
|
41
|
+
source = "git+https://github.com/markup-carve/carve-rs?rev=8fe33018d55f401c9c3ae8104f1cf06f3b56ed18#8fe33018d55f401c9c3ae8104f1cf06f3b56ed18"
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "carve-rb"
|
|
45
|
+
version = "0.1.0"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"carve-lang",
|
|
48
|
+
"magnus",
|
|
49
|
+
"rb-sys",
|
|
50
|
+
"serde_json",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "cexpr"
|
|
55
|
+
version = "0.6.0"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
58
|
+
dependencies = [
|
|
59
|
+
"nom",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "cfg-if"
|
|
64
|
+
version = "1.0.4"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "clang-sys"
|
|
70
|
+
version = "1.8.1"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"glob",
|
|
75
|
+
"libc",
|
|
76
|
+
"libloading",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "either"
|
|
81
|
+
version = "1.16.0"
|
|
82
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
+
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
|
84
|
+
|
|
85
|
+
[[package]]
|
|
86
|
+
name = "glob"
|
|
87
|
+
version = "0.3.3"
|
|
88
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
89
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
90
|
+
|
|
91
|
+
[[package]]
|
|
92
|
+
name = "itertools"
|
|
93
|
+
version = "0.13.0"
|
|
94
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
+
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
|
96
|
+
dependencies = [
|
|
97
|
+
"either",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
[[package]]
|
|
101
|
+
name = "itoa"
|
|
102
|
+
version = "1.0.18"
|
|
103
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
+
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "lazy_static"
|
|
108
|
+
version = "1.5.0"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
111
|
+
|
|
112
|
+
[[package]]
|
|
113
|
+
name = "libc"
|
|
114
|
+
version = "0.2.186"
|
|
115
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
116
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "libloading"
|
|
120
|
+
version = "0.8.9"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"cfg-if",
|
|
125
|
+
"windows-link",
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "magnus"
|
|
130
|
+
version = "0.8.2"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"magnus-macros",
|
|
135
|
+
"rb-sys",
|
|
136
|
+
"rb-sys-env",
|
|
137
|
+
"seq-macro",
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "magnus-macros"
|
|
142
|
+
version = "0.8.0"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
145
|
+
dependencies = [
|
|
146
|
+
"proc-macro2",
|
|
147
|
+
"quote",
|
|
148
|
+
"syn",
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
[[package]]
|
|
152
|
+
name = "memchr"
|
|
153
|
+
version = "2.8.2"
|
|
154
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
155
|
+
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
|
156
|
+
|
|
157
|
+
[[package]]
|
|
158
|
+
name = "minimal-lexical"
|
|
159
|
+
version = "0.2.1"
|
|
160
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
161
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
162
|
+
|
|
163
|
+
[[package]]
|
|
164
|
+
name = "nom"
|
|
165
|
+
version = "7.1.3"
|
|
166
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
167
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
168
|
+
dependencies = [
|
|
169
|
+
"memchr",
|
|
170
|
+
"minimal-lexical",
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
[[package]]
|
|
174
|
+
name = "proc-macro2"
|
|
175
|
+
version = "1.0.106"
|
|
176
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
177
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
178
|
+
dependencies = [
|
|
179
|
+
"unicode-ident",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[[package]]
|
|
183
|
+
name = "quote"
|
|
184
|
+
version = "1.0.46"
|
|
185
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
186
|
+
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
|
187
|
+
dependencies = [
|
|
188
|
+
"proc-macro2",
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
[[package]]
|
|
192
|
+
name = "rb-sys"
|
|
193
|
+
version = "0.9.128"
|
|
194
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
|
+
checksum = "45ca28513560e56cfb79a62b1fce363c73af170a182024ce880c77ee9429920a"
|
|
196
|
+
dependencies = [
|
|
197
|
+
"rb-sys-build",
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
[[package]]
|
|
201
|
+
name = "rb-sys-build"
|
|
202
|
+
version = "0.9.128"
|
|
203
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
204
|
+
checksum = "ce04b2c55eff3a21aaa623fcc655d94373238e72cac6b3e1a3641ff31649f99a"
|
|
205
|
+
dependencies = [
|
|
206
|
+
"bindgen",
|
|
207
|
+
"lazy_static",
|
|
208
|
+
"proc-macro2",
|
|
209
|
+
"quote",
|
|
210
|
+
"regex",
|
|
211
|
+
"shell-words",
|
|
212
|
+
"syn",
|
|
213
|
+
]
|
|
214
|
+
|
|
215
|
+
[[package]]
|
|
216
|
+
name = "rb-sys-env"
|
|
217
|
+
version = "0.2.3"
|
|
218
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
219
|
+
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
220
|
+
|
|
221
|
+
[[package]]
|
|
222
|
+
name = "regex"
|
|
223
|
+
version = "1.12.4"
|
|
224
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
+
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
|
226
|
+
dependencies = [
|
|
227
|
+
"aho-corasick",
|
|
228
|
+
"memchr",
|
|
229
|
+
"regex-automata",
|
|
230
|
+
"regex-syntax",
|
|
231
|
+
]
|
|
232
|
+
|
|
233
|
+
[[package]]
|
|
234
|
+
name = "regex-automata"
|
|
235
|
+
version = "0.4.14"
|
|
236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
238
|
+
dependencies = [
|
|
239
|
+
"aho-corasick",
|
|
240
|
+
"memchr",
|
|
241
|
+
"regex-syntax",
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
[[package]]
|
|
245
|
+
name = "regex-syntax"
|
|
246
|
+
version = "0.8.11"
|
|
247
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
248
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
249
|
+
|
|
250
|
+
[[package]]
|
|
251
|
+
name = "rustc-hash"
|
|
252
|
+
version = "2.1.2"
|
|
253
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
254
|
+
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
|
255
|
+
|
|
256
|
+
[[package]]
|
|
257
|
+
name = "seq-macro"
|
|
258
|
+
version = "0.3.6"
|
|
259
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
260
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
261
|
+
|
|
262
|
+
[[package]]
|
|
263
|
+
name = "serde"
|
|
264
|
+
version = "1.0.228"
|
|
265
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
266
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
267
|
+
dependencies = [
|
|
268
|
+
"serde_core",
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
[[package]]
|
|
272
|
+
name = "serde_core"
|
|
273
|
+
version = "1.0.228"
|
|
274
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
275
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
276
|
+
dependencies = [
|
|
277
|
+
"serde_derive",
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
[[package]]
|
|
281
|
+
name = "serde_derive"
|
|
282
|
+
version = "1.0.228"
|
|
283
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
284
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
285
|
+
dependencies = [
|
|
286
|
+
"proc-macro2",
|
|
287
|
+
"quote",
|
|
288
|
+
"syn",
|
|
289
|
+
]
|
|
290
|
+
|
|
291
|
+
[[package]]
|
|
292
|
+
name = "serde_json"
|
|
293
|
+
version = "1.0.150"
|
|
294
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
295
|
+
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
|
296
|
+
dependencies = [
|
|
297
|
+
"itoa",
|
|
298
|
+
"memchr",
|
|
299
|
+
"serde",
|
|
300
|
+
"serde_core",
|
|
301
|
+
"zmij",
|
|
302
|
+
]
|
|
303
|
+
|
|
304
|
+
[[package]]
|
|
305
|
+
name = "shell-words"
|
|
306
|
+
version = "1.1.1"
|
|
307
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
308
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
309
|
+
|
|
310
|
+
[[package]]
|
|
311
|
+
name = "shlex"
|
|
312
|
+
version = "1.3.0"
|
|
313
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
314
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
315
|
+
|
|
316
|
+
[[package]]
|
|
317
|
+
name = "syn"
|
|
318
|
+
version = "2.0.118"
|
|
319
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
320
|
+
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
|
321
|
+
dependencies = [
|
|
322
|
+
"proc-macro2",
|
|
323
|
+
"quote",
|
|
324
|
+
"unicode-ident",
|
|
325
|
+
]
|
|
326
|
+
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "unicode-ident"
|
|
329
|
+
version = "1.0.24"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
332
|
+
|
|
333
|
+
[[package]]
|
|
334
|
+
name = "windows-link"
|
|
335
|
+
version = "0.2.1"
|
|
336
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
337
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
338
|
+
|
|
339
|
+
[[package]]
|
|
340
|
+
name = "zmij"
|
|
341
|
+
version = "1.0.21"
|
|
342
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
343
|
+
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "carve-rb"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
rust-version = "1.75"
|
|
6
|
+
publish = false
|
|
7
|
+
license = "MIT"
|
|
8
|
+
description = "Native Ruby binding (magnus + rb-sys) for the Carve markup language, over the carve-rs engine."
|
|
9
|
+
|
|
10
|
+
[lib]
|
|
11
|
+
# Ruby loads the extension as a C shared object. cdylib produces that.
|
|
12
|
+
name = "carve"
|
|
13
|
+
crate-type = ["cdylib"]
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
# High-level CRuby bindings. The `rb-sys` feature exposes the low-level rb-sys
|
|
17
|
+
# interop handles so this builds cleanly under rb_sys/mkmf for Ruby 3.2.
|
|
18
|
+
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
19
|
+
rb-sys = "0.9"
|
|
20
|
+
|
|
21
|
+
# AST -> JSON serialization for `Carve.parse`. Kept in the binding so the
|
|
22
|
+
# carve-rs engine itself stays free of a serde dependency.
|
|
23
|
+
serde_json = "1"
|
|
24
|
+
|
|
25
|
+
# The Carve engine. Imported under the Rust crate alias `carve_rs` so the
|
|
26
|
+
# binding's own crate name (`carve-rb`) does not collide with the engine's
|
|
27
|
+
# package name (`carve`) in the Cargo lockfile.
|
|
28
|
+
carve_rs = { package = "carve-lang", git = "https://github.com/markup-carve/carve-rs", rev = "8fe33018d55f401c9c3ae8104f1cf06f3b56ed18" }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Build the Rust crate as a Ruby native extension using rb_sys/mkmf.
|
|
4
|
+
# create_rust_makefile generates a Makefile that drives `cargo build` and
|
|
5
|
+
# installs the resulting cdylib as `carve/carve.so`.
|
|
6
|
+
require "mkmf"
|
|
7
|
+
require "rb_sys/mkmf"
|
|
8
|
+
|
|
9
|
+
create_rust_makefile("carve/carve")
|