From d884fc725e67577041b18748592e46b2d415ee15 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Sun, 29 Jan 2017 18:54:35 -0500 Subject: [PATCH] Support deprecated tag --- default_theme/section._ | 15 +- lib/output/markdown_ast.js | 4 +- lib/parse.js | 6 +- test/fixture/html/nested.config-output.html | 402 +------------------- test/fixture/html/nested.output.files | 402 +------------------- 5 files changed, 49 insertions(+), 780 deletions(-) diff --git a/default_theme/section._ b/default_theme/section._ index a75159b83..4ef057fee 100644 --- a/default_theme/section._ +++ b/default_theme/section._ @@ -24,7 +24,7 @@ <%= formatType(section.type) %>

<% } %> - <% if (section.augments) { %> + <% if (section.augments.length) { %>

Extends <% if (section.augments) { %> @@ -35,13 +35,14 @@

<% } %> + <% if (section.deprecated) { %>
Deprecated: <%= md(section.deprecated, true) %>
<% }%> <% if (section.version) { %>
Version: <%- section.version %>
<% }%> <% if (section.license) { %>
License: <%- section.license %>
<% }%> <% if (section.author) { %>
Author: <%- section.author %>
<% }%> - <% if (section.copyright) { %>
Copyright: <%- section.copyright %>
<% }%> + <% if (section.copyright) { %>
Copyright: <%= md(section.copyright, true) %>
<% }%> <% if (section.since) { %>
Since: <%- section.since %>
<% }%> - <% if (section.params) { %> + <% if (section.params.length) { %>
Parameters
<% section.params.forEach(function(param) { %> @@ -81,7 +82,7 @@
<% } %> - <% if (section.properties) { %> + <% if (section.properties.length) { %>
Properties
<% section.properties.forEach(function(property) { %> @@ -108,7 +109,7 @@
<% } %> - <% if (section.returns) { %> + <% if (section.returns.length) { %> <% section.returns.forEach(function(ret) { %>
Returns
<%= formatType(ret.type) %><% if (ret.description) { %>: @@ -117,7 +118,7 @@ <% }) %> <% } %> - <% if (section.throws) { %> + <% if (section.throws.length) { %>
Throws
<% } %> - <% if (section.examples) { %> + <% if (section.examples.length) { %>
Example
<% section.examples.forEach(function(example) { %> <% if (example.caption) { %>

<%= md(example.caption) %>

<% } %> diff --git a/lib/output/markdown_ast.js b/lib/output/markdown_ast.js index 8c9748fb4..4058603f4 100644 --- a/lib/output/markdown_ast.js +++ b/lib/output/markdown_ast.js @@ -174,14 +174,14 @@ function buildMarkdownAST(comments/*: Array */, config/*: Documentation } function metaSection(comment/*: Comment */) { - let meta = ['version', 'since', 'copyright', 'author', 'license'] + let meta = ['version', 'since', 'copyright', 'author', 'license', 'deprecated'] .filter(tag => comment[tag]); return !!meta.length && [u('strong', [u('text', 'Meta')])].concat( u('list', { ordered: false }, meta .map(tag => { let metaContent; - if (tag === 'copyright') { + if (tag === 'copyright' || tag === 'deprecated') { metaContent = comment[tag]; } else { metaContent = u('text', comment[tag]); diff --git a/lib/parse.js b/lib/parse.js index 176f99032..1b859a56b 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -77,7 +77,11 @@ var flatteners = { 'copyright': flattenMarkdownDescription, 'default': todo, 'defaultvalue': synonym('default'), - 'deprecated': flattenMarkdownDescription, + deprecated(result, tag) { + let description = tag.description || 'This is deprecated.'; + result.deprecated = parseMarkdown(description); + }, + flattenMarkdownDescription, 'desc': synonym('description'), 'description': flattenMarkdownDescription, 'emits': synonym('fires'), diff --git a/test/fixture/html/nested.config-output.html b/test/fixture/html/nested.config-output.html index 534109b8d..0367dc120 100644 --- a/test/fixture/html/nested.config-output.html +++ b/test/fixture/html/nested.config-output.html @@ -279,6 +279,7 @@

+
Parameters
@@ -296,27 +297,12 @@

-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- -
Static Members
@@ -342,19 +328,13 @@

isClass(other: Object, also: any): boolean
-

- Extends - - - -

- +
Parameters
@@ -380,11 +360,6 @@

-
Properties
-
- -
- @@ -397,16 +372,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -437,19 +404,13 @@

isWeird(other: Weird): boolean
-

- Extends - - - -

- +
Parameters
@@ -467,11 +428,6 @@

-
Properties
-
- -
- @@ -484,16 +440,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -523,19 +471,13 @@

isBuffer(buf: (Buffer | string), size: number?): boolean
-

- Extends - - - -

- +
Parameters
@@ -563,11 +505,6 @@

-
Properties
-
- -
- @@ -580,16 +517,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -619,19 +548,13 @@

isArrayOfBuffers(buffers: Array<Buffer>): number
-

- Extends - - - -

- +
Parameters
@@ -650,11 +573,6 @@

-
Properties
-
- -
- @@ -667,11 +585,6 @@

-
Throws
-
    - -
-
Example
@@ -710,48 +623,22 @@

MAGIC_NUMBER
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -790,32 +677,16 @@

getFoo(): Number
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -829,11 +700,6 @@

-
Throws
-
    - -
-
Example
@@ -872,19 +738,13 @@

withOptions(options: Object, otherOptions: number?)
-

- Extends - - - -

- +
Parameters
@@ -938,27 +798,12 @@

-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- - @@ -996,48 +841,22 @@

event
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -1077,19 +896,13 @@

CustomError(other: any, also: any)
-

- Extends - - - -

- +
Parameters
@@ -1143,20 +956,10 @@

- - -
Throws
-
    - -
- -
Example
- - @@ -1189,32 +992,16 @@

bar(): Klass
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -1228,16 +1015,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -1268,19 +1047,13 @@

bar(toys: ...Number): undefined
-

- Extends - - - -

- +
Parameters
@@ -1298,11 +1071,6 @@

-
Properties
-
- -
- @@ -1315,16 +1083,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -1357,32 +1117,16 @@

bar(): undefined
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -1396,16 +1140,8 @@

-
Throws
-
    - -
- -
Example
- - @@ -1436,48 +1172,22 @@

new Foo()
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -1504,48 +1214,22 @@

bar
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -1587,48 +1271,22 @@

customStreams
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -1653,48 +1311,22 @@

new passthrough()
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + diff --git a/test/fixture/html/nested.output.files b/test/fixture/html/nested.output.files index 13a20901c..42111c5aa 100644 --- a/test/fixture/html/nested.output.files +++ b/test/fixture/html/nested.output.files @@ -241,6 +241,7 @@ +
Parameters
@@ -258,27 +259,12 @@ -
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- -
Static Members
@@ -304,19 +290,13 @@ This is a [link to something that does not exist]DoesNotisClass(other: Object, also: any): boolean -

- Extends - - - -

- +
Parameters
@@ -342,11 +322,6 @@ This is a [link to something that does not exist]DoesNotProperties -
- -
- @@ -359,16 +334,8 @@ This is a [link to something that does not exist]DoesNotThrows -
    - -
- -
Example
- - @@ -399,19 +366,13 @@ the referenced class type

isWeird(other: Weird): boolean
-

- Extends - - - -

- +
Parameters
@@ -429,11 +390,6 @@ the referenced class type

-
Properties
-
- -
- @@ -446,16 +402,8 @@ the referenced class type

-
Throws
-
    - -
- -
Example
- - @@ -485,19 +433,13 @@ the referenced class type

isBuffer(buf: (Buffer | string), size: number?): boolean
-

- Extends - - - -

- +
Parameters
@@ -525,11 +467,6 @@ the referenced class type

-
Properties
-
- -
- @@ -542,16 +479,8 @@ the referenced class type

-
Throws
-
    - -
- -
Example
- - @@ -581,19 +510,13 @@ the referenced class type

isArrayOfBuffers(buffers: Array<Buffer>): number
-

- Extends - - - -

- +
Parameters
@@ -612,11 +535,6 @@ the referenced class type

-
Properties
-
- -
- @@ -629,11 +547,6 @@ the referenced class type

-
Throws
-
    - -
-
Example
@@ -672,48 +585,22 @@ k.isArrayOfBuffers();
MAGIC_NUMBER
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -752,32 +639,16 @@ k.isArrayOfBuffers();
getFoo(): Number
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -791,11 +662,6 @@ k.isArrayOfBuffers(); -
Throws
-
    - -
-
Example
@@ -834,19 +700,13 @@ k.isArrayOfBuffers();
withOptions(options: Object, otherOptions: number?)
-

- Extends - - - -

- +
Parameters
@@ -900,27 +760,12 @@ k.isArrayOfBuffers(); -
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- - @@ -958,48 +803,22 @@ k.isArrayOfBuffers();
event
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
- - - -
Throws
-
    - -
- -
Example
- + @@ -1039,19 +858,13 @@ k.isArrayOfBuffers();
CustomError(other: any, also: any)
-

- Extends - - - -

- +
Parameters
@@ -1105,20 +918,10 @@ k.isArrayOfBuffers(); - - -
Throws
-
    - -
- -
Example
- - @@ -1151,32 +954,16 @@ like a klass

bar(): Klass
-

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -1190,16 +977,8 @@ like a klass

-
Throws
-
    - -
- -
Example
- - @@ -1230,19 +1009,13 @@ like a klass

bar(toys: ...Number): undefined
-

- Extends - - - -

- +
Parameters
@@ -1260,11 +1033,6 @@ like a klass

-
Properties
-
- -
- @@ -1277,16 +1045,8 @@ like a klass

-
Throws
-
    - -
- -
Example
- - @@ -1319,32 +1079,16 @@ like a klass. This needs a undefined -

- Extends - - - -

- - - -
Parameters
-
- -
-
Properties
-
- -
+ @@ -1358,16 +1102,8 @@ like a klass. This needs a klass. This needs a klass. This needs a klass. This needs a klass. This needs a Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy