#let dummy(truc) = [truc] // Builds a card from arguments #let card(name: none, protection_items: (), forbidden_items: (), referent: none, instructions: none, note: none, min_help: 0) = { ( name: name, protection_items: protection_items, forbidden_items: forbidden_items, referent: referent, min_help: min_help, instructions: instructions, note: note ) } #let build_img(link, caption) = ( img: "../imgs/" + link, caption: caption, ) // Define bindings for al protection equipment items #let Hearing = build_img("OBLIGATION/OBLIGATION-casque-antibruit.svg", "Casque anti-bruit") #let Helmet = build_img("OBLIGATION/OBLIGATION-casque.svg", "Casque") #let Glasses = build_img("OBLIGATION/OBLIGATION-lunettes.svg", "Lunettes") #let Shield = build_img("OBLIGATION/OBLIGATION-visiere.svg", "Visière") #let Gloves = build_img("OBLIGATION/OBLIGATION-gants.svg", "Gants") #let Mask = build_img("OBLIGATION/OBLIGATION-protection-voies-respiratoires.svg", "Masque") #let generate_single_card(card) = { [ #set align(center) #text(size: 40pt, weight: "bold")[#card.name] ] [ #if card.referent != none [ #text(size: 20pt)[Référent·es: #card.referent] ] else [ #text(size: 20pt)[Référent·es: #text(style: "italic")[Demander à un·e respo]] ] ] linebreak() [ #let plural = if card.min_help > 0 [s] else [] #if card.min_help > 0 [ #text(size: 20pt)[Utilisation: au moins #text(weight: "bold")[#str(card.min_help + 1)] personne#plural] ] else [ #text(size: 20pt)[Utilisation: peut s'utiliser seul·e] ] ] linebreak() linebreak() [ #box([ #set align(center) #{ for item in card.protection_items { box([ #image(width: 30%, item.img) #text(style: "italic", size: 18pt, [#item.caption]) ]) } for item in card.forbidden_items { // TODO: Cross the image box([ #image(width: 30%, item.img) #text(style: "italic", size: 18pt, [#item.caption]) ]) } } ]) ] // TODO: Tidy this up linebreak() linebreak() linebreak() text(size: 30pt, weight: "bold")[Instructions] linebreak() text(size: 18pt)[#card.instructions] } #let generate_cards(cards) = { let total_cards = cards.len() let index = 0 for card in cards { generate_single_card(card) index += 1 if index != total_cards { // Newpage pagebreak() } } }