summaryrefslogtreecommitdiff
path: root/features/xref.feature
blob: c2ec2592a69ba04b5d3f7d236297421c4dd47508 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# language: en
Feature: Cross References
  In order to create links to other sections
  As a writer
  I want to be able to use a cross reference macro


  Scenario: Create a cross reference from an AsciiDoc cell to a section
  Given the AsciiDoc source
    """
    |===
    a|See <<_install>>
    |===
    
    == Install
    
    Instructions go here.
    """
  When it is converted to html
  Then the result should match the HTML structure
    """
    table.tableblock.frame-all.grid-all.spread
      colgroup
        col style='width: 100%;'
      tbody
        tr
          td.tableblock.halign-left.valign-top
            div
              .paragraph: p
                'See
                a href='#_install' Install
    .sect1
      h2#_install Install
      .sectionbody
        .paragraph: p Instructions go here.
    """


    Scenario: Create a cross reference using the target section title
    Given the AsciiDoc source
      """
      == Section One

      content

      == Section Two

      refer to <<Section One>>
      """
    When it is converted to html
    Then the result should match the HTML structure
      """
      .sect1
        h2#_section_one Section One
        .sectionbody: .paragraph: p content
      .sect1
        h2#_section_two Section Two
        .sectionbody: .paragraph: p
          'refer to
          a href='#_section_one' Section One
      """


    Scenario: Create a cross reference using the target reftext
    Given the AsciiDoc source
      """
      [reftext="the first section"]
      == Section One

      content

      == Section Two

      refer to <<the first section>>
      """
    When it is converted to html
    Then the result should match the HTML structure
      """
      .sect1
        h2#_section_one Section One
        .sectionbody: .paragraph: p content
      .sect1
        h2#_section_two Section Two
        .sectionbody: .paragraph: p
          'refer to
          a href='#_section_one' the first section
      """


    Scenario: Create a cross reference using the formatted target title
    Given the AsciiDoc source
      """
      == Section *One*

      content

      == Section Two

      refer to <<Section *One*>>
      """
    When it is converted to html
    Then the result should match the HTML structure
      """
      .sect1
        h2#_section_strong_one_strong
          'Section
          strong One
        .sectionbody: .paragraph: p content
      .sect1
        h2#_section_two Section Two
        .sectionbody: .paragraph: p
          'refer to
          a href='#_section_strong_one_strong'
            'Section
            strong One
      """