Ejemplo n.º 1
0
    def testSphinxIndexBlock(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. index::

   single: eggs; installation
''')
        self.assertEqual('', convert.Convert())
Ejemplo n.º 2
0
    def testLinkToLink2(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _http://pydev.org/updates: http://pydev.org/updates
`http://pydev.org/updates`_''')
        self.assertEqual(
            '\n[http://pydev.org/updates|http://pydev.org/updates]',
            convert.Convert())
Ejemplo n.º 3
0
    def testBlock2(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
such as:
    ::
        An error
''')
        self.assertEqual('\nsuch as:\n{quote}\n\n        An error\n{quote}',
                         convert.Convert())
Ejemplo n.º 4
0
    def testConversion3(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _`A`: http://aa

b `A`_ b `A`_ b
''')
        self.assertEqual('\n\nb [A|http://aa] b [A|http://aa] b',
                         convert.Convert())
Ejemplo n.º 5
0
    def testBlock(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
::
    something
    something
''')
        self.assertEqual('\n{quote}\n\n    something\n    something\n{quote}',
                         convert.Convert())
Ejemplo n.º 6
0
    def testContents(self):
        convert = rst_2_wiki.ConvertRstToWiki("""
.. contents::
""")

        expected = '''
{toc:style=circle|minLevel=1|maxLevel=5}'''
        converted = convert.Convert()
        self.assertEqual(expected, converted, "Actual: %s" % converted)
Ejemplo n.º 7
0
    def testConversion4(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _`PyDev c`: pydev_certificate.cer

The first step for that is downloading the `PyDev c`_.
''')
        self.assertEqual(
            '\n\nThe first step for that is downloading the [PyDev c|pydev_certificate.cer].',
            convert.Convert())
Ejemplo n.º 8
0
    def testImage(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. image :: images/update_sites.png
   :class: snap
   :align: center 
''')
        self.assertEqual(
            '\n!http://pydev.org/images/update_sites.png|border=1!',
            convert.Convert())
Ejemplo n.º 9
0
    def testConversion2(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _`Aptana Studio 3`: http://aptana.com/products/studio3

bla `Aptana Studio 3`_ bla
''')
        self.assertEqual(
            '\n\nbla [Aptana Studio 3|http://aptana.com/products/studio3] bla',
            convert.Convert())
Ejemplo n.º 10
0
    def testCautionBlock(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. caution:: Caution notice

    Caution first line
    Caution second line
''')
        self.assertEqual(
            '\n{warning:title=Caution notice}\n\n\n    Caution first line\n    Caution second line\n{warning}',
            convert.Convert())
Ejemplo n.º 11
0
    def testNoteBlock(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. note :: Note title

    Note first line
    Note second line
''')
        self.assertEqual(
            '\n{note:title=Note title}\n\n\n    Note first line\n    Note second line\n{note}',
            convert.Convert())
Ejemplo n.º 12
0
    def testReplace(self):
        convert = rst_2_wiki.ConvertRstToWiki("""
|repl|
.. |repl| foo
""")

        expected = '''
.. foo
'''
        self.assertEqual(expected, convert.Convert())
Ejemplo n.º 13
0
    def testInlineLiteral(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
This is line with inline literals ``PATH``.
A Path: ``/etc/hosts`` and another ``?``inline
``foo1=bar1&foo2=bar2`` qwerty ``environ()``

''')
        self.assertEqual(
            '\nThis is line with inline literals {{PATH}}.\nA Path: {{/etc/hosts}} and another {{?}}inline\n{{foo1=bar1&foo2=bar2}} qwerty {{environ()}}\n',
            convert.Convert())
Ejemplo n.º 14
0
    def testIgnore(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
..
    ignore
    ignore

add this
========
''')
        self.assertEqual('\nh1. add this', convert.Convert())
Ejemplo n.º 15
0
    def testInlineLinks(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
* `Link text1 <http://example.net/>`_ some text
* `Link text2 <http://example.biz/>`_ some text
* `Link3 <http://example.org/>`_ and `Link4 <http://example.com/>`_

''')
        self.assertEqual(
            '\n* [Link text1|http://example.net/] some text\n* [Link text2|http://example.biz/] some text\n* [Link3|http://example.org/] and [Link4|http://example.com/]\n',
            convert.Convert())
Ejemplo n.º 16
0
    def testFigure(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. figure:: images/myfigure.png
   :target: _images/myfigure.png
   :scale: 85
   :alt: Figure X-Y. Figure description

   Figure X-Y. Figure description
''')
        self.assertEqual('\n!http://pydev.org/images/myfigure.png|border=1!',
                         convert.Convert())
Ejemplo n.º 17
0
    def testCodeBlock(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. sourcecode:: python

    a = 10
    b = 20
''')

        self.assertEqual(
            '\n{code:language=python}\n\n\n    a = 10\n    b = 20\n{code}',
            convert.Convert())
Ejemplo n.º 18
0
    def testInlineEmphasisAndStrong(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
Inline *emphasis* and inline **strong**.
More **about strong and** more about *emphasis markers*
Two *emphasis* entries, same *line*, doh!
Two **strong** in same **line**, doh!

''')
        self.assertEqual(
            '\nInline _emphasis_ and inline *strong*.\nMore *about strong and* more about _emphasis markers_\nTwo _emphasis_ entries, same _line_, doh!\nTwo *strong* in same *line*, doh!\n',
            convert.Convert())
Ejemplo n.º 19
0
    def testAnchor(self):
        convert = rst_2_wiki.ConvertRstToWiki("""
`my link`_

_`my link`
-------------------
""")

        expected = '''
[#my link]

h1. {anchor: my link}my link'''
        self.assertEqual(expected, convert.Convert())
Ejemplo n.º 20
0
    def testTableWithLinks(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _`itemA`: http://aa

:A:
    `itemA`_
''')

        expected = '''

||A:|    [itemA|http://aa]||'''

        self.assertEqual(expected, convert.Convert())
Ejemplo n.º 21
0
    def testTable(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
:A:

    itemA
:B:

    itemB
''')

        expected = '''
||A:|    itemA||
||B:|    itemB||'''

        self.assertEqual(expected, convert.Convert())
Ejemplo n.º 22
0
    def testCodeBlock2(self):
        convert = rst_2_wiki.ConvertRstToWiki("""
    .. sourcecode:: python

        a = 10
        b = 20
""")

        expected = '''
{code:language=python}


        a = 10
        b = 20
{code}'''
        self.assertEqual(expected, convert.Convert())
Ejemplo n.º 23
0
    def testLinkToLink(self):
        convert = rst_2_wiki.ConvertRstToWiki('''
.. _http://link: http://link
`http://link`_''')
        self.assertEqual('\n[http://link|http://link]', convert.Convert())