diff --git a/wani.py b/wani.py index 3fc185d..9a40078 100644 --- a/wani.py +++ b/wani.py @@ -177,9 +177,6 @@ class ComponentRepresentation: def render(self): if self.rendition_text is None: self.rendition_text = self._render() - - def rendition(self): - return "" if self.rendition_text is None else self.rendition_text def _render(self): raise NotImplementedError("Not implemented for class: {}".format(type(self))) @@ -502,8 +499,13 @@ class ComponentRendition: rep.render() for cid, reps in representations.items(): - rep = " ".join(rep.rendition() for rep in reps) - matches.representations[cid] = rep + reps = [rep.rendition_text for rep in reps] + if len(reps) == 0: + pass + elif all(r is None for r in reps): + matches.representations[cid] = None + else: + matches.representations[cid] = " ".join(("" if r is None else r) for r in reps) # # just need to set representation to first group, # # but in correct order, agreements last!