chrisjsewell / ipypublish
1 3
from ipypublish.filters_pandoc.utils import apply_filter
2 3
from ipypublish.filters_pandoc import prepare_cites, format_cite_elements
3

4

5 3
def test_multiple_references_rst():
6
    """
7
    """
8 3
    in_string = ["multiple references +[@fig:id; @tbl:id; @eq:id1]"]
9

10 3
    out_string = apply_filter(
11
        in_string, [prepare_cites.main, format_cite_elements.main], "rst"
12
    )
13

14 3
    print(out_string)
15 3
    assert out_string == "\n".join(
16
        ["multiple references :ref:`fig:id`, :ref:`tbl:id` and :ref:`eq:id1`"]
17
    )
18

19

20 3
def test_multiple_references_latex():
21
    """
22
    """
23 3
    in_string = ["multiple references +[@fig:id; @tbl:id; @eq:id1]"]
24

25 3
    out_string = apply_filter(
26
        in_string, [prepare_cites.main, format_cite_elements.main], "latex"
27
    )
28

29 3
    print(out_string)
30 3
    assert out_string == "\n".join(["multiple references \\cref{fig:id,tbl:id,eq:id1}"])
31

32

33 3
def test_reference_prefixes_latex():
34
    """
35
    """
36 3
    in_string = ["(?@key1 &@key2 =@key3)"]
37

38 3
    out_string = apply_filter(
39
        in_string, [prepare_cites.main, format_cite_elements.main], "latex"
40
    )
41

42 3
    print(out_string)
43 3
    assert out_string == "\n".join(["(\\Cref{key1} \\gls{key2} \\eqref{key3})"])
44

45

46 3
def test_reference_prefixes_rst():
47
    """
48
    """
49 3
    in_string = ["(?@key1 &@key2 %@key3 =@key4)"]
50

51 3
    out_string = apply_filter(
52
        in_string, [prepare_cites.main, format_cite_elements.main], "rst"
53
    )
54

55 3
    print(out_string)
56 3
    assert out_string == "\n".join(
57
        ["(:ref:`key1` :gls:`key2` :glsc:`key3` :eq:`key4`)"]
58
    )

Read our documentation on viewing source code .

Loading