Permalink
Browse files

Allows using tabs for indentation

  • Loading branch information...
1 parent 047d544 commit 00c52b3a864de2a5c762534c4b3b338c5183865f Omar Khan committed Nov 16, 2011
Showing with 12 additions and 4 deletions.
  1. +4 −4 src/coffeedoc.coffee
  2. +8 −0 test/test.coffee
View
@@ -146,17 +146,17 @@ formatDocstring = (str) ->
lines = str.replace(/\\#/g, '#').split('\n')
# Remove leading blank lines
- while /^ *$/.test(lines[0])
+ while /^\s*$/.test(lines[0])
lines.shift()
if lines.length == 0
return null
# Get least indented non-blank line
indentation = for line in lines
- if /^ *$/.test(line) then continue
- line.match(/^ */)[0].length
+ if /^\s*$/.test(line) then continue
+ line.match(/^\s*/)[0].length
indentation = Math.min(indentation...)
- leading_whitespace = new RegExp("^ {#{ indentation }}")
+ leading_whitespace = new RegExp("^\\s{#{ indentation }}")
return (line.replace(leading_whitespace, '') for line in lines).join('\n')
View
@@ -62,3 +62,11 @@ myFunc2 = (arg, splat...) ->
### Another function, with a splat argument ###
return splat[0] if splat.length > 0
return null
+
+tabFunc = (args) ->
+ ###
+ This docstring uses tabs for indentation
+
+ Code block here...
+ ###
+ return null

0 comments on commit 00c52b3

Please sign in to comment.