diff options
| author | emilylime <emilyyyylime+git@gmail.com> | 2024-09-30 18:22:46 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-30 15:22:46 +0000 |
| commit | 1a24b29d86dfe72e0d3c7f79475c187ed4df5e5a (patch) | |
| tree | 280ecacae0fb11ed7eccc848c913b6f0238287f3 /crates/typst-pdf/src/page.rs | |
| parent | 7ff83db757330899576b50b87968ca86f2539f7b (diff) | |
Remove `Case`s from NumberingPatterns (#5059)
Diffstat (limited to 'crates/typst-pdf/src/page.rs')
| -rw-r--r-- | crates/typst-pdf/src/page.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/crates/typst-pdf/src/page.rs b/crates/typst-pdf/src/page.rs index 7eac69fc..f112c81c 100644 --- a/crates/typst-pdf/src/page.rs +++ b/crates/typst-pdf/src/page.rs @@ -9,7 +9,6 @@ use typst::foundations::Label; use typst::introspection::Location; use typst::layout::{Abs, Page}; use typst::model::{Destination, Numbering}; -use typst::text::Case; use crate::content; use crate::{ @@ -246,26 +245,23 @@ impl PdfPageLabel { return None; }; - let (prefix, kind, case) = pat.pieces.first()?; + let (prefix, kind) = pat.pieces.first()?; // If there is a suffix, we cannot use the common style optimisation, // since PDF does not provide a suffix field. - let mut style = None; - if pat.suffix.is_empty() { + let style = if pat.suffix.is_empty() { use {typst::model::NumberingKind as Kind, PdfPageLabelStyle as Style}; - match (kind, case) { - (Kind::Arabic, _) => style = Some(Style::Arabic), - (Kind::Roman, Case::Lower) => style = Some(Style::LowerRoman), - (Kind::Roman, Case::Upper) => style = Some(Style::UpperRoman), - (Kind::Letter, Case::Lower) if number <= 26 => { - style = Some(Style::LowerAlpha) - } - (Kind::Letter, Case::Upper) if number <= 26 => { - style = Some(Style::UpperAlpha) - } - _ => {} + match kind { + Kind::Arabic => Some(Style::Arabic), + Kind::LowerRoman => Some(Style::LowerRoman), + Kind::UpperRoman => Some(Style::UpperRoman), + Kind::LowerLatin if number <= 26 => Some(Style::LowerAlpha), + Kind::LowerLatin if number <= 26 => Some(Style::UpperAlpha), + _ => None, } - } + } else { + None + }; // Prefix and offset depend on the style: If it is supported by the PDF // spec, we use the given prefix and an offset. Otherwise, everything |
