Repository navigation
A typeset minus sign reads as negative, so "−3.2%" becomes -3.2 instead of no value - #1416
Merged
Merged
Conversation
…ad of no value Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
WaylandYang
approved these changes
Oct 25, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks, merging. It overlaps #1423 in scan_quantity, so that one will need a rebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Typeset text writes negative numbers with the minus sign U+2212 (
−), not the hyphen-minus-. Wikipedia's style requires it, and typeset PDFs and LaTeX output emit it. A model that copies a figure from such a passage into anumberattribute writes"−3.2%".scan_quantityreads only[-+0-9.,_]as number characters, so the number part is empty and nothing parses.normalize_attr_valueandattribute_valueboth returnNone. The statement keeps no typed value, and a fall in revenue or margin never reaches the typed graph.What changes
The number scan in
scan_quantityalso accepts−and reads it as-before parsing. Both readers, with and without a declared unit, go through this scan. No other character is added.How it was checked
Three assertions in
a_number_attribute_takes_a_written_quantity:normalize_attr_value("number", "−3.2%")is-3.2.normalize_attr_value("number", "−1,250")is-1250.attribute_value("number", Some("万元"), "−2.3亿元")is-23000.Results:
cargo test -p utopia-extract --lib: 111 passed.left: None,right: Some(Number(-3.2)).cargo fmt --all --checkandcargo clippy -p utopia-extract --all-targets -- -D warningspass.Before review
git commit -s)cargo fmt --all --check,cargo clippyandcargo testpass for the touched crate