def result(self): return self._template.substitute( block="\n".join(self._result), title=escape_latex(self._title), subtitle=escape_latex(self._subtitle), diagrams="", )
def visit_line(self, chords): line = [] for last, (chord, text) in indicate_last(chords): text = escape_latex(text) if chord is None: line.append(text) else: if text.isspace() or len(text) == 0: line.append("\guitarChord{%s}%s" % (chord + "|", "{ }" * len(text)) ) if last: line.append('\ ') else: if len(chord) >= len(text.strip()): if not text[-1].isspace(): if not last: chord += "_" text = "{%s}" % text else: chord += "|" text = "{%s}" % text line.append("\guitarChord{%s}%s" % (chord, text)) self._result.append("".join(line) + ('' if self._intab else '\\\\'))
def escape_latex(*args): (s,) = args args = (s.encode('UTF-8'),) val = _texcaller.escape_latex(*args) val = val.decode('UTF-8') return val
def visit_ci(self, comment): self._result.append("\\textit{%s}" % escape_latex(comment))