def add_text(self, buf, text, encode_newline=False):
        if not text:
            return;
        if self.encoding:
            buf.append("u'''")
        else:
            buf.append("'''")
        #text = re.sub(r"(['\\\\])", r"\\\1", text)
        text = Template._quote_rexp.sub(r"\\\1", text)
        if not encode_newline or text[-1] != "\n":
            buf.append(text)
            buf.append("''', ")
        elif len(text) >= 2 and text[-2] == "\r":
            buf.append(text[0:-2])
            buf.append("\\r\\n''', ")
        else:
            buf.append(text[0:-1])
            buf.append("\\n''', ")
dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/tenjin.py/Template.add_text/original