def render_inner(self, token): lines = [] line = [] for child in token.children: if child.__class__.__name__ == "LineBreak": if child.soft: line.append(RawText(" ")) else: lines.append(line) line = [] else: line.append(child) lines.append(line) return [self.reduce_line([self.render(j) for j in i]) for i in lines]
def __init__(self, match): self.username = match.group(1) self.children = (RawText(self.username), )
def __init__(self, match): content = match.group(self.parse_group) self.children = (RawText(content), ) self.target = content self.mailto = (0 and '@' in self.target ) and 'mailto' not in self.target.casefold()
def __init__(self, match): lines, open_info = match self.language = EscapeSequence.strip(open_info[2]) self.directive = EscapeSequence.strip(open_info[3]) self.children = (RawText(''.join(lines)), )
def raw_text(text: str) -> RawText: """Create a RawText token.""" return RawText(text)
def render_raw_text(self, token: RawText) -> str: if self.smart_typography: token.content = smartify(token.content) return super().render_raw_text(token)
def __init__(self, match_obj): self.children = (RawText(match_obj.group()), )