-- Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz -- or its licensors, as applicable. -- -- You may not use this file except under the terms of the accompanying license. -- -- Licensed under the Apache License, Version 2.0 (the "License"); you -- may not use this file except in compliance with the License. You may -- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Project: ocroscript -- File: echo.lua -- Purpose: echo output -- Responsible: mezhirov -- Reviewer: -- Primary Repository: -- Web Sites: www.iupr.org, www.dfki.de, www.ocropus.org ------------------------------------------------------------------------------- local function imitate_class(class, base) class.__base__ = base class.new = function(self, ...) local object = {} self:__init__(object, ...) return object end class.__init__ = function(class, object, ...) if class.__base__ then class.__base__:__init__(object, ...) end for key, value in pairs(class) do object[key] = value end if object.create then object:create(...) end end setmetatable(class,{__call = class.new}) -- make C() be the same as C:new() end ------------------------------------------------------------------------------- local function output_hOCR_meta(header, meta, default) local t = header[meta] if not t then t = default end print(string.format(' ', meta, t)) end local function output_hOCR_title(header, default) local t = header.title if not t then t = default end print(string.format('
') print('
') paragraph = true end local text = nustring() if not headings[line] then self[line]:hocr_output(self) else -- here starts the headings bit if paragraph then -- close the paragraph print '
' end if line == 1 or not headings[line - 1] then print '' end self[line]:hocr_output() -- print the headings line if line == #self or not headings[line + 1] then print '' -- kt Adding beginning of paragraph print '' paragraph = true -- KT added this end -- kt setting this true. What happens? -- paragraph = true -- paragraph = false end -- kt for loop ends here: end -- KT we need to find another way if paragraph then -- close final paragraph -- -- print '
' end if self.time_report then print(string.format('', self.time_report)) end --KT: ending of page? -- print '