summaryrefslogtreecommitdiffstats
path: root/lang/python/python-docutils/test.sh
blob: 186335e836fff3c73158af16f187bb0a23b279b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

[ "$1" = python3-docutils ] || exit 0

python3 - << 'EOF'

import docutils.core
import docutils.parsers.rst

# Basic RST to HTML conversion
rst_input = """\
Hello World
===========

This is a **bold** paragraph with *italics*.

- item one
- item two
"""

html = docutils.core.publish_string(rst_input, writer_name="html")
html_str = html.decode("utf-8")

assert "Hello World" in html_str
assert "<strong>bold</strong>" in html_str
assert "<em>italics</em>" in html_str

EOF