diff options
author | clsr <clsr@clsr.net> | 2017-09-04 10:54:27 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2017-09-04 10:54:57 +0200 |
commit | cccc2fe128559c5edbf21e4da37e9d75a3429250 (patch) | |
tree | fc9f6ac0ab7c55e540b631b186a09bffcbf8574a /selector.go | |
parent | 47563c9f39db7f313d9e47e4f25c219fc6238d3c (diff) | |
download | cnm-go-cccc2fe128559c5edbf21e4da37e9d75a3429250.tar.gz cnm-go-cccc2fe128559c5edbf21e4da37e9d75a3429250.zip |
Update selectors to CNM 0.4v0.4.0
Diffstat (limited to 'selector.go')
-rw-r--r-- | selector.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/selector.go b/selector.go index 5259df2..ff1e7c1 100644 --- a/selector.go +++ b/selector.go @@ -128,7 +128,7 @@ func selectSearch(block Block, titles []string, any bool) ([]int, Block) { return []int{}, block } - if bl, ok := block.(*SectionBlock); ok { + if bl, ok := block.(*SectionBlock); ok && bl.Title() != "" { if len(titles) == 1 && bl.Title() == titles[0] { return []int{}, bl } @@ -162,7 +162,7 @@ func selectSectionIndex(block Block, secs []int) ([]int, Block) { if secs[0] < 1 { return nil, nil } - if cb, ok2 := c.(*SectionBlock); ok2 { + if cb, ok2 := c.(*SectionBlock); ok2 && cb.Title() != "" { secs[0]-- // starts with 1 for first section if secs[0] == 0 { if len(secs) == 1 { @@ -246,8 +246,8 @@ func duplicateBlock(block Block, deep, sections bool) Block { if cb != nil && deep { for _, ch := range block.(ContainerBlock).Children() { - _, isSection := ch.(*SectionBlock) - cb.AppendChild(duplicateBlock(ch, sections || !isSection, sections)) + sb, isSection := ch.(*SectionBlock) + cb.AppendChild(duplicateBlock(ch, sections || (!isSection || sb.Title() == ""), sections)) } } |