#import "@preview/glossarium:0.5.10": make-glossary, register-glossary, print-glossary, gls-long, gls-short
#import "theme.typ": *

#let glossary-entries = (
  (
    key: "hsi",
    short: "HSI",
    long: "高光谱成像",
    description: "Hyperspectral Imaging，获取矿石连续波段光谱信息。",
  ),
  (
    key: "onnx",
    short: "ONNX",
    long: "开放神经网络交换格式",
    description: "Open Neural Network Exchange，用于跨平台模型推理部署。",
  ),
  (
    key: "as-ratio",
    short: "A/S",
    long: "铝硅比",
    description: "精矿品质评价的关键指标之一。",
  ),
)

#let init-glossary(doc) = {
  show: make-glossary
  doc
}

#let register-report-glossary() = {
  register-glossary(glossary-entries)
}

#let print-glossary-block() = {
  pagebreak(weak: true)
  block(width: 100%, above: space-chapter)[
    #box(width: 100%, fill: color-accent-surface, inset: (x: 10pt, y: 6pt))[
      #text(font: heading-font, size: size-h1, weight: "black", fill: color-ink)[术语与缩写]
    ]
    #v(space-block)
    #print-glossary(glossary-entries, show-all: true)
  ]
}
