Create parse_header

This commit is contained in:
2026-07-11 17:55:06 +02:00
parent ee581be01a
commit e7e156cdac
+11
View File
@@ -2,6 +2,17 @@ fn replace(text string, start int, len int, repl string) string {
return text[..start] + repl + text[start + len..] return text[..start] + repl + text[start + len..]
} }
fn parse_header(line string) (int, string) {
mut lvl := 0
for line[lvl] == '!'[0] { // Jestem geniuszem programowania
lvl++
}
if line[lvl+1] != ' '[0] { // String to u8 converter xd
return 0, line
}
return lvl, line[lvl + 1..]
}
fn parse(lines []string) string { fn parse(lines []string) string {
mut output := '<p>' mut output := '<p>'
for line in lines { for line in lines {