Skip to content

Commit

Permalink
fix: manifest formats
Browse files Browse the repository at this point in the history
  • Loading branch information
CertainLach committed May 17, 2024
1 parent 261130a commit f008573
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 2 additions & 3 deletions crates/jrsonnet-evaluator/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ fn manifest_json_ex_buf(
Minify => {}
};

buf.push_str(cur_padding);
State::push_description(
|| format!("elem <{i}> manifestification"),
|| manifest_json_ex_buf(&item, buf, cur_padding, options),
Expand Down Expand Up @@ -298,8 +297,8 @@ fn manifest_json_ex_buf(
buf.push_str(options.newline);
buf.push_str(cur_padding);
}
ToString => buf.push(' '),
Minify => {}
ToString if i != 0 => buf.push(' '),
Minify | ToString => {}
}

escape_string_json_buf(&key, buf);
Expand Down
2 changes: 1 addition & 1 deletion crates/jrsonnet-stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {
("objectRemoveKey", builtin_object_remove_key::INST),
// Manifest
("escapeStringJson", builtin_escape_string_json::INST),
("escapeStringPython", builtin_escape_string_json::INST),
("escapeStringPython", builtin_escape_string_python::INST),
("escapeStringXML", builtin_escape_string_xml::INST),
("manifestJsonEx", builtin_manifest_json_ex::INST),
("manifestJson", builtin_manifest_json::INST),
Expand Down
9 changes: 7 additions & 2 deletions crates/jrsonnet-stdlib/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {
Ok(escape_string_json(&str_))
}

#[builtin]
pub fn builtin_escape_string_python(str: IStr) -> Result<String> {
Ok(escape_string_json(&str))
}

#[builtin]
pub fn builtin_manifest_json_ex(
value: Val,
Expand Down Expand Up @@ -164,13 +169,13 @@ pub fn builtin_manifest_python(
}
#[builtin]
pub fn builtin_manifest_python_vars(
v: Val,
conf: Val,

#[default(false)]
#[cfg(feature = "exp-preserve-order")]
preserve_order: bool,
) -> Result<String> {
v.manifest(PythonVarsFormat::std(
conf.manifest(PythonVarsFormat::std(
#[cfg(feature = "exp-preserve-order")]
preserve_order,
))
Expand Down
4 changes: 2 additions & 2 deletions crates/jrsonnet-stdlib/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ pub fn builtin_escape_string_bash(str_: String) -> String {
}

#[builtin]
pub fn builtin_escape_string_dollars(str: String) -> String {
str.replace('$', "$$")
pub fn builtin_escape_string_dollars(str_: String) -> String {
str_.replace('$', "$$")
}

#[builtin]
Expand Down

0 comments on commit f008573

Please sign in to comment.