Skip to content

Commit cd65dc3

Browse files
authored
Support deprecated tag (#666)
1 parent 8cc34b6 commit cd65dc3

File tree

5 files changed

+49
-780
lines changed

5 files changed

+49
-780
lines changed

default_theme/section._

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<%= formatType(section.type) %>
2525
</p>
2626
<% } %>
27-
<% if (section.augments) { %>
27+
<% if (section.augments.length) { %>
2828
<p>
2929
Extends
3030
<% if (section.augments) { %>
@@ -35,13 +35,14 @@
3535
</p>
3636
<% } %>
3737

38+
<% if (section.deprecated) { %><div>Deprecated: <%= md(section.deprecated, true) %></div><% }%>
3839
<% if (section.version) { %><div>Version: <%- section.version %></div><% }%>
3940
<% if (section.license) { %><div>License: <%- section.license %></div><% }%>
4041
<% if (section.author) { %><div>Author: <%- section.author %></div><% }%>
41-
<% if (section.copyright) { %><div>Copyright: <%- section.copyright %></div><% }%>
42+
<% if (section.copyright) { %><div>Copyright: <%= md(section.copyright, true) %></div><% }%>
4243
<% if (section.since) { %><div>Since: <%- section.since %></div><% }%>
4344

44-
<% if (section.params) { %>
45+
<% if (section.params.length) { %>
4546
<div class='py1 quiet mt1 prose-big'>Parameters</div>
4647
<div class='prose'>
4748
<% section.params.forEach(function(param) { %>
@@ -81,7 +82,7 @@
8182
</div>
8283
<% } %>
8384

84-
<% if (section.properties) { %>
85+
<% if (section.properties.length) { %>
8586
<div class='py1 quiet mt1 prose-big'>Properties</div>
8687
<div>
8788
<% section.properties.forEach(function(property) { %>
@@ -108,7 +109,7 @@
108109
</div>
109110
<% } %>
110111

111-
<% if (section.returns) { %>
112+
<% if (section.returns.length) { %>
112113
<% section.returns.forEach(function(ret) { %>
113114
<div class='py1 quiet mt1 prose-big'>Returns</div>
114115
<code><%= formatType(ret.type) %></code><% if (ret.description) { %>:
@@ -117,7 +118,7 @@
117118
<% }) %>
118119
<% } %>
119120

120-
<% if (section.throws) { %>
121+
<% if (section.throws.length) { %>
121122
<div class='py1 quiet mt1 prose-big'>Throws</div>
122123
<ul>
123124
<% section.throws.forEach(function(throws) { %>
@@ -126,7 +127,7 @@
126127
</ul>
127128
<% } %>
128129

129-
<% if (section.examples) { %>
130+
<% if (section.examples.length) { %>
130131
<div class='py1 quiet mt1 prose-big'>Example</div>
131132
<% section.examples.forEach(function(example) { %>
132133
<% if (example.caption) { %><p><%= md(example.caption) %></p><% } %>

lib/output/markdown_ast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ function buildMarkdownAST(comments/*: Array<Comment> */, config/*: Documentation
174174
}
175175

176176
function metaSection(comment/*: Comment */) {
177-
let meta = ['version', 'since', 'copyright', 'author', 'license']
177+
let meta = ['version', 'since', 'copyright', 'author', 'license', 'deprecated']
178178
.filter(tag => comment[tag]);
179179
return !!meta.length && [u('strong', [u('text', 'Meta')])].concat(
180180
u('list', { ordered: false },
181181
meta
182182
.map(tag => {
183183
let metaContent;
184-
if (tag === 'copyright') {
184+
if (tag === 'copyright' || tag === 'deprecated') {
185185
metaContent = comment[tag];
186186
} else {
187187
metaContent = u('text', comment[tag]);

lib/parse.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ var flatteners = {
7777
'copyright': flattenMarkdownDescription,
7878
'default': todo,
7979
'defaultvalue': synonym('default'),
80-
'deprecated': flattenMarkdownDescription,
80+
deprecated(result, tag) {
81+
let description = tag.description || 'This is deprecated.';
82+
result.deprecated = parseMarkdown(description);
83+
},
84+
flattenMarkdownDescription,
8185
'desc': synonym('description'),
8286
'description': flattenMarkdownDescription,
8387
'emits': synonym('fires'),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy