From 8ef4113b5c28674140d535f5c6aa917522172ece Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Fri, 5 Jan 2018 13:06:26 +0000 Subject: [PATCH] sort toc for definitions alphabetically, fixes #28 --- examples/docs/abstract.schema.md | 2 +- examples/docs/extensible.schema.md | 2 +- templates/md/definitions.ejs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index b9753b8..be4054c 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -19,8 +19,8 @@ This is an abstract schema. It has `definitions`, but does not declare any prope | Property | Type | Group | |----------|------|-------| -| [foo](#foo) | `string` | `#/definitions/first` | | [bar](#bar) | `string` | `#/definitions/second` | +| [foo](#foo) | `string` | `#/definitions/first` | ## bar diff --git a/examples/docs/extensible.schema.md b/examples/docs/extensible.schema.md index 9d90134..4a79bbf 100644 --- a/examples/docs/extensible.schema.md +++ b/examples/docs/extensible.schema.md @@ -19,8 +19,8 @@ This is an extensible schema. It has `definitions`, that can be used in other sc | Property | Type | Group | |----------|------|-------| -| [foo](#foo) | `string` | `#/definitions/first` | | [bar](#bar) | `string` | `#/definitions/second` | +| [foo](#foo) | `string` | `#/definitions/first` | ## bar diff --git a/templates/md/definitions.ejs b/templates/md/definitions.ejs index 3c15918..825051d 100644 --- a/templates/md/definitions.ejs +++ b/templates/md/definitions.ejs @@ -10,6 +10,7 @@ | Property | Type | Group | |----------|------|-------| -<% _.forIn(props, (schema, property, object) => { %> +<% _.keys(props).sort().forEach(property => { + const schema = props[property]; %> | [<%= property %>](#<%= property %>) | <%= schema.simpletype %> | `#/definitions/<%= schema.definitiongroup %>` | <% }); %> \ No newline at end of file -- GitLab