From 523cf405d7ef816d4e63a8b765b68ba8edcedfab Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Thu, 6 Jul 2017 18:16:15 -0400 Subject: [PATCH] more fussing around with the docs generator, and now I'm done --- docs/aglio_templates/core.jade | 2 +- docs/aglio_templates/mixins.jade | 48 ++++++++++++++++++++++++++------ docs/aglio_templates/public.jade | 2 +- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/docs/aglio_templates/core.jade b/docs/aglio_templates/core.jade index 7d37a5784..de87cfe99 100644 --- a/docs/aglio_templates/core.jade +++ b/docs/aglio_templates/core.jade @@ -13,7 +13,7 @@ html div.container-fluid.triple .row block nav - +Nav() + +Nav(false) .content #right-panel-background diff --git a/docs/aglio_templates/mixins.jade b/docs/aglio_templates/mixins.jade index 35a711d51..003336197 100644 --- a/docs/aglio_templates/mixins.jade +++ b/docs/aglio_templates/mixins.jade @@ -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 diff --git a/docs/aglio_templates/public.jade b/docs/aglio_templates/public.jade index 0c7256ac5..1a4850859 100644 --- a/docs/aglio_templates/public.jade +++ b/docs/aglio_templates/public.jade @@ -13,7 +13,7 @@ html div.container-fluid.triple .row block nav - +Nav() + +Nav(true) .content #right-panel-background