Cucumber syntax for SH2

  • Created Cucumber syntax for Syntax Highlighter:

    //
    // Created by Antono Vasiljev
    // http://antono.info/
    //
    SyntaxHighlighter.brushes.Cucumber = function()
    {
      var keywords   = 'Background Scenario Examples Outline
                        Feature Given When Then And But';
      this.regexList = [
        { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
        { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
        { regex: /@\w+/g, css: 'variable bold' },
        { regex: /\|(.*)\|/g, css: 'color1' },
        { regex: /\*/g, css: 'color2' }
      ];
      this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
    };
    
    SyntaxHighlighter.brushes.Cucumber.prototype = new SyntaxHighlighter.Highlighter();
    SyntaxHighlighter.brushes.Cucumber.aliases = ['cucumber', 'gherkin'];

    Result:

    # language: en
    # Simple Feature
    
    @javascript
    
    Feature: Cucumber for Syntax Highlighter
      As a software developer and blogger
      I want to publish colored cucumber features in my blog
    
      Background:
        * 'sh/shCore.js' included in the page
        * 'sh/brushes/shBrushCucumber.js' included in the page
    
      @wip
      Scenario Outline: Hello World
        Given something
        When ...
        And ...
        Then ...
        But ...
    
        Examples:
          | hello  | world    | cucumber    |
          | this   | cucumber | table       |
          | should | be       | highlighted |
    
      Scenario: Publishing feature
        When I put valid cucumber feature inside "<pre class='brush:cucumber'>"
        And call "SyntaxHighlighter.all();"
        Then I should see highlighted feature
    
      Scenario: Highlighting cucumber tables
        | hello  | world    | cucumber    |
        | this   | cucumber | table       |
        | should | be       | highlighted |
    
      Scenario: Highlighting cucumber heredocs
        Given following heredoc
        """
        Cucumber
        """