* Update build process to *not* copy over prerendered pages during a regular build (only during a `dist` build) * Add dependency on npm "markdown" package and include it in the scripts loaded in the default layout * Update the Item model to be able to load from a *.cg file * Add an ItemParser to process the `item.cg` file * Update the general parser to be able to work with HereDoc-style text blocks * Add a markdown-specific stylesheet * Add a sample of the `item.cg` file format (Advanced Crafting Table)
49 lines
1.8 KiB
CoffeeScript
49 lines
1.8 KiB
CoffeeScript
###
|
|
Crafting Guide - command_parser_version_base.test.coffee
|
|
|
|
Copyright (c) 2015 by Redwood Labs
|
|
All rights reserved.
|
|
###
|
|
|
|
CommandParserVersionBase = require '../../models/parser_versions/command_parser_version_base'
|
|
|
|
########################################################################################################################
|
|
|
|
parser = null
|
|
|
|
########################################################################################################################
|
|
|
|
describe 'command_parser_version_base.coffee', ->
|
|
|
|
beforeEach -> parser = new CommandParserVersionBase model:{}
|
|
|
|
describe '_parseHereDoc', ->
|
|
|
|
it 'returns null for non-heredoc lines', ->
|
|
result = parser._parseHereDoc 'foobar: baz'
|
|
expect(result[1]).to.be.null
|
|
|
|
it 'identifies the right text for a real heredoc', ->
|
|
parser._lines = ['command: <<-END', 'alpha', 'bravo', 'charlie', 'END', 'command1: arg2']
|
|
parser._lineNumber = 1
|
|
|
|
result = parser._parseHereDoc parser._lines[0]
|
|
result[0].should.equal 'command: '
|
|
result[1].should.equal 'alpha\nbravo\ncharlie'
|
|
|
|
it 'identifies an empty heredoc', ->
|
|
parser._lines = ['command: <<-END', 'END']
|
|
parser._lineNumber = 1
|
|
|
|
result = parser._parseHereDoc parser._lines[0]
|
|
result[0].should.equal 'command: '
|
|
expect(result[1]).to.be.null
|
|
|
|
it 'trims smallest leading whitespace', ->
|
|
parser._lines = ['command: <<-END', ' alpha', ' bravo', ' charlie', 'END', 'command1: arg2']
|
|
parser._lineNumber = 1
|
|
|
|
result = parser._parseHereDoc parser._lines[0]
|
|
result[0].should.equal 'command: '
|
|
result[1].should.equal 'alpha\n bravo\ncharlie'
|