You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Page numbers, serial numbers, etc. may have leading zeros (e.g., 011), or have whitespaces before the number (e.g., GB/T 7714).
Sometimes, it is important to keep these zeros and whitespaces:
011 might mean the 11th file on shelf 0, but 11 might mean the 1st file on shelf 1.
T in GB/T 7714 means Recommend. It has nothing to do with 7714.
…
However, Hayagrive 0.9.1 / Typst v0.14.2 ignores whitespaces and leading zeros when parsing numeric values. As a result, they get trimmed unexpectedly.
When parsing a numeric value, Hayagriva first matches a non-whitespace prefix, and eat whitespaces before num. Therefore, whitespaces between prefix and value are ignored.
Also, according to the survey Hayagriva对GB/T 7714—2015的支持情况, this issue accounts for 15% (code_space, whitespace) + 8% (num, leading zero) = 23% of all errors.
(Sorry the survey is not available in English at present.)
Note
That survey is based on CSL-JSON. It specifies "type": "standard" in CSL-JSON to match type="standard" in the CSL style.
However, it's impossible to match type="standard" from *.bib or *.yaml at present, according to the following line.
Page numbers, serial numbers, etc. may have leading zeros (e.g.,
011), or have whitespaces before the number (e.g.,GB/T 7714).Sometimes, it is important to keep these zeros and whitespaces:
011might mean the 11th file on shelf 0, but11might mean the 1st file on shelf 1.TinGB/T 7714means Recommend. It has nothing to do with 7714.However, Hayagrive 0.9.1 / Typst v0.14.2 ignores whitespaces and leading zeros when parsing numeric values. As a result, they get trimmed unexpectedly.
Example
GB/X 03792GB/X3792The built-in
gb-7714-2015-numericstyle is also affected.Current logic
Numeric values are parsed into
Numeric { prefix, value, suffix }.hayagriva/src/types/numeric.rs
Lines 15 to 24 in a137441
The
valueis stored asi32, so leading zeros are ignored.hayagriva/src/types/numeric.rs
Lines 344 to 351 in a137441
When parsing a numeric value, Hayagriva first matches a non-whitespace prefix, and eat whitespaces before
num. Therefore, whitespaces betweenprefixandvalueare ignored.hayagriva/src/types/numeric.rs
Lines 244 to 252 in a137441
hayagriva/src/types/numeric.rs
Lines 327 to 336 in a137441
Links
Misc?) entries with URL are recognized aswebpage(ingb-7714-2015-numeric?) #312 (comment) mentioned the disappearance of whitespaces.is-numeric="volume"for第1卷should be false #439 is another bug ofNumeric::from_str. It also futher links to the citeproc-js reference implementation.Importance
Also, according to the survey Hayagriva对GB/T 7714—2015的支持情况, this issue accounts for 15% (
code_space, whitespace) + 8% (num, leading zero) = 23% of all errors.(Sorry the survey is not available in English at present.)
Note
That survey is based on CSL-JSON. It specifies
"type": "standard"in CSL-JSON to matchtype="standard"in the CSL style.However, it's impossible to match
type="standard"from*.bibor*.yamlat present, according to the following line.hayagriva/src/csl/taxonomy.rs
Line 663 in a137441