Permalink
Browse files

fixed configurable code_block

  • Loading branch information...
1 parent 9ec397e commit 9bbe621b82212b52124b3ffdb40b0a71044e78ca @msuarz msuarz committed Oct 14, 2012
View
@@ -3,5 +3,6 @@
reader: 'github'
repo: 'git://github.com/limadelic/frankendoc.wiki.git'
type: '.md'
+ code_block: /```([\s\S]*?)```/g
code:
root: 'docs/src'
View
@@ -2,5 +2,5 @@
class @Frank
- '> frank @args': (args) ->
+ '[>\$] frank @args': (args) ->
$ 'coffee src/frank ' + args
@@ -1,5 +1,5 @@
rest = require 'restler'
-{ Docs } = require './docs'
+{ Docs } = require './docs'
@read = -> new Confluence().read()
@@ -36,7 +36,7 @@ class Confluence
constructor: ->
@docs = new Docs
line_break: '\n'
- code_block: /ac:name="code".*?CDATA\[([\s\S]*?)\]\]><\//g
+ code_block: /ac:name="code".*?CDATA\[([\s\S]*?)\]\]><\//g
@read_settings()
@root_uri = "http://#{@host}/rest/prototype/1"
View
@@ -5,6 +5,7 @@ class @Doc
constructor: (@opt = {}) ->
@opt.line_break ?= '\r\n'
@opt.multiline_arg ?= '"""'
+ @opt.code_block = settings.docs.code_block ? @opt.code_block
read: (doc) ->
@steps = []
@@ -14,22 +15,23 @@ class @Doc
code: (doc) ->
return doc unless @opt.code_block?
code = ''
+ @opt.code_block.exec doc
while (match = @opt.code_block.exec doc)?
code += match[1] + @opt.line_break
code
tokenize: (doc) -> _.compact doc.split @opt.line_break
read_lines: (lines) -> for line in lines
- @read_multiline_arg(line) ?
+ @read_multiline_arg(line) ?
@add(line)
add: (line) -> @steps.push
name: line.trim()
args: []
read_multiline_arg: (line) ->
- is_token = line.trim() is @opt.multiline_arg
+ is_token = line.trim() is @opt.multiline_arg
return unless is_token or @arg?
return @arg = '' if is_token and not @arg?
View
@@ -29,13 +29,13 @@ class @Docs
@docs = []
@doc = new Doc opt
- add: (name, content) ->
+ add: (name, content) ->
@docs.push
name: name
steps: @doc.read content
@last()
- add_suite: (name) ->
+ add_suite: (name) ->
return if @removed_empty_suite(name)?
@docs.push
View
@@ -9,7 +9,7 @@ class @Files
is_dir: -> fs.statSync(@file).isDirectory()
skip_dir: -> @file.match /node_modules$/
- read: (dir) ->
+ read: (dir) ->
@start? dir
for file in fs.readdirSync dir
@@ -16,8 +16,8 @@ class Github
clone: -> $ 'git clone ' + settings.docs.repo
- cleanup: -> $ @rmdir() + settings.docs.root
+ cleanup: -> $ @rmdir() + ' ' + settings.docs.root
- rmdir: -> if @windows() then 'rd /s /q ' else 'rm -r -f '
+ rmdir: -> if @windows() then 'rd /s /q' else 'rm -rf'
windows: -> process.platform[0..2] is 'win'

0 comments on commit 9bbe621

Please sign in to comment.