コード例 #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)
コード例 #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")))
コード例 #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")))
コード例 #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")))
コード例 #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")))
コード例 #6
0
 def test_matched_before_unmatched_asterisk(self):
     self.assert_process("*matched* before *unmatched",
                         "{matched} before *unmatched".format(matched=Ansi.bold("matched")))
コード例 #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")))
コード例 #8
0
 def test_bold_word(self):
     self.assert_process("a bold *word* inside",
                         "a bold {word} inside".format(word=Ansi.bold("word")))