neutralts::utils

Function extract_blocks

Source
pub fn extract_blocks(raw_source: &str) -> Result<Vec<(usize, usize)>, usize>
Expand description

Extract same level blocks positions.


                 .-----> .-----> {:code:
                 |       |           {:code: ... :}
                 |       |           {:code: ... :}
                 |       |           {:code: ... :}
 Level block --> |       ·-----> :}
                 |        -----> {:code: ... :}
                 |       .-----> {:code:
                 |       |           {:code: ... :}
                 ·-----> ·-----> :}

# Arguments

* `raw_source` - A string slice containing the template source text.

# Returns

* `Ok(Vec<(usize, usize)>)`: A vector of tuples representing the start and end positions of each extracted block.
* `Err(usize)`: An error position if there are unmatched closing tags or other issues