Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Year support for non-quad dates #81

Closed
iandol opened this issue Nov 15, 2023 · 2 comments
Closed

Year support for non-quad dates #81

iandol opened this issue Nov 15, 2023 · 2 comments

Comments

@iandol
Copy link

iandol commented Nov 15, 2023

I tried to use the following BibTeX entry:

@Book{lucretius50bce,
author = {Lucretius}, 
title = {On the Nature of Things}, 
year = {50 BCE}, }

And Typst chokes on it, asking on discord it appears a hayagriva limitation. Making it {0050 BCE} and parsing can continue. Supporting non-quad years would be great!

@JakobSachs
Copy link

I was able to replicate the file aswell, the error occurs also simply with a year = {50} or any number with more or less then 4 digits.
After taking a dive through the source code it seems to be an biblatex related issue, tho a fix in that library might require a change in src/types/time.rs:

/// Parse a string with a plus/minus and one to four digits into an integer.
fn parse_year(s: &mut Scanner) -> Result<i32, DateError> {
    parse_int(s, 1..=4).ok_or(DateError::UnknownFormat) // change the 4..=4 range to 1..=4 
}

@reknih
Copy link
Member

reknih commented Nov 24, 2023

I allowed an era marker in the year field if no sign (+, -) is specified. The year 0 CE/BCE does not exist. Hayagriva needs no parsing fixes since it is supposed to accept ISO standard dates which do not specify era markers, instead, the year 2 BCE is -0001 or -01.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants