blob: 0645e415096e6eef33c44b4646f6e0ca32511347 (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
discard """
output: '''
[Suite] RST include directive
'''
"""
# tests for rst module
import ../../lib/packages/docutils/rstgen
import ../../lib/packages/docutils/rst
import unittest
import os
suite "RST include directive":
test "Include whole":
"other.rst".writeFile("**test1**")
let input = ".. include:: other.rst"
doAssert "<strong>test1</strong>" == rstTohtml(input, {}, defaultConfig())
removeFile("other.rst")
test "Include starting from":
"other.rst".writeFile("""
And this should **NOT** be visible in `docs.html`
OtherStart
*Visible*
""")
let input = """
.. include:: other.rst
:start-after: OtherStart
"""
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
removeFile("other.rst")
test "Include everything before":
"other.rst".writeFile("""
*Visible*
OtherEnd
And this should **NOT** be visible in `docs.html`
""")
let input = """
.. include:: other.rst
:end-before: OtherEnd
"""
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
removeFile("other.rst")
test "Include everything between":
"other.rst".writeFile("""
And this should **NOT** be visible in `docs.html`
OtherStart
*Visible*
OtherEnd
And this should **NOT** be visible in `docs.html`
""")
let input = """
.. include:: other.rst
:start-after: OtherStart
:end-before: OtherEnd
"""
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
removeFile("other.rst")
test "Ignore premature ending string":
"other.rst".writeFile("""
OtherEnd
And this should **NOT** be visible in `docs.html`
OtherStart
*Visible*
OtherEnd
And this should **NOT** be visible in `docs.html`
""")
let input = """
.. include:: other.rst
:start-after: OtherStart
:end-before: OtherEnd
"""
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
removeFile("other.rst")
|