Skip to content

Commit 38ae41c

Browse files
committed
docs: update readme and changelog
1 parent 0c59b29 commit 38ae41c

File tree

3 files changed

+73
-24
lines changed

3 files changed

+73
-24
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# `kdl` Release Changelog
22

3+
<a name="6.0.0"></a>
4+
## 6.0.0 (2024-12-22)
5+
6+
This release updates `kdl-rs` to support the latest [KDL 2.0.0
7+
spec](https://github.com/kdl-org/kdl/blob/2.0.0/SPEC.md).
8+
9+
Additionally, KDL 1.0.0 support has been retained behind `v1` and `v1-fallback`
10+
feature flags. This version of `kdl-rs` is able to convert back and forth
11+
between each.
12+
13+
### Features
14+
15+
* **compliance:** update to latest 2.0 spec (#103) ([4734b060](https://github.com/kdl-org/kdl-rs/commit/4734b0601b9f8bf7232f9bc97fdb31117ebcb4d5))
16+
* **api:** update the KdlNode and KdlDocument APIs to be more Vec-like (#101) ([683e87a1](https://github.com/kdl-org/kdl-rs/commit/683e87a1424e7925304b28d1b35420f8ff533d6a))
17+
* **v1:** add rudimentary, optional, KDL v1 parsing (#104) ([6a7248c4](https://github.com/kdl-org/kdl-rs/commit/6a7248c40516dc8e25fab81179b5677b3ab4823b))
18+
* **v1:** Add utility to auto-translate v1 to v2 ([c486cda7](https://github.com/kdl-org/kdl-rs/commit/c486cda7a5e4db5d80a58df6ce4a39442308afe9))
19+
* **error:** Rename KdlParseFailure back to KdlError ([12b2fd2f](https://github.com/kdl-org/kdl-rs/commit/12b2fd2f4f58ba9b112842098bd041f527d04dc4))
20+
* **v1:** add v2 -> v1 translation and fix translations to not autoformat ([b332eed4](https://github.com/kdl-org/kdl-rs/commit/b332eed4a0d91425cc620aed7895fec99520a287))
21+
* **compliance:** pull in final extra tests and change VT to newline ([3e8b2f44](https://github.com/kdl-org/kdl-rs/commit/3e8b2f443a44ba40d6ba3e370d8292eff2a81381))
22+
23+
### Bug Fixes
24+
25+
* **v1:** remove v1 from default features ([3e5d7a33](https://github.com/kdl-org/kdl-rs/commit/3e5d7a33afbec0cb82c717209eecf87fb3617d0a))
26+
* **clippy:** clippy fixes ([4cbc3224](https://github.com/kdl-org/kdl-rs/commit/4cbc32246c8ef0469e50166125036417e1f00bc6))
27+
* **autoformat:** fix autoformatting of v1 -> v2 ([37255b0b](https://github.com/kdl-org/kdl-rs/commit/37255b0bf67efed88ed670f79cdc50e8879e0e1c))
28+
* **misc:** other tiny clippy/fmt issues ([ec73cdfa](https://github.com/kdl-org/kdl-rs/commit/ec73cdfa05c6486ff74bd84f8077341c9a7ec55e))
29+
* **v1:** sigh. forgot to remove v1 from default features again ([fef7c58b](https://github.com/kdl-org/kdl-rs/commit/fef7c58b02c493cc458d8080ade71987dabb0c76))
30+
* **clippy:** clippy fixes ([b097c7e2](https://github.com/kdl-org/kdl-rs/commit/b097c7e21b3b8dd92bc112f126672a8810d2d711))
31+
* **fmt:** cargo fmt ([0c59b29a](https://github.com/kdl-org/kdl-rs/commit/0c59b29a03d165b4af2864b3067e5f600545bb95))
32+
333
<a name="6.0.0-alpha.5"></a>
434
## 6.0.0-alpha.5 (2024-12-16)
535

README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,35 @@
22

33
`kdl` is a "document-oriented" parser and API for the [KDL Document
44
Language](https://kdl.dev), a node-based, human-friendly configuration and
5-
serialization format. Unlike serde-based implementations, this crate
6-
preserves formatting when editing, as well as when inserting or changing
7-
values with custom formatting. This is most useful when working with
8-
human-maintained KDL files.
5+
serialization format.
6+
7+
Unlike serde-based implementations, this crate preserves formatting when
8+
editing, as well as when inserting or changing values with custom
9+
formatting. This is most useful when working with human-maintained KDL
10+
files.
911

1012
You can think of this crate as
1113
[`toml_edit`](https://crates.io/crates/toml_edit), but for KDL.
1214

13-
If you don't care about formatting or programmatic manipulation, you might
14-
check out [`knuffel`](https://crates.io/crates/knuffel) or
15-
[`kaydle`](https://crates.io/crates/kaydle) instead for serde (or
16-
serde-like) parsing.
15+
This crate supports both KDL v2.0.0 and v1.0.0 (when using the non-default
16+
`v1` feature). It also supports converting documents between either format.
1717

18-
This crate supports parsing [KDL
19-
2.0.0-draft.6](https://github.com/kdl-org/kdl/releases/tag/2.0.0-draft.6)
18+
There is also a `v1-fallback` feature that may be enabled in order to have
19+
the various `Kdl*::parse` methods try to parse their input as v2, and, if
20+
that fails, try again as v1. In either case, a dedicated `Kdl*::parse_v1`
21+
method is available for v1-exclusive parsing, as long as either `v1` or
22+
`v1-fallback` are enabled.
2023

2124
### Example
2225

2326
```rust
24-
use kdl::KdlDocument;
27+
use kdl::{KdlDocument, KdlValue};
2528

2629
let doc_str = r#"
2730
hello 1 2 3
2831
2932
// Comment
30-
world prop=value {
33+
world prop=string-value {
3134
child 1
3235
child 2
3336
child #inf
@@ -37,13 +40,13 @@ world prop=value {
3740
let doc: KdlDocument = doc_str.parse().expect("failed to parse KDL");
3841

3942
assert_eq!(
40-
doc.get_args("hello"),
43+
doc.iter_args("hello").collect::<Vec<&KdlValue>>(),
4144
vec![&1.into(), &2.into(), &3.into()]
4245
);
4346

4447
assert_eq!(
4548
doc.get("world").map(|node| &node["prop"]),
46-
Some(&"value".into())
49+
Some(&"string-value".into())
4750
);
4851

4952
// Documents fully roundtrip:
@@ -102,14 +105,25 @@ Error:
102105
help: Floating point numbers must be base 10, and have numbers after the decimal point.
103106
```
104107

108+
### Features
109+
110+
* `span` (default) - Includes spans in the various document-related structs.
111+
* `v1` - Adds support for v1 parsing. This will pull in the entire previous
112+
version of `kdl-rs`, and so may be fairly heavy.
113+
* `v1-fallback` - Implies `v1`. Makes it so the various `*::parse()` and
114+
`FromStr` implementations try to parse their inputs as `v2`, and, if that
115+
fails, try again with `v1`. Errors will only be reported as if the input was
116+
`v2`. To manage this more precisely, you can use the `*::parse_v2` and
117+
`*::parse_v1` methods.
118+
105119
### Quirks
106120

107121
#### Properties
108122

109123
Multiple properties with the same name are allowed, and all duplicated
110124
**will be preserved**, meaning those documents will correctly round-trip.
111125
When using `node.get()`/`node["key"]` & company, the _last_ property with
112-
that name's value will be returned.
126+
that name's value will be returned (as per spec).
113127

114128
#### Numbers
115129

src/lib.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@
1111
//! [`toml_edit`](https://crates.io/crates/toml_edit), but for KDL.
1212
//!
1313
//! This crate supports both KDL v2.0.0 and v1.0.0 (when using the non-default
14-
//! `v1` feature).
14+
//! `v1` feature). It also supports converting documents between either format.
1515
//!
1616
//! There is also a `v1-fallback` feature that may be enabled in order to have
1717
//! the various `Kdl*::parse` methods try to parse their input as v2, and, if
1818
//! that fails, try again as v1. In either case, a dedicated `Kdl*::parse_v1`
1919
//! method is available for v1-exclusive parsing, as long as either `v1` or
2020
//! `v1-fallback` are enabled.
2121
//!
22-
//! Autoformatting a document parsed from a v1 doc will translate the document
23-
//! to v2 format, preserving as much of the v1 trivia as possible (comments,
24-
//! etc). It *should* generate a fully valid v2 document, but there may still be
25-
//! some corner cases that don't translate well. Please file issues as needed
26-
//! for those.
27-
//!
2822
//! ## Example
2923
//!
3024
//! ```rust
@@ -34,7 +28,7 @@
3428
//! hello 1 2 3
3529
//!
3630
//! // Comment
37-
//! world prop=value {
31+
//! world prop=string-value {
3832
//! child 1
3933
//! child 2
4034
//! child #inf
@@ -50,7 +44,7 @@
5044
//!
5145
//! assert_eq!(
5246
//! doc.get("world").map(|node| &node["prop"]),
53-
//! Some(&"value".into())
47+
//! Some(&"string-value".into())
5448
//! );
5549
//!
5650
//! // Documents fully roundtrip:
@@ -109,6 +103,17 @@
109103
//! help: Floating point numbers must be base 10, and have numbers after the decimal point.
110104
//! ```
111105
//!
106+
//! ## Features
107+
//!
108+
//! * `span` (default) - Includes spans in the various document-related structs.
109+
//! * `v1` - Adds support for v1 parsing. This will pull in the entire previous
110+
//! version of `kdl-rs`, and so may be fairly heavy.
111+
//! * `v1-fallback` - Implies `v1`. Makes it so the various `*::parse()` and
112+
//! `FromStr` implementations try to parse their inputs as `v2`, and, if that
113+
//! fails, try again with `v1`. Errors will only be reported as if the input was
114+
//! `v2`. To manage this more precisely, you can use the `*::parse_v2` and
115+
//! `*::parse_v1` methods.
116+
//!
112117
//! ## Quirks
113118
//!
114119
//! ### Properties

0 commit comments

Comments
 (0)