details.feature 7.6 KB
Newer Older
1
Feature: Details
2
3
4
  As a scholar who likes to blog
  I want to publish my BibTeX bibliography on my blog
  And I want Jekyll to generate detail pages for all the entries in my bibliography
5

6
  @generators
Sylvester Keil's avatar
Sylvester Keil committed
7
  Scenario: A bibliography with a single entry
8
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
9
10
11
12
13
14
15
16
17
18
      | key            | value             |
      | source         | ./_bibliography   |
      | details_layout | details.html      |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{ruby,
        title     = {The Ruby Programming Language},
        author    = {Flanagan, David and Matsumoto, Yukihiro},
        year      = {2008},
19
        comment   = {A Comment},
Sylvester Keil's avatar
Sylvester Keil committed
20
21
22
23
24
25
26
27
28
29
30
        publisher = {O'Reilly Media}
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      <html>
      <head></head>
      <body>
31
32
      {{ page.title }}
      {{ page.entry.comment }}
Sylvester Keil's avatar
Sylvester Keil committed
33
34
35
36
37
38
39
      </body>
      </html>
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/bibliography/ruby.html" file should exist
    And I should see "The Ruby Programming Language" in "_site/bibliography/ruby.html"
40
    And I should see "A Comment" in "_site/bibliography/ruby.html"
Sylvester Keil's avatar
Sylvester Keil committed
41

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  @generators
  Scenario: LaTeX conversion is applied to everything except the bibtex field
    Given I have a scholar configuration with:
      | key            | value             |
      | source         | ./_bibliography   |
      | details_layout | details.html      |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{ruby,
        title     = {An Umlaut \"a!},
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      <html>
      <head></head>
      <body>
63
      Page title: {{ page.title }}
64
65
66
67
68
69
70
71
      Title: {{ page.entry.title }}
      {{ page.entry.bibtex }}
      </body>
      </html>
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/bibliography/ruby.html" file should exist
72
    And I should see "Page title: An Umlaut ä!" in "_site/bibliography/ruby.html"
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
    And I should see "Title: An Umlaut ä!" in "_site/bibliography/ruby.html"
    And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"

  @generators
  Scenario: LaTeX conversion can be turned off
    Given I have a scholar configuration with:
      | key            | value             |
      | source         | ./_bibliography   |
      | details_layout | details.html      |
      | bibtex_filters |                   |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{ruby,
        title     = {An Umlaut \"a!},
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      <html>
      <head></head>
      <body>
98
      Page title: {{ page.title }}
99
100
101
102
103
104
105
106
      Title: {{ page.entry.title }}
      {{ page.entry.bibtex }}
      </body>
      </html>
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/bibliography/ruby.html" file should exist
107
    And I should see "Page title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
108
109
110
    And I should see "Title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
    And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"

Sylvester Keil's avatar
Sylvester Keil committed
111
  @tags @details
Sylvester Keil's avatar
Sylvester Keil committed
112
  Scenario: Links to Detail Pages are Generated Automatically
Sylvester Keil's avatar
Sylvester Keil committed
113
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
      | key            | value             |
      | source         | ./_bibliography   |
      | bibliogaphy    | references        |
      | details_layout | details.html      |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{ruby,
        title     = {The Ruby Programming Language},
        author    = {Flanagan, David and Matsumoto, Yukihiro},
        year      = {2008},
        publisher = {O'Reilly Media}
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      <html>
      <head></head>
      <body>
      {{ page.entry.title }}
      </body>
      </html>
      """
    And I have a page "scholar.html":
      """
      ---
      ---
      {% bibliography %}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/scholar.html" file should exist
Sylvester Keil's avatar
fix #55    
Sylvester Keil committed
149
    And the "_site/bibliography/ruby.html" file should exist
Sylvester Keil's avatar
Sylvester Keil committed
150
    And I should see "<a[^>]+href=\"/bibliography/ruby.html\">" in "_site/scholar.html"
Sylvester Keil's avatar
fix #55    
Sylvester Keil committed
151

Sylvester Keil's avatar
4.3.5    
Sylvester Keil committed
152
  @tags @details
Sylvester Keil's avatar
fix #55    
Sylvester Keil committed
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  Scenario: Links to Detail Pages Work With Pretty URLs
    Given I have a configuration file with "permalink" set to "pretty"
    And I have a scholar configuration with:
      | key            | value             |
      | source         | ./_bibliography   |
      | bibliogaphy    | references        |
      | details_layout | details.html      |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{ruby,
        title     = {The Ruby Programming Language},
        author    = {Flanagan, David and Matsumoto, Yukihiro},
        year      = {2008},
        publisher = {O'Reilly Media}
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      <html>
      <head></head>
      <body>
      {{ page.entry.title }}
      </body>
      </html>
      """
    And I have a page "scholar.html":
      """
      ---
      ---
      {% bibliography %}
      """
    When I run jekyll
    Then the _site directory should exist
    And I should see "pretty" in "_config.yml"
    And the "_site/scholar/index.html" file should exist
192
    And I should see "<a[^>]+href=\"/bibliography/ruby/\">" in "_site/scholar/index.html"
Sylvester Keil's avatar
fix #55    
Sylvester Keil committed
193
    And the "_site/bibliography/ruby/index.html" file should exist
194

Sylvester Keil's avatar
Sylvester Keil committed
195
  @generators @parse_months
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
  Scenario: Months are parsed by default
    Given I have a scholar configuration with:
      | key            | value             |
      | details_layout | details.html      |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{august,
        month     = {August}
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      {{ page.entry.bibtex }}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/bibliography/august.html" file should exist
    And I should see "month = aug" in "_site/bibliography/august.html"
Sylvester Keil's avatar
Sylvester Keil committed
218

Sylvester Keil's avatar
Sylvester Keil committed
219
  @generators @parse_months
Sylvester Keil's avatar
Sylvester Keil committed
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  Scenario: Month parsing can be turned off
    Given I have a scholar configuration with:
      | key            | value             |
      | details_layout | details.html      |
    And I have the following BibTeX options:
      | key            | value             |
      | parse_months   | false             |
    And I have a "_bibliography" directory
    And I have a file "_bibliography/references.bib":
      """
      @book{august,
        month     = {August}
      }
      """
    And I have a "_layouts" directory
    And I have a file "_layouts/details.html":
      """
      ---
      ---
      {{ page.entry.bibtex }}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/bibliography/august.html" file should exist
    And I should see "month = {August}" in "_site/bibliography/august.html"