예제 #1
0
 def find_text(iter):
     next = iter.next()
     text = ""
     if next[0] == TEXT:
         text = next[1]
     skip_to_end_token(token_iter, STRONG)
     return text
예제 #2
0
    def _task_from_tokens(self, tokens, isopen=True, tags=[], parent=None):
        # Collect text and returns task

        text = []
        tags = set(tags)  # copy

        token_iter = iter(tokens)
        for t in token_iter:
            if t[0] == TEXT:
                text.append(t[1])
            elif t[0] == TAG:
                tags.add(t[1]['name'])
            elif t[0] == STRIKE:
                skip_to_end_token(token_iter, STRIKE)
            else:
                pass  # ignore all other markup

        return self._task_from_text(''.join(text), isopen, tags, parent)