mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
mod: add html support in crereader
This commit is contained in:
@@ -16,6 +16,9 @@ end
|
||||
function CREReader:open(filename)
|
||||
local ok
|
||||
local file_type = string.lower(string.match(filename, ".+%.([^.]+)"))
|
||||
if file_type == "html" then
|
||||
file_type = "htm"
|
||||
end
|
||||
local style_sheet = "./data/"..file_type..".css"
|
||||
ok, self.doc = pcall(cre.openDocument, filename, style_sheet,
|
||||
width, height)
|
||||
|
||||
@@ -54,7 +54,11 @@ function FileChooser:readDir()
|
||||
table.insert(self.dirs, f)
|
||||
else
|
||||
local file_type = string.lower(string.match(f, ".+%.([^.]+)") or "")
|
||||
if file_type == "djvu" or file_type == "pdf" or file_type == "xps" or file_type == "cbz" or file_type == "epub" or file_type == "txt" or file_type == "rtf" or file_type == "htm" or file_type == "fb2" or file_type == "chm" then
|
||||
if file_type == "djvu"
|
||||
or file_type == "pdf" or file_type == "xps" or file_type == "cbz"
|
||||
or file_type == "epub" or file_type == "txt" or file_type == "rtf"
|
||||
or file_type == "htm" or file_type == "html"
|
||||
or file_type == "fb2" or file_type == "chm" then
|
||||
table.insert(self.files, f)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,6 +38,7 @@ function FileSearcher:readDir()
|
||||
or file_type == "xps" or file_type == "cbz"
|
||||
or file_type == "epub" or file_type == "txt"
|
||||
or file_type == "rtf" or file_type == "htm"
|
||||
or file_type == "html"
|
||||
or file_type == "fb2" or file_type == "chm" then
|
||||
file_entry = {dir=d, name=f,}
|
||||
table.insert(self.files, file_entry)
|
||||
|
||||
@@ -43,7 +43,7 @@ function openFile(filename)
|
||||
reader = DJVUReader
|
||||
elseif file_type == "pdf" or file_type == "xps" or file_type == "cbz" then
|
||||
reader = PDFReader
|
||||
elseif file_type == "epub" or file_type == "txt" or file_type == "rtf" or file_type == "htm" or file_type == "fb2" or file_type == "chm" then
|
||||
elseif file_type == "epub" or file_type == "txt" or file_type == "rtf" or file_type == "htm" or file_type == "html" or file_type == "fb2" or file_type == "chm" then
|
||||
reader = CREReader
|
||||
end
|
||||
if reader then
|
||||
|
||||
Reference in New Issue
Block a user