lsg

Lumidify Site Generator
git clone git://lumidify.org/lsg.git (fast, but not encrypted)
git clone https://lumidify.org/git/lsg.git (encrypted, but very slow)
Log | Files | Refs | README | LICENSE

commit 60cba53ab7684b466185fd3886fb19d22b688e53
parent 07da68d9e0b5a2bb62bf7540dfecfc7df5ee7117
Author: lumidify <nobody@lumidify.org>
Date:   Sat,  7 Oct 2023 09:48:04 +0200

Fix edge case with book sorting

Diffstat:
MLSG/UserFuncs.pm | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/LSG/UserFuncs.pm b/LSG/UserFuncs.pm @@ -41,8 +41,14 @@ sub sort_numeric { if ($i > $#s2) { return 1; } - if ($s1[$i] ne $s2[$i]) { - return ($s1[$i] =~ /\d+/ && $s2[$i] =~ /\d+/) ? $s1[$i] <=> $s2[$i] : $s1[$i] cmp $s2[$i]; + # 01 and 1 should compare the same, so numbers + # need '!=' instead of 'ne' like the strings + if ($s1[$i] =~ /\d+/ && $s2[$i] =~ /\d+/) { + if ($s1[$i] != $s2[$i]) { + return $s1[$i] <=> $s2[$i]; + } + } elsif ($s1[$i] ne $s2[$i]) { + return $s1[$i] cmp $s2[$i]; } } if ($#s2 > $#s1) {