Skip to content

Convert existing macros and styles #45

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

Open
bdarcus opened this issue Apr 15, 2023 · 0 comments
Open

Convert existing macros and styles #45

bdarcus opened this issue Apr 15, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bdarcus
Copy link
Owner

bdarcus commented Apr 15, 2023

A very high-priority, must-have, feature. And the quality has to be very good.

I doubt I have the time or skill to do it myself, however. So a PR would be welcome.

Details

I'm unsure exactly where and how to integrate this.

For style parsing, see citationberg from the typst folks. They've scaled it back to just be a CSL 1.0 parser, so can use here (see Style::from_xml).

use citationberg::Style;
use std::fs;
let style =
    citationberg::Style::from_xml(
      &fs::read_to_string("tests/independent/ieee.csl").unwrap()
    ).unwrap();
    
if let Style::Independent(independent) = style {
    assert_eq!(independent.info.title.value, "IEEE");
    // Get started processing your style!
} else {
    panic!("IEEE is an independent style");
}

The tricky part is then converting that internal model to this.

My first thought was this will be difficult, because of the significant differences.

OTOH, since I've simplified the template part on this end and constrained the options for things like sorting and substitution, it may not be too hard; possibly even easy?

I think the difficult part is likely to be the conditional.

It may make sense to look to simplify that too alongside this; to provide shortcuts, in effect, for common patterns (see note below on #29).

Another option

While we're at it, if it could work reliably, this more forward-looking idea might kill two birds with one stone:

  • bypass the XML syntax entirely, and just convert normalized output from existing processors into NEXT styles and templates
  • make style creation and maintenance going forward much easier for everyone; perhaps even making a centralized repository no longer particularly useful, or at least less labor-intensive

This second task is high complexity, very high reward, and would depend on #29.

See also project..

@bdarcus bdarcus added the enhancement New feature or request label Apr 15, 2023
@bdarcus bdarcus changed the title convert existing macros and styles Convert existing macros and styles Apr 15, 2023
@bdarcus bdarcus transferred this issue from bdarcus/csl-next Jun 6, 2023
@bdarcus bdarcus mentioned this issue Jul 16, 2023
@bdarcus bdarcus pinned this issue Oct 14, 2023
@bdarcus bdarcus added the help wanted Extra attention is needed label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Development

No branches or pull requests

1 participant