Add support for various text formats

finchie
Oct 31, 2023, 4:11 PM
JCYJWUI32EEUQVQBLUNTSWZI6OXZJIRQMDU72DXWTJVU2LJJ6QWQC

Dependencies

  • [2] RAWT2FQS Nest Xilem tuples longer than 10 elements
  • [3] BSJYWOYS Implement MVP Typst embedding
  • [4] BA5Y6VSE Output Rust code using `syn`
  • [5] 2N3KOCP7 Create MVP Pandoc->Rust compiler
  • [6] GYTRFADR Support Typst subdirectories

Change contents

  • replacement in crates/typst_rust_gen/src/lib.rs at line 52
    [3.1122][3.1122:1261](),[3.1309][3.1382:1558](),[3.1558][2.34:106](),[2.106][3.1576:1622](),[3.1576][3.1576:1622](),[3.1622][3.1163:1169]()
    struct ElementBlock<'a> {
    name: &'a str,
    expression: syn::Expr,
    }
    impl ElementBlock<'_> {
    fn method_call(self) -> syn::Expr {
    let expr_call = syn::ExprCall {
    attrs: Vec::new(),
    func: Box::new(expr_path(self.name)),
    paren_token: syn::token::Paren::default(),
    args: Punctuated::from_iter([self.expression].into_iter()),
    };
    syn::Expr::Call(expr_call)
    }
    [3.1122]
    [3.1169]
    fn xilem_html_element(name: &str, expression: syn::Expr) -> syn::Expr {
    syn::Expr::Call(syn::ExprCall {
    attrs: Vec::new(),
    func: Box::new(expr_path(name)),
    paren_token: syn::token::Paren::default(),
    args: Punctuated::from_iter([expression].into_iter()),
    })
  • replacement in crates/typst_rust_gen/src/lib.rs at line 329
    [3.10669][3.3860:3890](),[3.3860][3.3860:3890]()
    let block = match block {
    [3.10669]
    [3.3890]
    match block {
  • replacement in crates/typst_rust_gen/src/lib.rs at line 334
    [3.2143][3.4012:4145]()
    ElementBlock {
    name: header_level.into(),
    expression: transformed_inlines,
    }
    [3.2143]
    [3.2211]
    xilem_html_element(header_level.into(), transformed_inlines)
  • replacement in crates/typst_rust_gen/src/lib.rs at line 338
    [3.2321][3.4193:4310]()
    ElementBlock {
    name: "p",
    expression: transformed_inlines,
    }
    [3.2321]
    [3.2380]
    xilem_html_element("p", transformed_inlines)
  • replacement in crates/typst_rust_gen/src/lib.rs at line 341
    [3.2412][3.4311:4343]()
    };
    block.method_call()
    [3.2412]
    [3.2418]
    }
  • edit in crates/typst_rust_gen/src/lib.rs at line 358
    [2.245]
    [2.245]
    }
    pandoc_ast::Inline::LineBreak => xilem_html_element("br", transform_inlines(&Vec::new())),
    pandoc_ast::Inline::Subscript(inlines) => {
    xilem_html_element("sub", transform_inlines(inlines))
  • edit in crates/typst_rust_gen/src/lib.rs at line 363
    [2.255]
    [3.2579]
    pandoc_ast::Inline::Superscript(inlines) => {
    xilem_html_element("sup", transform_inlines(inlines))
    }
    pandoc_ast::Inline::Emph(inlines) => xilem_html_element("b", transform_inlines(inlines)),
    pandoc_ast::Inline::Underline(inlines) => {
    xilem_html_element("u", transform_inlines(inlines))
    }
    pandoc_ast::Inline::Strikeout(inlines) => {
    xilem_html_element("s", transform_inlines(inlines))
    }
  • replacement in docs/test.typ at line 2
    [3.251][3.251:268]()
    Hello from typst!
    [3.251]
    Hello from _typst_!\
    This is #underline[important].\
    #strike[this was important]\
    Testing scripts#sub[sub]#super[super]