vimwiki_macros 0.1.0

Macro library that provides macros to generate vimwiki language at compile time.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::tokens::{utils::root_crate, Tokenize, TokenizeContext};
use proc_macro2::TokenStream;
use quote::quote;
use std::borrow::Cow;
use vimwiki_core::MathInline;

impl_tokenize!(tokenize_math_inline, MathInline<'a>, 'a);
fn tokenize_math_inline(
    ctx: &TokenizeContext,
    math_inline: &MathInline,
) -> TokenStream {
    let root = root_crate();
    let formula = do_tokenize!(ctx, Cow::Borrowed(math_inline.as_str()));
    quote! {
        #root::MathInline::new(#formula)
    }
}