diff options
author | clsr <clsr@clsr.net> | 2017-08-24 17:10:26 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2017-08-24 17:10:26 +0200 |
commit | ed64d2fb11b4833a8dcbe29225f90bf6462dc8ad (patch) | |
tree | 437d66567ebb4fdaee6ccc5b67f64d5c00323d91 /cnhttp.go | |
parent | 28398c213bc6a798108421f79659e7d97ca9dbc2 (diff) | |
download | cn-http-ed64d2fb11b4833a8dcbe29225f90bf6462dc8ad.tar.gz cn-http-ed64d2fb11b4833a8dcbe29225f90bf6462dc8ad.zip |
Update to cnm-go 0.2.0v0.1.4
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)...) } |