diff options
Diffstat (limited to 'cnhttp.go')
-rw-r--r-- | cnhttp.go | 24 |
1 files changed, 2 insertions, 22 deletions
@@ -301,8 +301,7 @@ type site struct { func genToc(b cnm.Block) []tocSection { var res []tocSection - switch v := b.(type) { - case *cnm.SectionBlock: + if v, ok := b.(*cnm.SectionBlock); ok && v != nil { if t := v.Title(); t != "" { var ch []tocSection for _, c := range v.Children() { @@ -317,26 +316,7 @@ func genToc(b cnm.Block) []tocSection { res = append(res, genToc(bl)...) } } - case *cnm.TableBlock: - for _, bl := range v.Rows() { - res = append(res, genToc(bl)...) - } - case *cnm.HeaderBlock: - for _, bl := range v.Children() { - res = append(res, genToc(bl)...) - } - case *cnm.RowBlock: - for _, bl := range v.Children() { - res = append(res, genToc(bl)...) - } - case *cnm.ContentBlock: - if v == nil { - break - } - for _, bl := range v.Children() { - res = append(res, genToc(bl)...) - } - case *cnm.ListBlock: + } else if v, ok := b.(cnm.ContainerBlock); ok && v != nil { for _, bl := range v.Children() { res = append(res, genToc(bl)...) } |