Ejemplo n.º 1
0
    def section(self, heading, paragraphs, delimiter='\n\n'):
        heading = Ansi.bold(heading.upper())

        body = list()
        for paragraph in paragraphs:
            paragraph.indent(self._indent_unit)
            body.append(self.wrap(paragraph))
        body = delimiter.join(body)
        return "{heading}\n{body}".format(heading=heading, body=body)
Ejemplo n.º 2
0
 def test_multiple_bold_words(self):
     self.assert_process("multiple *bold* words *inside* text",
                         "multiple {bold} words {inside} text".format(bold=Ansi.bold("bold"),
                                                                      inside=Ansi.bold("inside")))
Ejemplo n.º 3
0
 def test_escaped_backslash_in_front_of_bold(self):
     self.assert_process("escaped \\\\*backslash* before bold",
                         "escaped \\{backslash} before bold".format(backslash=Ansi.bold("backslash")))
Ejemplo n.º 4
0
 def test_escaped_symbols_in_bold_text(self):
     self.assert_process("escaped *symbols \\\\ \\* inside* bold text",
                         "escaped {symbols_inside} bold text".format(
                             symbols_inside=Ansi.bold("symbols \\ * inside")))
Ejemplo n.º 5
0
 def test_multiple_bold_before_unmatched_asterisk(self):
     self.assert_process("*first* and *second* before *unmatched",
                         "{first} and {second} before *unmatched".format(first=Ansi.bold("first"),
                                                                         second=Ansi.bold("second")))
Ejemplo n.º 6
0
 def test_matched_before_unmatched_asterisk(self):
     self.assert_process("*matched* before *unmatched",
                         "{matched} before *unmatched".format(matched=Ansi.bold("matched")))
Ejemplo n.º 7
0
 def test_escaped_and_matched_asterisk(self):
     self.assert_process("\\*escaped and *matched* asterisk",
                         "*escaped and {matched} asterisk".format(matched=Ansi.bold("matched")))
Ejemplo n.º 8
0
 def test_bold_word(self):
     self.assert_process("a bold *word* inside",
                         "a bold {word} inside".format(word=Ansi.bold("word")))