mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
getProps: centralize 2 (#10837)
Centralize and optimize handling document properties.
This commit is contained in:
@@ -51,23 +51,6 @@ function DjvuDocument:updateColorRendering()
|
||||
end
|
||||
end
|
||||
|
||||
function DjvuDocument:getProps()
|
||||
local props = self._document:getMetadata()
|
||||
local _, _, docname = self.file:find(".*/(.*)")
|
||||
docname = docname or self.file
|
||||
|
||||
-- According to djvused(1), the convention is that
|
||||
-- BibTex keys are always lowercase and DocInfo capitalized
|
||||
props.title = props.title or props.Title or docname:match("(.*)%.")
|
||||
props.authors = props.author or props.Author
|
||||
props.series = props.series or props.Series
|
||||
props.language = props.language or props.Language
|
||||
props.keywords = props.keywords or props.Keywords
|
||||
props.description = props.description or props.Description
|
||||
|
||||
return props
|
||||
end
|
||||
|
||||
function DjvuDocument:comparePositions(pos1, pos2)
|
||||
return self.koptinterface:comparePositions(self, pos1, pos2)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user