Permalink
Browse files

improving multiline args

  • Loading branch information...
1 parent 965ce51 commit 3054ae8ddb3c23933fef1e5a1e27e773a764d15f @msuarz msuarz committed Oct 14, 2012
Showing with 11 additions and 7 deletions.
  1. +1 −0 docs/settings.coffee
  2. +2 −1 docs/src/frank.coffee
  3. +4 −4 src/readers/doc.coffee
  4. +3 −1 src/readers/settings.coffee
  5. +1 −1 src/settings.coffee
View
@@ -4,5 +4,6 @@
repo: 'git://github.com/limadelic/frankendoc.wiki.git'
type: '.md'
code_block: /```([\s\S]*?)```/g
+ multiline_arg: /^(\s\s\s|""")$/
code:
root: 'docs/src'
View
@@ -3,4 +3,5 @@
class @Frank
'[>\$] frank @args': (args) ->
- $ 'coffee src/frank ' + args
+ console.log args
+ console.log $ 'coffee src/frank ' + args
View
@@ -4,7 +4,7 @@ class @Doc
constructor: (@opt = {}) ->
@opt.line_break ?= '\r\n'
- @opt.multiline_arg ?= '"""'
+ @opt.multiline_arg = settings.docs.multiline_arg
@opt.code_block = settings.docs.code_block ? @opt.code_block
read: (doc) ->
@@ -19,7 +19,7 @@ class @Doc
code += match[1] + @opt.line_break
code
- tokenize: (doc) -> _.compact doc.split @opt.line_break
+ tokenize: (doc) -> doc.split @opt.line_break
read_lines: (lines) -> for line in lines
@read_multiline_arg(line) ?
@@ -28,9 +28,9 @@ class @Doc
add: (line) -> @steps.push
name: line.trim()
args: []
-
+
read_multiline_arg: (line) ->
- is_token = line.trim() is @opt.multiline_arg
+ is_token = @opt.multiline_arg?.test line
return unless is_token or @arg?
return @arg = '' if is_token and not @arg?
@@ -39,7 +39,9 @@ user_settings = -> require(user_settings_file()).settings
merge = (one, another) ->
for property, value of another
- if _.isObject(value) and _.isObject(one[property])
+ if is_object(value) and is_object(one[property])
merge one[property], value
else
one[property] = value
+
+is_object = (o) -> toString.call(o) is '[object Object]'
View
@@ -13,7 +13,7 @@
reader: 'docs'
root: '.'
type: '.txt'
- multiline_arg: '"""'
+ multiline_arg: /^"""$/
report: 'console'
code:
reader: 'code'

0 comments on commit 3054ae8

Please sign in to comment.