1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

improvements to numbering logic edge case detection

This commit is contained in:
Harvey Kandola 2018-01-09 17:47:26 +00:00
parent a13b631a7e
commit 049b83e0b9

View file

@ -34,7 +34,10 @@ func Numberize(pages []Page) {
}
if p.Level == prevPageLevel {
parts[len(parts)-1]++
j := len(parts) - 1
if j >= 0 {
parts[j]++
}
}
if p.Level < prevPageLevel {
@ -48,7 +51,9 @@ func Numberize(pages []Page) {
if i < 0 {
i = 0
}
parts[i]++
if i >= 0 && i < len(parts) {
parts[i]++
}
}
}