Mercurial > hg > documentViewer
changeset 632:4a75a760def2
dictionary handling added
author | Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 02 Jul 2015 10:29:50 +0200 |
parents | 0c3aab828864 |
children | 5d1534bd19b3 |
files | MpiwgXmlTextServer.py css/docuviewer.css |
diffstat | 2 files changed, 41 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/MpiwgXmlTextServer.py Thu Jul 02 10:27:05 2015 +0200 +++ b/MpiwgXmlTextServer.py Thu Jul 02 10:29:50 2015 +0200 @@ -303,8 +303,14 @@ textmode = 'plain' textParams['outputFormat'] = 'html' + + try: # fetch the page + + + + pagexml = self.getServerData("query/GetPage",urllib.urlencode(textParams)) dom = ET.fromstring(pagexml) except Exception, e: @@ -371,6 +377,18 @@ wtag.remove(wtag.find("span[@class='nodictionary norm']")) # delete non-matching children of a-tag and suppress remaining tag name atag = wtag.find("*[@class='dictionary']") + + if atag is None: #nicht gefunden weil noch andere Eintraege im class tag + for w in wtag.findall("a"): + val = w.attrib.get("class","") + if val.startswith("dictionary"): + atag=w + break + + + + + if normMode == 'orig': atag.remove(atag.find("span[@class='reg']")) atag.remove(atag.find("span[@class='norm']")) @@ -386,7 +404,21 @@ else: # delete a-tag - wtag.remove(wtag.find("*[@class='dictionary']")) + + + wt = wtag.find("*[@class='dictionary']") + + if wt is None: #nicht gefunden weil noch andere Eintraege im class tag vorhanden sind + for w in wtag.findall("a"): + val = w.attrib.get("class","") + if val.startswith("dictionary"): + wt=w + break + + + + + wtag.remove(wt) # delete non-matching children and suppress remaining tag name if normMode == 'orig': wtag.remove(wtag.find("span[@class='nodictionary reg']"))