@@ 184-277 (lines=94) @@ | ||
181 | assert json.loads(json.dumps(src)) == dest |
|
182 | ||
183 | ||
184 | def test_div_with_id(): |
|
185 | init() |
|
186 | ||
187 | meta = { |
|
188 | 'pandoc-latex-environment': { |
|
189 | 'c': { |
|
190 | 'test': { |
|
191 | 'c': [ |
|
192 | { |
|
193 | 'c': [ |
|
194 | { |
|
195 | 'c': 'class1', |
|
196 | 't': 'Str' |
|
197 | } |
|
198 | ], |
|
199 | 't': 'MetaInlines' |
|
200 | }, |
|
201 | { |
|
202 | 'c': [ |
|
203 | { |
|
204 | 'c': 'class2', |
|
205 | 't': 'Str' |
|
206 | } |
|
207 | ], |
|
208 | 't': 'MetaInlines' |
|
209 | } |
|
210 | ], |
|
211 | 't': 'MetaList' |
|
212 | } |
|
213 | }, |
|
214 | 't': 'MetaMap' |
|
215 | } |
|
216 | } |
|
217 | ||
218 | src = json.loads(json.dumps(Div( |
|
219 | [ |
|
220 | 'identifier', |
|
221 | [ |
|
222 | 'class1', |
|
223 | 'class2' |
|
224 | ], |
|
225 | [] |
|
226 | ], |
|
227 | [ |
|
228 | { |
|
229 | 'c': [ |
|
230 | { |
|
231 | 'c': 'content', |
|
232 | 't': 'Str' |
|
233 | } |
|
234 | ], |
|
235 | 't': 'Plain' |
|
236 | } |
|
237 | ] |
|
238 | ))) |
|
239 | dest = json.loads(json.dumps(Div( |
|
240 | [ |
|
241 | 'identifier', |
|
242 | [ |
|
243 | 'class1', |
|
244 | 'class2' |
|
245 | ], |
|
246 | [] |
|
247 | ], |
|
248 | [ |
|
249 | { |
|
250 | 'c': [ |
|
251 | 'tex', |
|
252 | '\\begin{test} \\label{identifier}' |
|
253 | ], |
|
254 | 't': 'RawBlock' |
|
255 | }, |
|
256 | { |
|
257 | 'c': [ |
|
258 | { |
|
259 | 'c': 'content', |
|
260 | 't': 'Str' |
|
261 | } |
|
262 | ], |
|
263 | 't': 'Plain' |
|
264 | }, |
|
265 | { |
|
266 | 'c': [ |
|
267 | 'tex', |
|
268 | '\\end{test}' |
|
269 | ], |
|
270 | 't': 'RawBlock' |
|
271 | } |
|
272 | ] |
|
273 | ))) |
|
274 | ||
275 | pandoc_latex_environment.environment(src['t'], src['c'], 'latex', meta) |
|
276 | ||
277 | assert json.loads(json.dumps(src)) == dest |
|
278 | ||
279 | ||
280 | def test_div_with_title(): |
|
@@ 13-106 (lines=94) @@ | ||
10 | if hasattr(pandoc_latex_environment.getDefined, 'value'): |
|
11 | delattr(pandoc_latex_environment.getDefined, 'value') |
|
12 | ||
13 | def test_div(): |
|
14 | init() |
|
15 | ||
16 | meta = { |
|
17 | 'pandoc-latex-environment': { |
|
18 | 'c': { |
|
19 | 'test': { |
|
20 | 'c': [ |
|
21 | { |
|
22 | 'c': [ |
|
23 | { |
|
24 | 'c': 'class1', |
|
25 | 't': 'Str' |
|
26 | } |
|
27 | ], |
|
28 | 't': 'MetaInlines' |
|
29 | }, |
|
30 | { |
|
31 | 'c': [ |
|
32 | { |
|
33 | 'c': 'class2', |
|
34 | 't': 'Str' |
|
35 | } |
|
36 | ], |
|
37 | 't': 'MetaInlines' |
|
38 | } |
|
39 | ], |
|
40 | 't': 'MetaList' |
|
41 | } |
|
42 | }, |
|
43 | 't': 'MetaMap' |
|
44 | } |
|
45 | } |
|
46 | ||
47 | src = json.loads(json.dumps(Div( |
|
48 | [ |
|
49 | '', |
|
50 | [ |
|
51 | 'class1', |
|
52 | 'class2' |
|
53 | ], |
|
54 | [] |
|
55 | ], |
|
56 | [ |
|
57 | { |
|
58 | 'c': [ |
|
59 | { |
|
60 | 'c': 'content', |
|
61 | 't': 'Str' |
|
62 | } |
|
63 | ], |
|
64 | 't': 'Plain' |
|
65 | } |
|
66 | ] |
|
67 | ))) |
|
68 | dest = json.loads(json.dumps(Div( |
|
69 | [ |
|
70 | '', |
|
71 | [ |
|
72 | 'class1', |
|
73 | 'class2' |
|
74 | ], |
|
75 | [] |
|
76 | ], |
|
77 | [ |
|
78 | { |
|
79 | 'c': [ |
|
80 | 'tex', |
|
81 | '\\begin{test}' |
|
82 | ], |
|
83 | 't': 'RawBlock' |
|
84 | }, |
|
85 | { |
|
86 | 'c': [ |
|
87 | { |
|
88 | 'c': 'content', |
|
89 | 't': 'Str' |
|
90 | } |
|
91 | ], |
|
92 | 't': 'Plain' |
|
93 | }, |
|
94 | { |
|
95 | 'c': [ |
|
96 | 'tex', |
|
97 | '\\end{test}' |
|
98 | ], |
|
99 | 't': 'RawBlock' |
|
100 | } |
|
101 | ] |
|
102 | ))) |
|
103 | ||
104 | pandoc_latex_environment.environment(src['t'], src['c'], 'latex', meta) |
|
105 | ||
106 | assert json.loads(json.dumps(src)) == dest |
|
107 | ||
108 | def test_empty(): |
|
109 | init() |
|
@@ 108-181 (lines=74) @@ | ||
105 | ||
106 | assert json.loads(json.dumps(src)) == dest |
|
107 | ||
108 | def test_empty(): |
|
109 | init() |
|
110 | ||
111 | meta = { |
|
112 | 'pandoc-latex-environment': { |
|
113 | 'c': { |
|
114 | 'test': { |
|
115 | 'c': [ |
|
116 | { |
|
117 | 'c': [ |
|
118 | { |
|
119 | 'c': 'class1', |
|
120 | 't': 'Str' |
|
121 | } |
|
122 | ], |
|
123 | 't': 'MetaInlines' |
|
124 | }, |
|
125 | { |
|
126 | 'c': [ |
|
127 | { |
|
128 | 'c': 'class2', |
|
129 | 't': 'Str' |
|
130 | } |
|
131 | ], |
|
132 | 't': 'MetaInlines' |
|
133 | } |
|
134 | ], |
|
135 | 't': 'MetaList' |
|
136 | } |
|
137 | }, |
|
138 | 't': 'MetaMap' |
|
139 | } |
|
140 | } |
|
141 | ||
142 | src = json.loads(json.dumps(Div( |
|
143 | [ |
|
144 | '', |
|
145 | [], |
|
146 | [] |
|
147 | ], |
|
148 | [ |
|
149 | { |
|
150 | 'c': [ |
|
151 | { |
|
152 | 'c': 'content', |
|
153 | 't': 'Str' |
|
154 | } |
|
155 | ], |
|
156 | 't': 'Plain' |
|
157 | } |
|
158 | ] |
|
159 | ))) |
|
160 | dest = json.loads(json.dumps(Div( |
|
161 | [ |
|
162 | '', |
|
163 | [], |
|
164 | [] |
|
165 | ], |
|
166 | [ |
|
167 | { |
|
168 | 'c': [ |
|
169 | { |
|
170 | 'c': 'content', |
|
171 | 't': 'Str' |
|
172 | } |
|
173 | ], |
|
174 | 't': 'Plain' |
|
175 | } |
|
176 | ] |
|
177 | ))) |
|
178 | ||
179 | pandoc_latex_environment.environment(src['t'], src['c'], 'latex', meta) |
|
180 | ||
181 | assert json.loads(json.dumps(src)) == dest |
|
182 | ||
183 | ||
184 | def test_div_with_id(): |