summaryrefslogtreecommitdiffstats
path: root/cnhttp.go
diff options
context:
space:
mode:
Diffstat (limited to 'cnhttp.go')
-rw-r--r--cnhttp.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/cnhttp.go b/cnhttp.go
index 8305de3..24b3bb5 100644
--- a/cnhttp.go
+++ b/cnhttp.go
@@ -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)...)
}