#let u(..args) = { let size = args.at(0, default: 100%) size * 0.65em } #let npcs-store = state("/5e/npcs", (:)) #let item-store = state("/5e/items", (:)) #let spell-store = state("/5e/spells", (:)) #let insert-npc( key, name: [], hit-die-num: 1, hit-die-size: 8, str: 10, dex: 10, con: 10, int: 10, wis: 10, cha: 10, ) = context { let npcs = npcs-store.get() npcs.insert(key, ( name: name, str: str, dex: dex, con: con, int: int, wis: wis, cha: cha, )) npcs-store.update(npcs) } #let base-template(content) = context { // Typopgraphy show title: set text(size: 2.2em) show heading: set block(above: u(2), below: u(1)) show heading: set par(leading: u(0.5)) show heading: set text(bottom-edge: "baseline") show heading.where(level: 1): set text(size: 2em) show heading.where(level: 2): set text(size: 1.5em) show heading.where(level: 3): set text(size: 1.5em) show heading.where(level: 4): set text(size: 1.25em) content [ // Data for querying #metadata(( npcs: npcs-store.final(), )) ] } #let sidebar = block #let section-template(content) = { set heading(offset: 1) show heading.where(level: 3): set heading(outlined: false) /// Typography show heading.where(level: 3): box.with( width: 100%, stroke: (bottom: 0.3pt), inset: (bottom: u(0.5)), ) // Paragraphs set par(justify: true, first-line-indent: 1em, spacing: u()) // Lists show list: set par(spacing: u()) // Figures show figure: set block(breakable: true) set figure(numbering: none) show figure: set text(weight: 500, number-type: "lining") show strong: set text(weight: 400) show figure: set align(start + top) set figure.caption(position: top) show figure.caption: strong show figure.caption: set text(size: 1.1em) show figure.where(supplement: [Sidebar]): block.with( width: 100%, inset: u(), fill: white.transparentize(20%), ) show figure.where(supplement: [Sidebar]): it => { show figure.caption: set block(width: 100%) it } // Tables show figure.where(supplement: [Table]): it => { show table: set par(justify: false) set table(stroke: none, fill: (x, y) => { if (calc.even(y)) { white.transparentize(20%) } }) it } content } #let templates = ( base: base-template, section: section-template, )