mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-19 00:27:11 +00:00
Apply review fixes
- crates/engine/src/cmd/datamerge.rs - crates/engine/src/cmd/datamerge/tests.rs
This commit is contained in:
1 parent
9c9641c848
commit
05f08db538
2 files changed
+5
-3
No files matched your search
@@ -147,11 +147,12 @@ fn fields_cmd(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let Some(src) = st.doc.data_merge.sources.first() else {
|
||||
return Ok(json!([]));
|
||||
};
|
||||
let placeholders = &st.doc.data_merge.placeholders;
|
||||
let doc = st.preview_stash.as_deref().unwrap_or(st.doc.as_ref());
|
||||
let placeholders = &doc.data_merge.placeholders;
|
||||
let mut marker_counts = std::collections::HashMap::<String, usize>::new();
|
||||
for (story_id, story) in &st.doc.stories {
|
||||
for (story_id, story) in &doc.stories {
|
||||
// The generated endnote frame repeats note text already counted in its owning story.
|
||||
if Some(*story_id) == st.doc.endnote_story {
|
||||
if Some(*story_id) == doc.endnote_story {
|
||||
continue;
|
||||
}
|
||||
for (start, end, name) in fill::find_markers(&story.text) {
|
||||
|
||||
@@ -1657,6 +1657,7 @@ fn a_field_converted_into_a_table_is_filled_in_its_cell() {
|
||||
assert_eq!(exec(&mut s, "data.fields", json!({}))[0]["uses"], 1);
|
||||
exec(&mut s, "data.preview", json!({"record": 1}));
|
||||
assert_eq!(cell_texts(&s), ["Name", "Ada"], "the field is filled in its cell");
|
||||
assert_eq!(exec(&mut s, "data.fields", json!({}))[0]["uses"], 1, "the count reads the unfilled template while previewing");
|
||||
}
|
||||
|
||||
/// A table `Who⇥Where` with the caret in its second cell, and a source with `Name` and `City`.
|
||||
|
||||
Reference in new issue
Block a user