Changes in [630:25295ceb11b1:633:5d1534bd19b3] in documentViewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
MpiwgXmlTextServer.py
r613 r632 304 304 textParams['outputFormat'] = 'html' 305 305 306 307 306 308 try: 307 309 # fetch the page 310 311 312 313 308 314 pagexml = self.getServerData("query/GetPage",urllib.urlencode(textParams)) 309 315 dom = ET.fromstring(pagexml) … … 372 378 # delete non-matching children of a-tag and suppress remaining tag name 373 379 atag = wtag.find("*[@class='dictionary']") 380 381 if atag is None: #nicht gefunden weil noch andere Eintraege im class tag 382 for w in wtag.findall("a"): 383 val = w.attrib.get("class","") 384 if val.startswith("dictionary"): 385 atag=w 386 break 387 388 389 390 391 374 392 if normMode == 'orig': 375 393 atag.remove(atag.find("span[@class='reg']")) … … 387 405 else: 388 406 # delete a-tag 389 wtag.remove(wtag.find("*[@class='dictionary']")) 407 408 409 wt = wtag.find("*[@class='dictionary']") 410 411 if wt is None: #nicht gefunden weil noch andere Eintraege im class tag vorhanden sind 412 for w in wtag.findall("a"): 413 val = w.attrib.get("class","") 414 if val.startswith("dictionary"): 415 wt=w 416 break 417 418 419 420 421 wtag.remove(wt) 390 422 # delete non-matching children and suppress remaining tag name 391 423 if normMode == 'orig': -
css/docuviewer.css
r629 r632 4 4 * Robert Casties 2012. 5 5 */ 6 7 8 .iliese { 9 background-color: lime; 10 } 11 12 13 6 14 body { 7 15 background-color: #ebebeb; -
documentViewer.py
r629 r631 19 19 from SrvTxtUtils import getInt, utf8ify, getText, getHttpData, refreshingImageFileIndexHtml, sslifyUrl 20 20 21 22 INDEXMETA_NS="http://md.mpiwg-berlin.mpg.de/ns/indexMeta#" 23 24 def removeINDEXMETA_NS(root): #entfernt den namespace von indexmeta aus dem dom #TODO evertyhing should be changed that it can deal with NS 25 for elem in root.getiterator(): 26 print ("ETAG") 27 print(elem.tag) 28 if not hasattr(elem.tag, 'find'): continue # (1) 29 30 i = elem.tag.find('{%s}'%INDEXMETA_NS) 31 if i >= 0: 32 elem.tag = elem.tag[i+len(('{%s}'%INDEXMETA_NS)):] 33 34 print(elem.tag) 21 35 22 36 def getMDText(node): … … 530 544 # url points to document dir or index.meta 531 545 metaDom = self.metadataService.getDomFromPathOrUrl(url) 546 removeINDEXMETA_NS(metaDom) 547 532 548 if metaDom is None: 533 549 raise IOError("Unable to find index.meta for mode=texttool!") … … 536 552 if url.startswith('/mpiwg/online/'): 537 553 docUrl = url.replace('/mpiwg/online/', '', 1) 554 elif mode=="textpath": 555 #url points to an textfile 556 #index.meta optional 557 #assume index.meta in parent dir 558 docUrl = getParentPath(url) 559 docinfo['viewmode'] = "text" 560 561 try: 562 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 563 564 removeINDEXMETA_NS(metaDom) 565 566 567 568 except: 569 metaDom = None 570 #metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 571 #docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) 572 docinfo['textURLPath'] = url.replace('/mpiwg/online', '', 1) 573 docinfo['textURL'] = url 574 if docinfo.get("creator", None) is None: 575 docinfo['creator'] = "" 576 577 if docinfo.get("title", None) is None: 578 docinfo['title'] = "" 579 580 if docinfo.get("documentPath", None) is None: 581 docinfo['documentPath'] = url.replace('/mpiwg/online', '', 1) 582 docinfo['documentPath'] = url.replace('/pages', '', 1) 583 584 docinfo['numPages'] = 1 538 585 539 586 elif mode=="imagepath": 540 587 # url points to folder with images, index.meta optional 541 588 # asssume index.meta in parent dir 542 docUrl = getParentPath(url)589 543 590 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 591 544 592 docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) 545 593 … … 575 623 docinfo['documentUrl'] = docUrl 576 624 # process index.meta contents 577 if metaDom is not None and metaDom.tag == 'resource': 625 626 if metaDom is not None and (metaDom.tag == 'resource' or metaDom.tag == "{%s}resource"%INDEXMETA_NS): 627 print("MD") 578 628 # document directory name and path 579 629 resource = self.metadataService.getResourceData(dom=metaDom, recursive=1) 580 630 if resource: 581 631 docinfo = self.getDocinfoFromResource(docinfo, resource) 582 632 583 633 # texttool info 584 634 texttool = self.metadataService.getTexttoolData(dom=metaDom, recursive=1, all=True)
Note: See TracChangeset
for help on using the changeset viewer.