Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updated: Display @typedef and @returns JSDoc comments. #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions res/jsDoc.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<%

if(tags.length){
var hasParams = false, hasReturn = false, hasType = false; -%>
var hasParams = false, hasReturn = false, hasType = false,
hasTypedef = false, typedefName = null,
hasProperties = false; -%>

<div class="details">
<%
tags.forEach(function(tag){
Expand All @@ -30,7 +33,39 @@ if(tags.length){
</div>
<% }

if(tag.type == 'return'){
if(tag.type == 'typedef'){ -%>
<div class="dox_tag_title">Type Definition</div>
<div class="dox_tag_detail">
<% typedefName = tag.string.replace(/\{([^\}]*)\}/g, ""); -%>
<span class="dox_tag_name"><%= typedefName %></span>
<% (tag.types || []).forEach(function(type){ -%>
<span class="dox_type"><%= type %></span>
<% });

if(tag.description){ -%>
<span><%- md(tag.description, true) %></span>
<% } -%>
</div>
<% }

if(tag.type == 'property'){
if(!hasProperties){
hasProperties = true; -%>
<div class="dox_tag_title">Properties</div>
<% } -%>
<div class="dox_tag_detail">
<span class="dox_tag_name"><%= tag.name %></span>
<% (tag.types || []).forEach(function(type){ -%>
<span class="dox_type"><%= type %></span>
<% });

if(tag.description){ -%>
<span><%- md(tag.description, true) %></span>
<% } -%>
</div>
<% }

if(tag.type == 'return' || tag.type == 'returns'){
if(!hasReturn){
hasReturn = true; -%>
<div class="dox_tag_title">Returns</div>
Expand Down