|
1
|
|
|
# This Python file uses the following encoding: utf-8 |
|
2
|
|
|
|
|
3
|
|
|
from unittest import TestCase |
|
4
|
|
|
from panflute import * |
|
5
|
|
|
|
|
6
|
|
|
import pandoc_numbering |
|
7
|
|
|
from helper import verify_conversion |
|
8
|
|
|
|
|
9
|
|
|
def test_listing_classic(): |
|
10
|
|
|
verify_conversion( |
|
11
|
|
|
''' |
|
12
|
|
|
--- |
|
13
|
|
|
pandoc-numbering: |
|
14
|
|
|
exercise: |
|
15
|
|
|
general: |
|
16
|
|
|
listing-title: List of exercises |
|
17
|
|
|
--- |
|
18
|
|
|
|
|
19
|
|
|
Exercise # |
|
20
|
|
|
|
|
21
|
|
|
Exercise (Title) # |
|
22
|
|
|
''', |
|
23
|
|
|
''' |
|
24
|
|
|
--- |
|
25
|
|
|
pandoc-numbering: |
|
26
|
|
|
exercise: |
|
27
|
|
|
general: |
|
28
|
|
|
listing-title: List of exercises |
|
29
|
|
|
--- |
|
30
|
|
|
|
|
31
|
|
|
List of exercises {.pandoc-numbering-listing .exercise} |
|
32
|
|
|
================= |
|
33
|
|
|
|
|
34
|
|
|
- [[Exercise 1]{.pandoc-numbering-entry .exercise}](#exercise:1) |
|
35
|
|
|
- [[Title]{.pandoc-numbering-entry .exercise}](#exercise:2) |
|
36
|
|
|
|
|
37
|
|
|
[**Exercise 1**]{#exercise:1 .pandoc-numbering-text .exercise} |
|
38
|
|
|
|
|
39
|
|
|
[**Exercise 2** *(Title)*]{#exercise:2 .pandoc-numbering-text .exercise} |
|
40
|
|
|
''' |
|
41
|
|
|
) |
|
42
|
|
|
|
|
43
|
|
|
def test_listing_latex(): |
|
44
|
|
|
verify_conversion( |
|
45
|
|
|
''' |
|
46
|
|
|
--- |
|
47
|
|
|
pandoc-numbering: |
|
48
|
|
|
exercise: |
|
49
|
|
|
general: |
|
50
|
|
|
listing-title: List of exercises |
|
51
|
|
|
--- |
|
52
|
|
|
|
|
53
|
|
|
Exercise # |
|
54
|
|
|
|
|
55
|
|
|
Exercise (Title) # |
|
56
|
|
|
''', |
|
57
|
|
|
''' |
|
58
|
|
|
--- |
|
59
|
|
|
pandoc-numbering: |
|
60
|
|
|
exercise: |
|
61
|
|
|
general: |
|
62
|
|
|
listing-title: List of exercises |
|
63
|
|
|
--- |
|
64
|
|
|
|
|
65
|
|
|
List of exercises {.pandoc-numbering-listing .exercise} |
|
66
|
|
|
================= |
|
67
|
|
|
|
|
68
|
|
|
\\hypersetup{linkcolor=black}\\makeatletter\\newcommand*\\l@exercise{\\@dottedtocline{1}{1.5em}{2.3em}}\\@starttoc{exercise}\\makeatother |
|
69
|
|
|
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {1}{\\ignorespaces {Exercise}}}[\\label{exercise:1}**Exercise 1**]{#exercise:1 .pandoc-numbering-text .exercise} |
|
70
|
|
|
|
|
71
|
|
|
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {2}{\\ignorespaces {Title}}}[\\label{exercise:2}**Exercise 2** *(Title)*]{#exercise:2 .pandoc-numbering-text .exercise} |
|
72
|
|
|
''', |
|
73
|
|
|
'latex' |
|
74
|
|
|
) |
|
75
|
|
|
|
|
76
|
|
|
def test_listing_classic_format(): |
|
77
|
|
|
verify_conversion( |
|
78
|
|
|
''' |
|
79
|
|
|
--- |
|
80
|
|
|
pandoc-numbering: |
|
81
|
|
|
exercise: |
|
82
|
|
|
general: |
|
83
|
|
|
listing-title: List of exercises |
|
84
|
|
|
standard: |
|
85
|
|
|
format-entry-classic: '%g %D' |
|
86
|
|
|
format-entry-title: '%g %D (%T)' |
|
87
|
|
|
--- |
|
88
|
|
|
|
|
89
|
|
|
Exercise # |
|
90
|
|
|
|
|
91
|
|
|
Exercise (Title) # |
|
92
|
|
|
''', |
|
93
|
|
|
''' |
|
94
|
|
|
--- |
|
95
|
|
|
pandoc-numbering: |
|
96
|
|
|
exercise: |
|
97
|
|
|
general: |
|
98
|
|
|
listing-title: List of exercises |
|
99
|
|
|
standard: |
|
100
|
|
|
format-entry-classic: '\%g %D' |
|
101
|
|
|
format-entry-title: '\%g %D (%T)' |
|
102
|
|
|
--- |
|
103
|
|
|
|
|
104
|
|
|
List of exercises {.pandoc-numbering-listing .exercise} |
|
105
|
|
|
================= |
|
106
|
|
|
|
|
107
|
|
|
- [[1 Exercise]{.pandoc-numbering-entry .exercise}](#exercise:1) |
|
108
|
|
|
- [[2 Exercise (Title)]{.pandoc-numbering-entry .exercise}](#exercise:2) |
|
109
|
|
|
|
|
110
|
|
|
[**Exercise 1**]{#exercise:1 .pandoc-numbering-text .exercise} |
|
111
|
|
|
|
|
112
|
|
|
[**Exercise 2** *(Title)*]{#exercise:2 .pandoc-numbering-text .exercise} |
|
113
|
|
|
''' |
|
114
|
|
|
) |
|
115
|
|
|
|
|
116
|
|
|
def test_listing_latex_format(): |
|
117
|
|
|
verify_conversion( |
|
118
|
|
|
''' |
|
119
|
|
|
--- |
|
120
|
|
|
pandoc-numbering: |
|
121
|
|
|
exercise: |
|
122
|
|
|
general: |
|
123
|
|
|
listing-title: List of exercises |
|
124
|
|
|
latex: |
|
125
|
|
|
entry-space: 3 |
|
126
|
|
|
entry-tab: 2 |
|
127
|
|
|
format-entry-classic: '%D' |
|
128
|
|
|
format-entry-title: '%D (%T)' |
|
129
|
|
|
toccolor: blue |
|
130
|
|
|
--- |
|
131
|
|
|
|
|
132
|
|
|
Exercise # |
|
133
|
|
|
|
|
134
|
|
|
Exercise (Title) # |
|
135
|
|
|
''', |
|
136
|
|
|
''' |
|
137
|
|
|
--- |
|
138
|
|
|
pandoc-numbering: |
|
139
|
|
|
exercise: |
|
140
|
|
|
general: |
|
141
|
|
|
listing-title: List of exercises |
|
142
|
|
|
latex: |
|
143
|
|
|
entry-space: 3 |
|
144
|
|
|
entry-tab: 2 |
|
145
|
|
|
format-entry-classic: '\%D' |
|
146
|
|
|
format-entry-title: '\%D (%T)' |
|
147
|
|
|
toccolor: blue |
|
148
|
|
|
--- |
|
149
|
|
|
|
|
150
|
|
|
List of exercises {.pandoc-numbering-listing .exercise} |
|
151
|
|
|
================= |
|
152
|
|
|
|
|
153
|
|
|
\\hypersetup{linkcolor=blue}\\makeatletter\\newcommand*\\l@exercise{\\@dottedtocline{1}{2.0em}{3.0em}}\\@starttoc{exercise}\\makeatother |
|
154
|
|
|
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {1}{\\ignorespaces {Exercise}}}[\\label{exercise:1}**Exercise 1**]{#exercise:1 .pandoc-numbering-text .exercise} |
|
155
|
|
|
|
|
156
|
|
|
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {2}{\\ignorespaces {Exercise (Title)}}}[\\label{exercise:2}**Exercise 2** *(Title)*]{#exercise:2 .pandoc-numbering-text .exercise} |
|
157
|
|
|
''', |
|
158
|
|
|
'latex' |
|
159
|
|
|
) |
|
160
|
|
|
|