handle nested lists properly
All checks were successful
CI/CD Pipeline / deploy-main (push) Successful in 7s
All checks were successful
CI/CD Pipeline / deploy-main (push) Successful in 7s
This commit is contained in:
10
src/main.rs
10
src/main.rs
@ -10,9 +10,13 @@ fn print_content(content: Content) -> String {
|
||||
Content::List(l) => {
|
||||
ret.push_str("<ul class='content list'>");
|
||||
for item in l {
|
||||
ret.push_str("<li>");
|
||||
ret.push_str(&print_content(item));
|
||||
ret.push_str("</li>");
|
||||
if let Content::List(_) = item {
|
||||
ret.push_str(&print_content(item));
|
||||
} else {
|
||||
ret.push_str("<li>");
|
||||
ret.push_str(&print_content(item));
|
||||
ret.push_str("</li>");
|
||||
}
|
||||
}
|
||||
ret.push_str("</ul>");
|
||||
}
|
||||
|
Reference in New Issue
Block a user