def postProcessing(units, mild=False): ''' proceses output of parseArtwork() and matches it to parameter names in ödok delinking plats, keeping track of artist link, fixing coords mild: leave plats as it was ''' for u in units: if u[u'koordinater'] and not u[u'koordinater'].strip().startswith('<ref>'): u[u'lat'], u[u'lon'] = common.latLonFromCoord(u[u'koordinater']) if u[u'skulptör']: u[u'skulptör'], u[u'skulptör_link'] = common.extractAllLinks(u[u'skulptör']) if u[u'plats'] and not mild: u[u'plats'], u[u'plats_link'] = common.extractAllLinks(u[u'plats']) if u[u'namn']: u[u'namn'], u[u'namn_link'] = common.extractAllLinks(u[u'namn'])
def postProcessing(units, mild=False): ''' proceses output of parseArtwork() and matches it to parameter names in ödok delinking plats, keeping track of artist link, fixing coords mild: leave plats as it was ''' for u in units: if u[u'koordinater'] and not u[u'koordinater'].strip().startswith( '<ref>'): u[u'lat'], u[u'lon'] = common.latLonFromCoord(u[u'koordinater']) if u[u'skulptör']: u[u'skulptör'], u[u'skulptör_link'] = common.extractAllLinks( u[u'skulptör']) if u[u'plats'] and not mild: u[u'plats'], u[u'plats_link'] = common.extractAllLinks(u[u'plats']) if u[u'namn']: u[u'namn'], u[u'namn_link'] = common.extractAllLinks(u[u'namn'])
def unwiki(wikitext): ''' takes wikiformated text and returns unformated text with any links sent separately :parm wikitext: wikitext to be processed :return: (text, links) text: unformated text links: a list of any links found in the text ''' if isinstance(wikitext, unicode): return common.extractAllLinks(wikitext, kill_tags=True) else: return wikitext, None