bibtex.feature 4.83 KB
Newer Older
Sylvester Keil's avatar
Sylvester Keil committed
1 2 3 4 5
Feature: BibTeX
  As a scholar who likes to blog
  I want to publish my BibTeX bibliography on my blog
  In order to share my awesome references with my peers

6
  @converters
Sylvester Keil's avatar
Sylvester Keil committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  Scenario: Simple Bibliography
    Given I have a scholar configuration with:
      | key   | value |
      | style | apa   |
     And I have a page "references.bib":
      """
      ---
      ---
      @book{ruby,
        title     = {The Ruby Programming Language},
        author    = {Flanagan, David and Matsumoto, Yukihiro},
        year      = {2008},
        publisher = {O'Reilly Media}
      }
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/references.html" file should exist
    And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
Sylvester Keil's avatar
Sylvester Keil committed
26

27
  @converters
Sylvester Keil's avatar
Sylvester Keil committed
28
  Scenario: Markdown Formatted Bibliography
29
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
      | key   | value |
      | style | apa   |
    And I have a page "references.bib":
      """
      ---
      ---
      References
      ==========
      
      @book{ruby,
        title     = {The Ruby Programming Language},
        author    = {Flanagan, David and Matsumoto, Yukihiro},
        year      = {2008},
        publisher = {O'Reilly Media}
      }
      """
    When I run jekyll
    Then I should see "<h1[^>]*>References</h1>" in "_site/references.html"
48 49

  @latex
Sylvester Keil's avatar
Sylvester Keil committed
50
  Scenario: Simple Bibliography with LaTeX directives
51
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65
      | key   | value |
      | style | apa   |
    And I have a page "references.bib":
      """
      ---
      ---
      @misc{umlaut,
        title     = {Look, an umlaut: \"u!},
      }
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/references.html" file should exist
    And I should see "Look, an umlaut: ü!" in "_site/references.html"
66 67

  @tags
Sylvester Keil's avatar
Sylvester Keil committed
68
  Scenario: Simple Bibliography Loaded From Default Directory
69
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
      | key    | value             |
      | source | ./_bibliography   |
    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 page "scholar.html":
      """
      ---
      ---
      {% bibliography -f references %}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/scholar.html" file should exist
    And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
92 93

  @tags @filter
Sylvester Keil's avatar
Sylvester Keil committed
94
  Scenario: Filtered Bibliography Loaded From Default Directory
95
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
      | key    | value             |
      | source | ./_bibliography   |
    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}
      },
      @book{smalltalk,
        title     = {Smalltalk Best Practice Patterns},
        author    = {Kent Beck},
        year      = {1996},
        publisher = {Prentice Hall}
      }
113

Sylvester Keil's avatar
Sylvester Keil committed
114 115 116 117 118 119 120 121 122 123 124 125
      """
    And I have a page "scholar.html":
      """
      ---
      ---
      {% bibliography -f references --query @book[year <= 2000] %}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/scholar.html" file should exist
    And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
    And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
126 127

  @tags @bibliography @prefix
Sylvester Keil's avatar
Sylvester Keil committed
128
  Scenario: A Prefixed Bibliography
129
    Given I have a scholar configuration with:
Sylvester Keil's avatar
Sylvester Keil committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
      | key    | value             |
      | source | ./_bibliography   |
    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}
      },
      @book{smalltalk,
        title     = {Smalltalk Best Practice Patterns},
        author    = {Kent Beck},
        year      = {1996},
        publisher = {Prentice Hall}
      }
147

Sylvester Keil's avatar
Sylvester Keil committed
148 149 150 151 152 153 154 155 156 157 158 159
      """
    And I have a page "scholar.html":
      """
      ---
      ---
      {% bibliography --file references --prefix a -q @book[year <= 2000] %}
      """
    When I run jekyll
    Then the _site directory should exist
    And the "_site/scholar.html" file should exist
    And I should not see "ruby" in "_site/scholar.html"
    And I should see "id=\"a-smalltalk\"" in "_site/scholar.html"