more fussing around with the docs generator, and now I'm done

This commit is contained in:
Aaron Blankstein
2017-07-06 18:16:15 -04:00
parent 64cf0a4549
commit 523cf405d7
3 changed files with 41 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ html
div.container-fluid.triple
.row
block nav
+Nav()
+Nav(false)
.content
#right-panel-background

View File

@@ -1,3 +1,17 @@
mixin TryMe(action)
//- Give a "try-me" link for the public api endpoint
- var myUri = action.uriTemplate
- action.parameters.forEach( function (x) { myUri = myUri.replace( "{" + x.name + "}", x.example) } )
.title
strong
h4
div
span.method(class="badge get")
a.method(href="https://core.blockstack.org" + myUri, style="color:white;font-size:12pt")
= "Try It!"
|  
p
mixin Badge(method)
//- Draw a badge for a given HTTP method
case method
@@ -18,7 +32,7 @@ mixin Badge(method)
default
span.badge: i.fa.fa-dot-circle-o
mixin Nav()
mixin Nav(onlyPublic)
//- Draw a navigation bar, which includes links to individual
//- resources and actions.
nav
@@ -32,7 +46,12 @@ mixin Nav()
ul: each item in self.api.navItems
li
a(href=item[1])!= item[0]
each resourceGroup in self.api.resourceGroups || []
- if (onlyPublic){
- myGroups = self.api.resourceGroups.filter( filter_public_resourcegroups )
- }else{
- myGroups = self.api.resourceGroups
- }
each resourceGroup in myGroups || []
.resource-group
.heading
.chevron
@@ -43,17 +62,27 @@ mixin Nav()
each item in resourceGroup.navItems || []
li
a(href=item[1])!= item[0]
each resource in resourceGroup.resources || []
- if (onlyPublic){
- myResources = resourceGroup.resources.filter( filter_public_resources )
- }else{
- myResources = resourceGroup.resources
- }
each resource in myResources || []
li
if !self.condenseNav || (resource.actions.length != 1)
- if (onlyPublic){
- myActions = resource.actions.filter( filter_public_actions )
- }else{
- myActions = resource.actions
- }
if !self.condenseNav || (myActions.length != 1)
a(href=resource.elementLink)!= resource.name || 'Resource'
ul: each action in resource.actions || []
li: a(href=action.elementLink)
ul: each action in myActions || []
li: a(href=resource.elementLink)
+Badge(action.method)
!= action.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate)
else
- var action = resource.actions[0]
a(href=action.elementLink)
- var action = myActions[0]
a(href=resource.elementLink)
+Badge(action.method)
!= action.name || resource.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate)
//- Link to the API hostname, e.g. api.yourcompany.com
@@ -315,5 +344,6 @@ mixin ContentTriple(onlyPublic)
//- and responses.
if action.parameters.length
+Parameters(action.parameters)
if onlyPublic
+TryMe(action)
hr.split

View File

@@ -13,7 +13,7 @@ html
div.container-fluid.triple
.row
block nav
+Nav()
+Nav(true)
.content
#right-panel-background