]> git.r.bdr.sh - rbdr/page/blobdiff - src/gemini_parser.rs
Use sections instead of divs
[rbdr/page] / src / gemini_parser.rs
index a7c752e7bf1d6a7e3b1c8c32c269c5acbaebb5e9..496dc0d4126b2da3be23bff25ba2904a6892007e 100644 (file)
@@ -89,9 +89,9 @@ fn get_full_line_content(line_type: &LineType, line: &str) -> String {
         LineType::Link => {
             let url = get_link_address(line);
             if url.starts_with("gemini:") {
         LineType::Link => {
             let url = get_link_address(line);
             if url.starts_with("gemini:") {
-                format!("<div><a href=\"{}\">{}</a></div>\n", url, get_link_content(line))
+                format!("<p class=\"a\"><a href=\"{}\">{}</a></p>\n", url, get_link_content(line))
             } else {
             } else {
-                format!("<div><a href=\"{}\">{}</a></div>\n", url.replace(".gmi", ".html"), get_link_content(line))
+                format!("<p class=\"a\"><a href=\"{}\">{}</a></p>\n", url.replace(".gmi", ".html"), get_link_content(line))
             }
         },
         LineType::Heading1 => format!("<h1>{}</h1>\n", encoded_line[1..].trim()),
             }
         },
         LineType::Heading1 => format!("<h1>{}</h1>\n", encoded_line[1..].trim()),
@@ -119,14 +119,14 @@ fn get_heading_wrapper(heading_stack: &mut Vec<u8>, line_type: &LineType) -> Str
                 break;
             }
 
                 break;
             }
 
-            string.push_str("</div>");
+            string.push_str("</section>");
 
             if open_heading == current_heading {
                 break;
             }
         }
         heading_stack.push(current_heading);
 
             if open_heading == current_heading {
                 break;
             }
         }
         heading_stack.push(current_heading);
-        string.push_str(&format!("<div class=\"h{}\">", current_heading));
+        string.push_str(&format!("<section class=\"h{}\">", current_heading));
     }
 
     return string;
     }
 
     return string;
@@ -135,7 +135,7 @@ fn get_heading_wrapper(heading_stack: &mut Vec<u8>, line_type: &LineType) -> Str
 fn close_heading_wrapper(heading_stack: &mut Vec<u8>) -> String {
     let mut string = String::new();
     while let Some(_open_heading) = heading_stack.pop() {
 fn close_heading_wrapper(heading_stack: &mut Vec<u8>) -> String {
     let mut string = String::new();
     while let Some(_open_heading) = heading_stack.pop() {
-        string.push_str("</div>");
+        string.push_str("</section>");
     }
     return string;
 }
     }
     return string;
 }