parse_lino_to_links

Function parse_lino_to_links 

Source
pub fn parse_lino_to_links(
    document: &str,
) -> Result<Vec<LiNo<String>>, ParseError>
Examples found in repository?
examples/indentation_test.rs (line 10)
3fn main() {
4    // Example with 2 spaces
5    let two_spaces = "parent:\n  child1\n  child2";
6    // Example with 4 spaces
7    let four_spaces = "parent:\n    child1\n    child2";
8
9    println!("=== Two Spaces ===");
10    match parse_lino_to_links(two_spaces) {
11        Ok(links) => {
12            println!("Parsed {} links:", links.len());
13            for (i, link) in links.iter().enumerate() {
14                println!("  Link {}: {:?}", i, link);
15            }
16        }
17        Err(e) => println!("Error: {:?}", e),
18    }
19
20    println!("\n=== Four Spaces ===");
21    match parse_lino_to_links(four_spaces) {
22        Ok(links) => {
23            println!("Parsed {} links:", links.len());
24            for (i, link) in links.iter().enumerate() {
25                println!("  Link {}: {:?}", i, link);
26            }
27        }
28        Err(e) => println!("Error: {:?}", e),
29    }
30}
More examples
Hide additional examples
examples/leading_spaces_test.rs (line 11)
3fn main() {
4    // Example with 2 leading spaces (from issue)
5    let with_leading = "  TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'\n  TELEGRAM_ALLOWED_CHATS:\n    -1002975819706\n    -1002861722681";
6
7    // Example without leading spaces (from issue)
8    let without_leading = "TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'\nTELEGRAM_ALLOWED_CHATS:\n  -1002975819706\n  -1002861722681";
9
10    println!("=== With Leading Spaces (2 spaces at root) ===");
11    match parse_lino_to_links(with_leading) {
12        Ok(links) => {
13            println!("Parsed {} links:", links.len());
14            for (i, link) in links.iter().enumerate() {
15                println!("  Link {}: {:?}", i, link);
16            }
17        }
18        Err(e) => println!("Error: {:?}", e),
19    }
20
21    println!("\n=== Without Leading Spaces (0 spaces at root) ===");
22    match parse_lino_to_links(without_leading) {
23        Ok(links) => {
24            println!("Parsed {} links:", links.len());
25            for (i, link) in links.iter().enumerate() {
26                println!("  Link {}: {:?}", i, link);
27            }
28        }
29        Err(e) => println!("Error: {:?}", e),
30    }
31}