Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 632 Bytes

README.md

File metadata and controls

37 lines (30 loc) · 632 Bytes

Parsing ruby markup annotation

let text = "<ruby>同<rt>どう</ruby>ぜず。";
  println!("{:#?}", ruby(text));//will print out the ast
Ok(
    (
        "",
        Ruby {
            ruby_text: RubyText {
                kanji: "",
                annotation: "どう",
            },
            base_text: "ぜず。",
        },
    ),
)

Serialization

   let ruby = RubyElement::new(
            RubyElement::RubyText("同".to_string(), "どう".to_string()),
            "ぜず。".to_string(),
        );
    ruby.to_string();
<ruby>同<rt>どう</ruby>ぜず。