details.feature 7.25 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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
      | 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},
        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>
      """
    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"
Sylvester Keil's avatar
Sylvester Keil committed
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
  @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>
      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
    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>
      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
    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
104
  @tags @details
Sylvester Keil's avatar
Sylvester Keil committed
105
  Scenario: Links to Detail Pages are Generated Automatically
Sylvester Keil's avatar
Sylvester Keil committed
106
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
107 108 109 110 111 112 113 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
      | 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
Sylvester Keil committed
142
    And the "_site/bibliography/ruby.html" file should exist
Sylvester Keil's avatar
Sylvester Keil committed
143
    And I should see "<a[^>]+href=\"/bibliography/ruby.html\">" in "_site/scholar.html"
Sylvester Keil's avatar
Sylvester Keil committed
144

Sylvester Keil's avatar
4.3.5  
Sylvester Keil committed
145
  @tags @details
Sylvester Keil's avatar
Sylvester Keil committed
146 147 148 149 150 151 152 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
  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
185
    And I should see "<a[^>]+href=\"/bibliography/ruby/\">" in "_site/scholar/index.html"
Sylvester Keil's avatar
Sylvester Keil committed
186
    And the "_site/bibliography/ruby/index.html" file should exist
187

Sylvester Keil's avatar
Sylvester Keil committed
188
  @generators @parse_months
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
  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
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237

  @generators @parse_months @wip
  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"