comparison MpdlXmlTextServer.py @ 475:5a3ab27385ce elementtree

more new template stuff
author casties
date Fri, 05 Aug 2011 19:04:20 +0200
parents 0bc4a153863a
children 1d93a8cb2d8f
comparison
equal deleted inserted replaced
474:0bc4a153863a 475:5a3ab27385ce
255 # numTocEntries 255 # numTocEntries
256 elif dc == 'countTocEntries': 256 elif dc == 'countTocEntries':
257 # WTF: s1 = int(s)/30+1 257 # WTF: s1 = int(s)/30+1
258 docinfo['numTocEntries'] = getInt(div.text) 258 docinfo['numTocEntries'] = getInt(div.text)
259 259
260 # numPlaces
261 elif dc == 'countPlaces':
262 docinfo['numPlaces'] = getInt(div.text)
263
260 # numTextPages 264 # numTextPages
261 elif dc == 'countPages': 265 elif dc == 'countPages':
262 np = getInt(div.text) 266 np = getInt(div.text)
263 if np > 0: 267 if np > 0:
264 docinfo['numTextPages'] = np 268 docinfo['numTextPages'] = np
300 if mode == "dict" or mode == "text_dict": 304 if mode == "dict" or mode == "text_dict":
301 # dict is called textPollux in the backend 305 # dict is called textPollux in the backend
302 textmode = "textPollux" 306 textmode = "textPollux"
303 elif not mode: 307 elif not mode:
304 # default is text 308 # default is text
309 mode = "text"
305 textmode = "text" 310 textmode = "text"
306 else: 311 else:
307 textmode = mode 312 textmode = mode
308 313
309 textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization) 314 textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)
338 l.set('href', href) 343 l.set('href', href)
339 344
340 return serialize(pagediv) 345 return serialize(pagediv)
341 346
342 # text-with-links mode 347 # text-with-links mode
343 elif mode == "text_dict": 348 elif mode == "dict":
344 if pagediv is not None: 349 if pagediv is not None:
345 # check all a-tags 350 # check all a-tags
346 links = pagediv.findall(".//a") 351 links = pagediv.findall(".//a")
347 for l in links: 352 for l in links:
348 href = l.get('href') 353 href = l.get('href')