mirror of
https://github.com/hkalexling/Mango.git
synced 2026-03-20 00:00:48 -04:00
Sort page alphanumerically
See https://ux.stackexchange.com/questions/95431/how-should-sorting-work-when-numeric-is-mixed-with-alpha-numeric
This commit is contained in:
@@ -2,6 +2,7 @@ require "zip"
|
||||
require "mime"
|
||||
require "json"
|
||||
require "uri"
|
||||
require "./util"
|
||||
|
||||
struct Image
|
||||
property data : Bytes
|
||||
@@ -44,7 +45,7 @@ class Entry
|
||||
["image/jpeg", "image/png"].includes? \
|
||||
MIME.from_filename? e.filename
|
||||
}
|
||||
.sort { |a, b| a.filename <=> b.filename }
|
||||
.sort { |a, b| compare_alphanumerically(split_by_alphanumeric(a.filename), split_by_alphanumeric(b.filename)) }
|
||||
.[page_num - 1]
|
||||
page.open do |io|
|
||||
slice = Bytes.new page.uncompressed_size
|
||||
|
||||
Reference in New Issue
Block a user