inline-xml

Crates.ioinline-xml
lib.rsinline-xml
version0.3.2
sourcesrc
created_at2023-03-05 12:43:39.383465
updated_at2023-05-18 01:46:03.268857
descriptionEmbed XML data directly in your Rust code
homepage
repositoryhttps://git.stuerz.xyz/rustcloud/inline-xml
max_upload_size
id801314
size71,496
Benjamin Stürz (realchonk)

documentation

README

inline-xml

Inline XML data directly into your Rust code.

Example

use inline_xml::xml;

fn main() {
    let value = 42;
    let html = xml! {
        <html>
            <head>
                <title>Example</title>
            </head>
            <body>
                <h1>Example</h1>
                <p>Hello World</p>
                <p>Value: {value}</p>
            </body>
        </html>
    };
    
    println!("{html}");
}

Syntax issues

Since Rust will tokenize the input and proc_macro_span is not stabilized, whitespace will be discarded and therefore inline_xml has to guess about where to put whitespace when printing.

TODO

  • Eliminate usage of Content::Nested completely
  • More documentation
  • Mention, in the docs, that struct Xml can take multiple tags
  • Make struct Tag an instance of trait ToXml
  • Arg -> Attr, args -> attrs
  • Fix XML injection for attributes
  • Fix interpretation of floating point literals
  • Somehow produce XML & DTD declarations (probably as a format arg)
  • Namespaces (eg. <a:x>asdf</a:x>)
Commit count: 0

cargo fmt