예제 #1
0
 def test_basic_conversion(self):
     assert (
         convert("!http://www.example.com/image.png!") ==
         "![http://www.example.com/image.png](http://www.example.com/image.png)"
     )
     assert convert("!attached-image.gif!"
                    ) == "![attached-image.gif](attached-image.gif)"
예제 #2
0
 def test_multiline(self):
     assert convert("{noformat}\npreformatted piece\nof text\n{noformat}"
                    ) == "```\npreformatted piece\nof text\n```"
     assert (convert(
         "{noformat}\n\n\n  preformatted piece\n   of text\n\n{noformat}")
             == "```\n  preformatted piece\n   of text\n```")
     assert (convert(
         "{noformat}  \n  \n  preformatted piece\n   of text\n{noformat}")
             == "```\n  \n  \n  preformatted piece\n   of text\n```")
예제 #3
0
 def test_subscript_color(self):
     assert (
         convert("~text {color:blue}~text inside~{color} outside~")
         == '<sub>text <font color="blue"><sub>text inside</sub></font> outside</sub>'
     )
     assert (
         convert("~text {color:blue}contains~ token{color} outside~")
         == '<sub>text <font color="blue">contains~ token</font> outside</sub>'
     )
예제 #4
0
 def test_strikethrough_color(self):
     assert (
         convert("-text {color:green}-text inside-{color} outside-")
         == '~~text <font color="green">~~text inside~~</font> outside~~'
     )
     assert (
         convert("-text {color:green}contains- token{color} outside-")
         == '~~text <font color="green">contains- token</font> outside~~'
     )
예제 #5
0
 def test_bold_color(self):
     assert (
         convert("*text {color:red}*text inside*{color} outside*")
         == '**text <font color="red">**text inside**</font> outside**'
     )
     assert (
         convert("*text {color:red}contains* token{color} outside*")
         == r'**text <font color="red">contains\* token</font> outside**'
     )
예제 #6
0
 def test_underline_color(self):
     assert (
         convert("+text {color:blue}+text inside+{color} outside+")
         == 'text <font color="blue">text inside</font> outside'
     )
     assert (
         convert("+text {color:blue}contains+ token{color} outside+")
         == 'text <font color="blue">contains+ token</font> outside'
     )
예제 #7
0
 def test_superscript_color(self):
     assert (
         convert("^text {color:blue}^text inside^{color} outside^")
         == '<sup>text <font color="blue"><sup>text inside</sup></font> outside</sup>'
     )
     assert (
         convert("^text {color:blue}contains^ token{color} outside^")
         == '<sup>text <font color="blue">contains^ token</font> outside</sup>'
     )
예제 #8
0
 def test_inlinequote_color(self):
     assert (
         convert("??text {color:blue}??text inside??{color} outside??")
         == '<q>text <font color="blue"><q>text inside</q></font> outside</q>'
     )
     assert (
         convert("??text {color:blue}contains?? token{color} outside??")
         == '<q>text <font color="blue">contains?? token</font> outside</q>'
     )
예제 #9
0
    def test_list_color_list(self):
        assert (
            convert(
                """
* Item
** Second
*** {color:red}


Some text
{color}
**** Four
"""
            )
            == """
- Item
  - Second
    - <font color="red">
      
      
      Some text
      </font>
      - Four
"""
        )
        assert (
            convert(
                """
# Item
## Second
### {color:red}


Some text
{color}
#### Four
"""
            )
            == """
1. Item
   1. Second
      1. <font color="red">
         
         
         Some text
         </font>
         1. Four
"""
        )
예제 #10
0
    def test_start_indent(self):
        assert (
            convert(
                """
# First
## Second

## One
### Two

# Last
## One
"""
            )
            == """
1. First
   1. Second

## One
### Two

1. Last
   1. One
"""
        )
예제 #11
0
    def test_title(self):
        assert (convert("""
{panel:title=My Title}
Some text with a title
{panel}
""") == """
> **My Title**
> Some text with a title
""")
예제 #12
0
    def test_basic_conversion(self):
        assert (convert("""
{panel}
  Some text
       more line
{panel}
""") == """
> Some text
> more line
""")
예제 #13
0
    def test_multiple_parameters(self):
        assert (convert("""
{panel:borderStyle=dashed|borderColor=#ccc|title=My Title|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
a block of text
surrounded with a panel
{panel}
""") == """
> **My Title**
> a block of text
> surrounded with a panel
""")
예제 #14
0
    def test_list_panel_list(self):
        assert (
            convert(
                """
* Item
** Second
*** {panel}


Some quote
{panel}
**** Four
"""
            )
            == """
- Item
  - Second
    - > Some quote
      - Four
"""
        )
        assert (
            convert(
                """
# Item
## Second
### {panel}


Some quote
{panel}
#### Four
"""
            )
            == """
1. Item
   1. Second
      1. > Some quote
         1. Four
"""
        )
