Changeset 575:f0e5e9c6737f in documentViewer
- Timestamp:
- Oct 16, 2012, 5:46:53 PM (12 years ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MpiwgXmlTextServer.py
r574 r575 205 205 'page': pn} 206 206 207 if 'characterNormalization' in pageinfo: 208 cn = pageinfo['characterNormalization'] 209 # TODO: change values in form 210 if cn == 'regPlusNorm': 211 cn = 'norm' 212 213 textParams['normalization'] = cn 214 207 normMode = pageinfo.get('characterNormalization', 'reg') 208 # TODO: change values in form 209 if normMode == 'regPlusNorm': 210 normMode = 'norm' 211 215 212 if not mode: 216 213 # default is dict … … 250 247 textParams['mode'] = 'untokenized' 251 248 textParams['outputFormat'] = 'xmlDisplay' 252 textParams['norm alization'] = 'orig'249 textParams['normMode'] = 'orig' 253 250 elif 'gis' in modes: 254 251 #FIXME! … … 256 253 else: 257 254 # text is default mode 258 textmode = ' text'255 textmode = 'plain' 259 256 textParams['mode'] = 'untokenized' 260 257 textParams['outputFormat'] = 'html' … … 269 266 270 267 # plain text or text-with-links mode 271 if textmode == " text" or textmode == "dict":268 if textmode == "plain" or textmode == "dict": 272 269 # the text is in div@class=text 273 270 pagediv = dom.find(".//div[@class='text']") 274 271 logging.debug("pagediv: %s"%repr(pagediv)) 275 272 if pagediv is not None: 273 # add textmode and normMode classes 274 pagediv.set('class', 'text %s %s'%(textmode, normMode)) 275 #self._processWTags(textmode, normMode, pagediv) 276 276 #self._processPbTag(pagediv, pageinfo) 277 277 self._processFigures(pagediv, docinfo) … … 343 343 return None 344 344 345 def _processWTags(self, textMode, normMode, pagediv): 346 """selects the necessary information from w-spans and removes the rest from pagediv""" 347 logging.debug("processWTags(textMode=%s,norm=%s,pagediv"%(repr(textMode),repr(normMode))) 348 wtags = pagediv.findall(".//span[@class='w']") 349 for wtag in wtags: 350 text = None 351 attr = None 352 if textMode == 'dict': 353 # take a-tag and matching child 354 attr = wtag.find('a').items() 355 text = wtag.find("a/span[@class='%s']"%normMode).text 356 else: 357 # take matching child 358 text = wtag.find("span[@class='nodictionary %s']"%normMode).text 359 360 if text: 361 # replace wtag by new content 362 logging.debug("new w-tag attr=%s text=%s"%(attr,text)) 363 wtag.clear() 364 365 if attr: 366 # make dictionary link 367 wtag.tag = 'a' 368 wtag.attrib.update(dict(attr)) 369 370 # text content 371 wtag.text = text 372 373 return pagediv 374 345 375 def _processPbTag(self, pagediv, pageinfo): 346 376 """extracts information from pb-tag and removes it from pagediv""" -
css/docuviewer.css
r573 r575 269 269 margin-bottom: 0.25em; 270 270 } 271 /* normalization forms */ 272 div.col.main div.content.text div.text.orig span.w span.reg, 273 div.col.main div.content.text div.text.orig span.w span.norm { 274 display: none; 275 } 276 div.col.main div.content.text div.text.reg span.w span.orig, 277 div.col.main div.content.text div.text.reg span.w span.norm { 278 display: none; 279 } 280 div.col.main div.content.text div.text.norm span.w span.orig, 281 div.col.main div.content.text div.text.norm span.w span.reg { 282 display: none; 283 } 284 /* dictionary forms */ 285 div.col.main div.content.text div.text.plain span.w a.dictionary { 286 display: none; 287 } 288 div.col.main div.content.text div.text.dict span.w span.nodictionary { 289 display: none; 290 } 271 291 /* page break */ 272 292 div.col.main div.content.text span.pb span.n,
Note: See TracChangeset
for help on using the changeset viewer.