getProps: centralize 2 (#10837)

Centralize and optimize handling document properties.
This commit is contained in:
hius07
2023-08-30 07:53:59 +03:00
committed by GitHub
parent 38d468f36c
commit 1ef7821b66
23 changed files with 189 additions and 239 deletions

View File

@@ -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