Completed
Push — master ( 3949a6...8b9eb6 )
by Christophe
03:03
created

test_referencing_complex()   B

Complexity

Conditions 1

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 32
rs 8.8571
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_referencing_simple():
10
    verify_conversion(
11
        '''
12
Exercise #exercise:first
13
14
See [](#exercise:first)
15
        ''',
16
        '''
17
[**Exercise 1**]{#exercise:first .pandoc-numbering-text .exercise}
18
19
See [[Exercise 1]{.pandoc-numbering-link .exercise}](#exercise:first)
20
        '''
21
    )
22
23
def test_referencing_complex():
24
    verify_conversion(
25
        '''
26
Header
27
======
28
29
Section
30
-------
31
32
Exercise (First title) -.+.#exercise:first
33
34
Exercise (Second title) -.+.#exercise:second
35
36
See [%D %d %T %t %g %s %n #](#exercise:first)
37
38
See [%D %d %T %t %g %s %n #](#exercise:second)
39
        ''',
40
        '''
41
Header
42
======
43
44
Section
45
-------
46
47
[**Exercise 1.1** *(First title)*]{#exercise:first .pandoc-numbering-text .exercise}
48
49
[**Exercise 1.2** *(Second title)*]{#exercise:second .pandoc-numbering-text .exercise}
50
51
See [Exercise exercise First title first title 1.1.1 1.1 1.1 1.1](#exercise:first)
52
53
See [Exercise exercise Second title second title 1.1.2 1.1 1.2 1.2](#exercise:second)
54
        '''
55
    )
56
57
58
def test_referencing_latex():
59
    verify_conversion(
60
        '''
61
Title
62
=====
63
64
Exercise -.#first
65
66
Exercise (Title) -.#second
67
68
See [](#exercise:first)
69
70
See [](#exercise:second)
71
        ''',
72
        '''
73
Title
74
=====
75
76
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {1.1}{\\ignorespaces {Exercise}}}[\\label{exercise:first}**Exercise 1**]{#exercise:first .pandoc-numbering-text .exercise}
77
78
\\phantomsection\\addcontentsline{exercise}{exercise}{\\protect\\numberline {1.2}{\\ignorespaces {Title}}}[\\label{exercise:second}**Exercise 2** *(Title)*]{#exercise:second .pandoc-numbering-text .exercise}
79
80
See [[Exercise 1]{.pandoc-numbering-link .exercise}](#exercise:first)
81
82
See [[Exercise 2 (Title)]{.pandoc-numbering-link .exercise}](#exercise:second)
83
        ''',
84
        'latex'
85
   )
86