File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ pub enum PageElement {
1010 Preformatted ( String ) ,
1111 Text ( String ) ,
1212 Link ( String , Option < String > ) ,
13+ ListItem ( String ) ,
1314 Empty ,
1415}
1516
@@ -32,6 +33,8 @@ impl Parser {
3233 PageElement :: Heading ( line. to_string ( ) )
3334 } else if line. starts_with ( '>' ) {
3435 PageElement :: Quote ( line. to_string ( ) )
36+ } else if let Some ( stripped) = line. strip_prefix ( "* " ) {
37+ PageElement :: ListItem ( stripped. to_string ( ) )
3538 } else if let Some ( captures) = R_GEMINI_LINK . captures ( line) {
3639 match ( captures. name ( "href" ) , captures. name ( "label" ) ) {
3740 ( Some ( m_href) , Some ( m_label) ) if !m_label. as_str ( ) . is_empty ( ) => PageElement :: Link (
Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ impl Gemini {
187187 . apply_tag_by_name ( "a" , & self . text_buffer . iter_at_offset ( start) , text_iter) ;
188188 tag
189189 }
190+ pub fn insert_list_item ( & mut self , text_iter : & mut gtk:: TextIter , text : & str ) {
191+ self . insert_paragraph ( text_iter, " • " ) ;
192+ self . insert_paragraph ( text_iter, text) ;
193+ }
190194 pub fn clear ( & mut self ) {
191195 let b = & self . text_buffer ;
192196 b. delete ( & mut b. start_iter ( ) , & mut b. end_iter ( ) ) ;
Original file line number Diff line number Diff line change @@ -791,6 +791,9 @@ impl Tab {
791791 imp. links . borrow_mut ( ) . insert ( tag, url. clone ( ) ) ;
792792 }
793793 PageElement :: Preformatted ( _) => unreachable ! ( "handled before" ) ,
794+ PageElement :: ListItem ( text) => {
795+ gemini_text_ext. insert_list_item ( & mut text_iter, & text)
796+ }
794797 }
795798 }
796799 }
You can’t perform that action at this time.
0 commit comments