File tree Expand file tree Collapse file tree 1 file changed +21
-19
lines changed
crates/mdbook-html/src/html Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -306,25 +306,7 @@ where
306306 trace ! ( "event={event:?}" ) ;
307307 match event {
308308 Event :: Start ( tag) => self . start_tag ( tag) ,
309- Event :: End ( tag) => {
310- // TODO: This should validate that the event stack is
311- // properly synchronized with the tag stack.
312- self . pop ( ) ;
313- match tag {
314- TagEnd :: TableHead => {
315- self . table_state = TableState :: Body ;
316- self . push ( Node :: Element ( Element :: new ( "tbody" ) ) ) ;
317- }
318- TagEnd :: TableCell => {
319- self . table_cell_index += 1 ;
320- }
321- TagEnd :: Table => {
322- // Pop tbody or thead
323- self . pop ( ) ;
324- }
325- _ => { }
326- }
327- }
309+ Event :: End ( tag) => self . end_tag ( tag) ,
328310 Event :: Text ( text) => {
329311 self . append_text ( text. into_tendril ( ) ) ;
330312 }
@@ -600,6 +582,26 @@ where
600582 self . push ( Node :: Element ( element) ) ;
601583 }
602584
585+ fn end_tag ( & mut self , tag : TagEnd ) {
586+ // TODO: This should validate that the event stack is
587+ // properly synchronized with the tag stack.
588+ self . pop ( ) ;
589+ match tag {
590+ TagEnd :: TableHead => {
591+ self . table_state = TableState :: Body ;
592+ self . push ( Node :: Element ( Element :: new ( "tbody" ) ) ) ;
593+ }
594+ TagEnd :: TableCell => {
595+ self . table_cell_index += 1 ;
596+ }
597+ TagEnd :: Table => {
598+ // Pop tbody or thead
599+ self . pop ( ) ;
600+ }
601+ _ => { }
602+ }
603+ }
604+
603605 /// Given some HTML, parse it into [`Node`] elements and append them to
604606 /// the current node.
605607 fn append_html ( & mut self , html : & str ) {
You can’t perform that action at this time.
0 commit comments