Renamed the tumbler and parser files so that you import "lib/tumble"

This commit is contained in:
Elf M. Sternberg 2013-03-30 20:45:12 -07:00
parent 1806eccf20
commit 70149bcf1e
5 changed files with 12 additions and 9 deletions

View File

@ -5,17 +5,17 @@ lib_objects:= $(subst src/, lib/, $(lib_sources:%.coffee=%.js))
default: build default: build
build: $(lib_objects) lib/tumble.js build: $(lib_objects) lib/parser.js
lib/tumble.js: src/tumble.peg lib/parser.js: src/parser.peg
./node_modules/.bin/pegjs src/tumble.peg lib/tumble.js ./node_modules/.bin/pegjs src/parser.peg lib/parser.js
$(lib_objects): lib/%.js: src/%.coffee $(lib_objects): lib/%.js: src/%.coffee
@mkdir -p $(@D) @mkdir -p $(@D)
coffee -o $(@D) -c $< coffee -o $(@D) -c $<
test: test/[0-9]*_mocha.coffee lib/tumble.js lib/parser.js test: test/[0-9]*_mocha.coffee lib/tumble.js lib/parser.js
./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $< ./node_modules/.bin/mocha -R tap -C --compilers coffee:coffee-script -u tdd $<
clean: clean:

View File

@ -84,6 +84,11 @@ AuthorsURL
# > Handle these first # > Handle these first
{URL}
{SeriesTitle}
{AuthorName}
{AuthorDescription}
{block:IfSeries} {block:IfSeries}
{Title} {Title}
{Description} {Description}

View File

@ -1,17 +1,16 @@
tumble = require('./tumble') tumble = require('./parser')
util = require('util') util = require('util')
module.exports = (template) -> module.exports = (template) ->
ast = tumble.parse(template) ast = tumble.parse(template)
console.log(util.inspect(ast, null, null))
# Using the AST, return a function that will render each component # Using the AST, return a function that will render each component
# of the AST out, as long as the data provided to the AST makes # of the AST out, as long as the data provided to the AST makes
# sens. # sens.
# #
(content) -> (content) ->
console.log(content)
subtypes = (name) -> subtypes = (name) ->
return 'cond' return 'cond'

View File

@ -3,7 +3,7 @@ assert = chai.assert
expect = chai.expect expect = chai.expect
should = chai.should() should = chai.should()
tumble = require('../lib/parser') tumble = require('../lib/tumble')
test_data = [ test_data = [
{ {
@ -43,5 +43,4 @@ describe "Basic Functionality", ->
do (data) -> do (data) ->
it "should work with #{data.description}", -> it "should work with #{data.description}", ->
r = tumble(data.input)(data.data) r = tumble(data.input)(data.data)
console.log("R:", r)
r.should.equal data.output r.should.equal data.output