Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve https://github.com/coffeedoc/codo/issues/204 #240

Merged
merged 1 commit into from Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/documentation.coffee
Expand Up @@ -47,6 +47,20 @@ module.exports = class Documentation
type: '?'
description: throws[1]

else if param = /^@param\s+[\[\{](.+?)[\]}]\s+\[([^\]]+)](?:\s+(.+))?/i.exec line
if paramNameVal = /^([^ ]+)\s*=\s*([^ ]+)/.exec param[2]
paramName = paramNameVal[1]
defValue = paramNameVal[2]
else
defValue = null
paramName = param[2]
@params.push
type: param[1]
name: paramName
description: param[3]
defaultState: defValue
optional: yes

else if param = /^@param\s+([^ ]+)\s+[\[\{](.+?)[\]\}](?:\s+(.+))?/i.exec line
@params ?= []
@params.push
Expand Down
4 changes: 4 additions & 0 deletions themes/default/assets/stylesheets/class.styl
Expand Up @@ -169,6 +169,10 @@
font-family: monospace;
font-weight: bold;
}

.defaultState {
font-style: italic;
}
}

.overloads {
Expand Down
7 changes: 6 additions & 1 deletion themes/default/templates/partials/documentation.hamlc
Expand Up @@ -49,11 +49,16 @@
%ul.param
- for param in @documentation.params
%li
%span.name= param.name
- if param.optional
%span.name= '['+param.name+']'
- else
%span.name= param.name
%span.type
(
!= @render('partials/type_link', type: param.type)
)
- if param.defaultState
%span.defaultState= ' = '+param.defaultState
- if param.description
—
%span.desc!= @activate param.description, @path, true
Expand Down