append value to each nodes
(self, value)
| 1220 | return root, root_text |
| 1221 | |
| 1222 | def append(self, value): |
| 1223 | """append value to each nodes |
| 1224 | """ |
| 1225 | root, root_text = self._get_root(value) |
| 1226 | for i, tag in enumerate(self): |
| 1227 | if len(tag) > 0: # if the tag has children |
| 1228 | last_child = tag[-1] |
| 1229 | if not last_child.tail: |
| 1230 | last_child.tail = '' |
| 1231 | last_child.tail += root_text |
| 1232 | else: |
| 1233 | if not tag.text: |
| 1234 | tag.text = '' |
| 1235 | tag.text += root_text |
| 1236 | if i > 0: |
| 1237 | root = deepcopy(list(root)) |
| 1238 | tag.extend(root) |
| 1239 | return self |
| 1240 | |
| 1241 | @with_camel_case_alias |
| 1242 | def append_to(self, value): |
no test coverage detected