Skip to content

Commit b19fcf8

Browse files
committed
Merge support for TOML 1.1 output format
2 parents 3e1f859 + fb2cdb3 commit b19fcf8

23 files changed

+114
-21
lines changed

docs/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ compatibility impact will be clearly marked as such in the changelog.
1818

1919
Unreleased.
2020

21+
* Add support for <abbr>TOML 1.1</abbr> as an output format. The existing
22+
`toml` output format is now an alias for `toml-1.0`, so there is no change
23+
in behavior for existing usage.
2124
* Fix a bug that prevented parsing nested functions.
2225

2326
Thanks to matthieucx for contributing to this release.

docs/rcl_evaluate.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ Output in the given format. The following formats are supported:
4545
<dd>Output pretty-printed <abbr>RCL</abbr>.</dd>
4646

4747
<dt>toml</dt>
48-
<dd>Output <abbr>TOML</abbr>.</dd>
48+
<dd>Alias for <code>toml-1.0</code>.</dd>
49+
50+
<dt>toml-1.0</dt>
51+
<dd>Output <abbr>TOML 1.0</abbr>.
52+
This version is the most widely supported,
53+
but can be less readable because inline tables
54+
cannot span multiple lines.</dd>
55+
56+
<dt>toml-1.1</dt>
57+
<dd>Output <abbr>TOML 1.1</abbr>.
58+
This version supports multi-line tables,
59+
but it was only released in December 2025,
60+
so it is less widely supported.</dd>
4961

5062
<dt>yaml-stream</dt>
5163
<dd>If the document is a list, output every element as a <abbr>JSON</abbr>

fuzz/src/uber.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ fn fuzz_eval_json_check(loader: &mut Loader, input: &str, cfg: pprint::Config) -
224224
///
225225
/// Then check that the result can be parsed by the `toml` crate.
226226
fn fuzz_eval_toml_check(loader: &mut Loader, input: &str, cfg: pprint::Config) -> Result<()> {
227+
use rcl::fmt_toml::{format_toml, TomlVersion};
227228
let (full_span, value) = eval(loader, input)?;
228-
let toml_doc = rcl::fmt_toml::format_toml(full_span, &value)?;
229+
let toml_doc = format_toml(TomlVersion::Toml10, full_span, &value)?;
229230
let toml_str = toml_doc.println(&cfg).to_string_no_markup();
230231
match toml::from_str::<toml::Value>(&toml_str[..]) {
231232
Ok(..) => Ok(()),

golden/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def test_one(fname: str, fname_friendly: str, *, rewrite_output: bool) -> Option
126126
case "rcl":
127127
cmd = ["eval", "--format=rcl"]
128128

129-
case "toml":
130-
cmd = ["eval", "--format=toml"]
129+
case "toml_10":
130+
cmd = ["eval", "--format=toml-1.0"]
131131
# For TOML, when the test case is not an error, we additionally test
132132
# that Python can parse the expected output, because there have been
133133
# some cases where RCL outputs something that other parsers reject.
@@ -137,6 +137,9 @@ def test_one(fname: str, fname_friendly: str, *, rewrite_output: bool) -> Option
137137
except Exception as err:
138138
raise Exception(f"Invalid TOML in {fname}") from err
139139

140+
case "toml_11":
141+
cmd = ["eval", "--format=toml-1.1"]
142+
140143
case "yaml_stream":
141144
cmd = ["eval", "--format=yaml-stream"]
142145

File renamed without changes.

0 commit comments

Comments
 (0)