Mercurial > hg > lxmldump
comparison lxmldump.py @ 74:f1fd5a53c341
Fix URLs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Dec 2021 11:04:20 +0200 |
parents | 4e27677ca5a9 |
children | cac40b08c555 |
comparison
equal
deleted
inserted
replaced
73:4e27677ca5a9 | 74:f1fd5a53c341 |
---|---|
311 | 311 |
312 | 312 |
313 ## Format a "Ptr" node as text | 313 ## Format a "Ptr" node as text |
314 def pkk_ptr_to_text(pnode): | 314 def pkk_ptr_to_text(pnode): |
315 pfmt = pkk_get_fmt("ptr_fmt") | 315 pfmt = pkk_get_fmt("ptr_fmt") |
316 | |
316 ptext = ("".join(pnode.itertext())).strip() | 317 ptext = ("".join(pnode.itertext())).strip() |
317 if pkk_cfg.annotate: | 318 if pkk_cfg.annotate: |
318 ptext = re.sub(r'\s*\.\s*$', '', ptext) | 319 ptext = re.sub(r'\s*\.\s*$', '', ptext) |
320 | |
321 phref = pnode.attrib["{http://www.w3.org/TR/xlink}href"].replace(" ", "+") | |
322 | |
319 return pfmt.format( | 323 return pfmt.format( |
320 text=ptext, | 324 text=ptext, |
321 href=pnode.attrib["{http://www.w3.org/TR/xlink}href"]) | 325 href=phref) |
322 | 326 |
323 | 327 |
324 ## Get text inside a given node | 328 ## Get text inside a given node |
325 def pkk_node_to_text(lnode): | 329 def pkk_node_to_text(lnode): |
326 stmp = "" | 330 stmp = "" |