Revision 5015
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/xml_func.py | ||
---|---|---|
205 | 205 |
simplifying_funcs['_join'] = passthru |
206 | 206 |
simplifying_funcs['_join_words'] = passthru |
207 | 207 |
simplifying_funcs['_merge'] = passthru |
208 |
simplifying_funcs['_name'] = passthru |
|
209 | 208 |
|
210 | 209 |
def _first(node): |
211 | 210 |
'''Chooses the first param (after sorting by numeric param name)''' |
... | ... | |
334 | 333 |
return value |
335 | 334 |
funcs['_noCV'] = _noCV |
336 | 335 |
|
337 |
#### Names |
|
338 |
|
|
339 |
_name_parts_slices_items = [ |
|
340 |
('first', slice(None, 1)), |
|
341 |
('middle', slice(1, -1)), |
|
342 |
('last', slice(-1, None)), |
|
343 |
] |
|
344 |
name_parts_slices = dict(_name_parts_slices_items) |
|
345 |
name_parts = [name for name, slice_ in _name_parts_slices_items] |
|
346 |
|
|
347 |
def _name(items, node): |
|
348 |
items = dict(list(conv_items(strings.ustr, items))) |
|
349 |
parts = [] |
|
350 |
for part in name_parts: |
|
351 |
if part in items: parts.append(items[part]) |
|
352 |
if not parts: return None # pass None values through; handle no name parts |
|
353 |
return ' '.join(parts) |
|
354 |
funcs['_name'] = _name |
|
355 |
|
|
356 | 336 |
#### Angles |
357 | 337 |
|
358 | 338 |
def _compass(items, node): |
Also available in: Unified diff
xml_func.py: Removed no longer used _name(). Use _join_words() instead.