Changeset 517:aaacdf551f6f in documentViewer
- Timestamp:
- Mar 5, 2012, 6:11:59 PM (13 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MpdlXmlTextServer.py
r516 r517 72 72 73 73 74 def getTextInfo(self, docinfo=None):74 def getTextInfo(self, mode='', docinfo=None): 75 75 """reads document info, including page concordance, from text server""" 76 76 logging.debug("getDocInfo") 77 #TODO: check cached info 77 78 docpath = docinfo.get('textURLPath', None) 78 79 if docpath is None: 79 80 logging.error("getTextInfo: no textURLPath!") 80 81 return docinfo 81 82 82 83 # we need to set a result set size 83 84 pagesize = 10000 84 85 pn = 1 85 86 # fetch docinfo 86 pagexml = self.getServerData("doc-info.xql","document=%s& pageSize=%s&pn=%s"%(docpath,pagesize,pn))87 pagexml = self.getServerData("doc-info.xql","document=%s&info=%s&pageSize=%s&pn=%s"%(docpath,mode,pagesize,pn)) 87 88 dom = ET.fromstring(pagexml) 88 89 # all info in tag <document> … … 136 137 137 138 docinfo['pageNumbers'] = pages 138 logging.debug("got pageNumbers=%s"%repr(pages))139 #logging.debug("got pageNumbers=%s"%repr(pages)) 139 140 141 # toc 142 elif name == 'toc': 143 # contains tags with table of contents 144 # TODO: implement 145 pass 146 140 147 return docinfo 141 148 … … 164 171 elif dc == 'pageHeaderTitle': 165 172 pageinfo['pageHeaderTitle'] = div.text 166 167 # numFigureEntries 168 elif dc == 'countFigureEntries': 169 docinfo['numFigureEntries'] = getInt(div.text) 170 171 # numTocEntries 172 elif dc == 'countTocEntries': 173 # WTF: s1 = int(s)/30+1 174 docinfo['numTocEntries'] = getInt(div.text) 175 176 # numPlaces 177 elif dc == 'countPlaces': 178 docinfo['numPlaces'] = getInt(div.text) 179 180 # numTextPages 181 elif dc == 'countPages': 182 np = getInt(div.text) 183 if np > 0: 184 docinfo['numTextPages'] = np 185 if docinfo.get('numPages', 0) == 0: 186 # seems to be text-only - update page count 187 docinfo['numPages'] = np 188 #pageinfo['end'] = min(pageinfo['end'], np) 189 pageinfo['numgroups'] = int(np / pageinfo['groupsize']) 190 if np % pageinfo['groupsize'] > 0: 191 pageinfo['numgroups'] += 1 192 173 193 174 #logging.debug("processPageInfo: pageinfo=%s"%repr(pageinfo)) 194 175 return
Note: See TracChangeset
for help on using the changeset viewer.