예제 #15
0
    def test_list_blockquote(self):
        assert (
            convert(
                """
* Item
** Second
*** {quote}


Some quote
{quote}
**** Four
"""
            )
            == """
- Item
  - Second
    - > Some quote
      - Four
"""
        )
        assert (
            convert(
                """
# Item
## Second
### {quote}


Some quote
{quote}
#### Four
"""
            )
            == """
1. Item
   1. Second
      1. > Some quote
         1. Four
"""
        )
예제 #16
0
    def test_broken_list_markup(self):
        assert (
            convert(
                """
----- Hello, -World-! -----
"""
            )
            == """
----- Hello, ~~World~~! -----
"""
        )
        assert (
            convert(
                """
-- 
Hello
{quote}
World
{quote}
"""
            )
            == """
– 
Hello
> World
"""
        )
        assert (
            convert(
                """
--------- 

-- 
"""
            )
            == """
--------- 

– 
"""
        )
예제 #17
0
    def test_multiple_parameters(self):
        assert (convert("""
{noformat:borderStyle=dashed|borderColor=#ccc|title=My Title|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
a block of code
surrounded with a noformat
{noformat}
""") == """
```
a block of code
surrounded with a noformat
```
""")
예제 #18
0
    def test_default_language(self):
        assert (convert("""
{code}
def test_code():
    assert convert(...)
{code}
""") == """
```Java
def test_code():
    assert convert(...)
```
""")
예제 #19
0
    def test_empty_list(self):
        assert (
            convert(
                """
# 
## 
        """
            )
            == r"""
1. 
   1. 
        """
        )
예제 #20
0
    def test_text_indent(self):
        assert (
            convert(
                """
Some text
* 
"""
            )
            == """
Some text

- 
"""
        )
예제 #21
0
    def test_explicit_language(self):
        assert (convert("""
{code:xml}
    <test>
        <another tag="attribute"/>
    </test>
{code}
""") == """
```xml
    <test>
        <another tag="attribute"/>
    </test>
```
""")
예제 #22
0
    def test_bullets(self):
        assert (
            convert(
                """
* some
* bullet
** indented
** bullets
* points
        """
            )
            == """
- some
- bullet
  - indented
  - bullets
- points
        """
        )
        assert (
            convert(
                """
- some
- bullet
-- indented
-- bullets
- points
        """
            )
            == """
- some
- bullet
  - indented
  - bullets
- points
        """
        )
예제 #23
0
    def test_start_indent(self):
        assert (
            convert(
                """
* First
** Second

** One
*** Two

* Last
** One
"""
            )
            == r"""
- First
  - Second

\*\* One
\*\*\* Two

- Last
  - One
"""
        )
        assert (
            convert(
                """
-- One
--- Two
"""
            )
            == """
– One
— Two
"""
        )
예제 #24
0
    def test_list(self):
        assert (
            convert(
                """
{quote}
* Item
** Line
{quote}
"""
            )
            == """
> - Item
>   - Line
"""
        )
예제 #25
0
    def test_indent_step(self):
        assert (
            convert(
                """
# one
## two
#### four
"""
            )
            == r"""
1. one
   1. two
#### four
"""
        )
예제 #26
0
    def test_mixed_bullets(self):
        assert (
            convert(
                """
#* nested
#** bullet
#** list
        """
            )
            == """
   - nested
     - bullet
     - list
        """
        )
예제 #27
0
    def test_list(self):
        assert (
            convert(
                """
{panel}
* Item
** Line
{panel}
"""
            )
            == """
> - Item
>   - Line
"""
        )
예제 #28
0
    def test_indent_step(self):
        assert (
            convert(
                """
* one
** two
**** four
"""
            )
            == r"""
- one
  - two
\*\*\*\* four
"""
        )
예제 #29
0
    def test_mixed_bullets(self):
        assert (
            convert(
                """
*# nested
*## numbered
*## list
        """
            )
            == """
  1. nested
     1. numbered
     1. list
        """
        )
예제 #30
0
    def test_text_formatting(self):
        assert (
            convert(
                """
{panel:title=My Title|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
a block of text surrounded with a *panel*
line with !image.png|width=300!
{panel}
"""
            )
            == """
> **My Title**
> a block of text surrounded with a **panel**
> line with ![image.png](image.png)
"""
        )