Concatenation that escapes if necessary and converts to string.
(seq: t.Iterable[t.Any])
| 73 | |
| 74 | |
| 75 | def markup_join(seq: t.Iterable[t.Any]) -> str: |
| 76 | """Concatenation that escapes if necessary and converts to string.""" |
| 77 | buf = [] |
| 78 | iterator = map(soft_str, seq) |
| 79 | for arg in iterator: |
| 80 | buf.append(arg) |
| 81 | if hasattr(arg, "__html__"): |
| 82 | return Markup("").join(chain(buf, iterator)) |
| 83 | return concat(buf) |
| 84 | |
| 85 | |
| 86 | def str_join(seq: t.Iterable[t.Any]) -> str: |