Skip to content

Commit

Permalink
Merge pull request #254 from hpk/olio-theme
Browse files Browse the repository at this point in the history
Leave trailing slash if specified in URI template
  • Loading branch information
danielgtaylor committed May 20, 2016
2 parents 2fc2bee + 4c8fa7e commit 782f2f5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.coffee
Expand Up @@ -315,7 +315,7 @@ modifyUriTemplate = (templateUri, parameters, colorize) ->
segment.push "}"
uri.push segment.join("")
uri
, []).join('').replace(/\/+/g, '/').replace(/\/$/, '')
, []).join('').replace(/\/+/g, '/')

decorate = (api, md, slugCache, verbose) ->
# Decorate an API Blueprint AST with various pieces of information that
Expand Down
31 changes: 31 additions & 0 deletions test/uri.coffee
Expand Up @@ -85,6 +85,37 @@ examples = [
{title: 'something', attribute: 'with/slash'}
]
}

{
uriTemplate: '/resource/'
parameters: []
exampleURI: [
'/resource/'
]
}

{
uriTemplate: '/resource/{path}/'
parameters: [
{
name: 'path'
}
]
exampleURI: [
'/resource/'
{attribute: 'path'}
'/'
]
}

{
uriTemplate: '/resource'
parameters: []
exampleURI: [
'/resource'
]
}

]

addParameterDefaults = (example) ->
Expand Down

0 comments on commit 782f2f5

Please sign in to comment.