File: highlighting.feature

package info (click to toggle)
jekyll 4.4.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,504 kB
  • sloc: ruby: 16,738; javascript: 1,455; sh: 216; xml: 29; makefile: 9
file content (45 lines) | stat: -rw-r--r-- 1,778 bytes parent folder | download
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
Feature: Syntax Highlighting
  As a hacker who likes to blog
  I want to share code snippets in my blog
  And make them pretty for all the world to see

  Scenario: highlighting an apache configuration
    Given I have an "index.html" page with content:
      """
      {% highlight apache %}
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php [QSA,L]
      {% endhighlight %}
      """
    When I run jekyll build
    Then I should get a zero exit-status
    And I should see "<span class="nc">RewriteCond</span>" in "_site/index.html"

  Scenario: marking lines 1 and 2 in a Ruby code block with valid syntax
    Given I have an "index.html" page with content:
      """
      {% highlight ruby mark_lines="1 2" %}
      module Jekyll
        module Tags
          class HighlightBlock < Liquid::Block
      {% endhighlight %}
      """
    When I run jekyll build
    Then I should get a zero exit-status
    And I should see "<span class=\"hll\"><span class=\"k\">module</span> <span class=\"nn\">Jekyll</span>" in "_site/index.html"
    And I should see "<span class=\"hll\">  <span class=\"k\">module</span> <span class=\"nn\">Tags</span>" in "_site/index.html"
    And I should see "<span class=\"k\">class</span> <span class=\"nc\">HighlightBlock</span" in "_site/index.html"

  Scenario: marking a single line in a Ruby code block with invalid syntax
    Given I have an "index.html" page with content:
      """
      {% highlight ruby mark_lines=1 %}
      module Jekyll
        module Tags
          class HighlightBlock < Liquid::Block
      {% endhighlight %}
      """
    When I run jekyll build
    Then I should see "Liquid Exception: Syntax Error" in the build output