summaryrefslogtreecommitdiffstats
path: root/cnhttp.go
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2017-08-24 17:10:26 +0200
committerclsr <clsr@clsr.net>2017-08-24 17:10:26 +0200
commited64d2fb11b4833a8dcbe29225f90bf6462dc8ad (patch)
tree437d66567ebb4fdaee6ccc5b67f64d5c00323d91 /cnhttp.go
parent28398c213bc6a798108421f79659e7d97ca9dbc2 (diff)
downloadcn-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.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)...)
}