Add structured tables for test conditions and ink formula in product test template.
This commit is contained in:
@@ -217,6 +217,57 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Renders the test conditions as a structured key/value table.
|
||||||
|
// Each row is a tuple of (label, value).
|
||||||
|
// Usage:
|
||||||
|
// #test_conditions_table((
|
||||||
|
// ([روش اعمال], [قطرهای]),
|
||||||
|
// ([دمای پخت], [۱۰۳۰، ۱۱۵۰، ۱۱۸۰ °C]),
|
||||||
|
// ))
|
||||||
|
#let test_conditions_table(rows) = {
|
||||||
|
block(
|
||||||
|
breakable: false,
|
||||||
|
align(center, table(
|
||||||
|
columns: (auto, auto),
|
||||||
|
align: right,
|
||||||
|
stroke: 0.5pt,
|
||||||
|
inset: 8pt,
|
||||||
|
fill: (x, y) => if y == 0 { luma(235) },
|
||||||
|
[*شرط آزمون*],
|
||||||
|
[*مقدار*],
|
||||||
|
..rows.flatten(),
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Renders the ink formula as a component / weight-% table and appends an
|
||||||
|
// automatic total row. Component names are rendered LTR (English).
|
||||||
|
// Each row is a tuple of (component, weight).
|
||||||
|
// Usage:
|
||||||
|
// #ink_formula_table((
|
||||||
|
// ("Pigment", 30),
|
||||||
|
// ("Sol-1", 60),
|
||||||
|
// ("Super Disp.", 10),
|
||||||
|
// ))
|
||||||
|
#let ink_formula_table(rows) = {
|
||||||
|
let total = rows.fold(0, (acc, row) => acc + row.at(1))
|
||||||
|
block(
|
||||||
|
breakable: false,
|
||||||
|
align(center, table(
|
||||||
|
columns: (auto, auto),
|
||||||
|
align: center,
|
||||||
|
stroke: 0.5pt,
|
||||||
|
inset: 8pt,
|
||||||
|
fill: (x, y) => if y == 0 { luma(235) },
|
||||||
|
[*جزء*],
|
||||||
|
[*درصد وزنی*],
|
||||||
|
..rows.map(row => (text(dir: ltr, row.at(0)), [#row.at(1)])).flatten(),
|
||||||
|
table.cell(fill: luma(245), [*مجموع*]),
|
||||||
|
table.cell(fill: luma(245), [*#total*]),
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Renders the received samples as a structured table.
|
// Renders the received samples as a structured table.
|
||||||
// Each row should contain:
|
// Each row should contain:
|
||||||
// (pigment_name, supplier_code, internal_code, document_no)
|
// (pigment_name, supplier_code, internal_code, document_no)
|
||||||
|
|||||||
Reference in New Issue
Block a user