rshtml_core 0.5.0

RsHtml: A Template Engine for Seamless HTML and Rust Integration.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::Node;
use crate::parser::{IParser, RsHtmlParser, Rule};
use pest::error::Error;
use pest::iterators::Pair;

pub struct TextParser;

impl IParser for TextParser {
    fn parse(_: &mut RsHtmlParser, pair: Pair<Rule>) -> Result<Node, Box<Error<Rule>>> {
        let text = pair.as_str().replace("@@", "@");
        Ok(Node::Text(text))
    }
}