From 37611a24d0f777986d33a4a025ecd47ec3bd1918 Mon Sep 17 00:00:00 2001 From: Caitlin Eatman Date: Tue, 17 Oct 2017 20:57:46 -0500 Subject: [PATCH 1/2] Now displays @typedef and @returns JSDoc comments. --- res/jsDoc.ejs | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/res/jsDoc.ejs b/res/jsDoc.ejs index 68c71c2..faf3b27 100644 --- a/res/jsDoc.ejs +++ b/res/jsDoc.ejs @@ -9,7 +9,8 @@ <% if(tags.length){ - var hasParams = false, hasReturn = false, hasType = false; -%> + var hasParams = false, hasReturn = false, hasType = false, + hasTypedef = false, hasProperties = false; -%>
<% tags.forEach(function(tag){ @@ -30,7 +31,38 @@ if(tags.length){
<% } - if(tag.type == 'return'){ + if(tag.type == 'typedef'){ + if(!hasTypedef){ + hasTypedef = true; -%> +
Type Definition
+<% } -%> +
+<%= tag.string %> + +<% if(tag.description){ -%> +<%- md(tag.description, true) %> +<% } -%> +
+<% } + + if(tag.type == 'property'){ + if(!hasProperties){ + hasProperties = true; -%> +
Properties
+<% } -%> +
+<%= tag.name %> +<% (tag.types || []).forEach(function(type){ -%> +<%= type %> +<% }); + + if(tag.description){ -%> +<%- md(tag.description, true) %> +<% } -%> +
+<% } + + if(tag.type == 'return' || tag.type == 'returns'){ if(!hasReturn){ hasReturn = true; -%>
Returns
From 49574a0e12423d3fff649161af20b3762bb69a4b Mon Sep 17 00:00:00 2001 From: Caitlin Eatman Date: Tue, 17 Oct 2017 21:37:42 -0500 Subject: [PATCH 2/2] Made @typedef neater. --- res/jsDoc.ejs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/res/jsDoc.ejs b/res/jsDoc.ejs index faf3b27..ffa0798 100644 --- a/res/jsDoc.ejs +++ b/res/jsDoc.ejs @@ -10,7 +10,9 @@ if(tags.length){ var hasParams = false, hasReturn = false, hasType = false, - hasTypedef = false, hasProperties = false; -%> + hasTypedef = false, typedefName = null, + hasProperties = false; -%> +
<% tags.forEach(function(tag){ @@ -31,15 +33,16 @@ if(tags.length){
<% } - if(tag.type == 'typedef'){ - if(!hasTypedef){ - hasTypedef = true; -%> -
Type Definition
-<% } -%> + if(tag.type == 'typedef'){ -%> +
Type Definition
-<%= tag.string %> +<% typedefName = tag.string.replace(/\{([^\}]*)\}/g, ""); -%> +<%= typedefName %> +<% (tag.types || []).forEach(function(type){ -%> +<%= type %> +<% }); -<% if(tag.description){ -%> + if(tag.description){ -%> <%- md(tag.description, true) %> <% } -%>