Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update to documentation 4.0.0-beta11 #3440

Merged
merged 5 commits into from
Oct 24, 2016
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rm -rf coverage .nyc_output

# run linters
npm run lint
npm run lint-docs

# build and run build tests
npm run build-min
Expand Down
50 changes: 27 additions & 23 deletions docs/_theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ var fs = require('fs'),
vfs = require('vinyl-fs'),
_ = require('lodash'),
concat = require('concat-stream'),
formatMarkdown = require('./lib/format_markdown'),
formatParameters = require('./lib/format_parameters');
GithubSlugger = require('github-slugger'),
createFormatters = require('documentation').util.createFormatters,
createLinkerStack = require('documentation').util.createLinkerStack,
hljs = require('highlight.js');

module.exports = function (comments, options, callback) {

var highlight = require('./lib/highlight')(options.hljs || {});
var linkerStack = createLinkerStack(options)
.namespaceResolver(comments, function (namespace) {
var slugger = new GithubSlugger();
return '#' + slugger.slug(namespace);
});

var namespaces = comments.map(function (comment) {
return comment.namespace;
});
var formatters = createFormatters(linkerStack.link);

hljs.configure(options.hljs || {});

var imports = {
shortSignature: function (section, hasSectionName) {
Expand All @@ -27,9 +33,9 @@ module.exports = function (comments, options, callback) {
return '';
}
if (hasSectionName) {
return prefix + section.name + formatParameters(section, true);
} else if (!hasSectionName && formatParameters(section)) {
return formatParameters(section, true);
return prefix + section.name + formatters.parameters(section, true);
} else if (!hasSectionName && formatters.parameters(section)) {
return formatters.parameters(section, true);
} else {
return '()';
}
Expand All @@ -44,13 +50,12 @@ module.exports = function (comments, options, callback) {
}
if (section.returns) {
returns = ': ' +
formatMarkdown.type(section.returns[0].type, namespaces);
formatters.type(section.returns[0].type);
}
if (hasSectionName) {
return prefix + section.name +
formatParameters(section) + returns;
} else if (!hasSectionName && formatParameters(section)) {
return section.name + formatParameters(section) + returns;
return prefix + section.name + formatters.parameters(section) + returns;
} else if (!hasSectionName && formatters.parameters(section)) {
return section.name + formatters.parameters(section) + returns;
} else {
return section.name + '()' + returns;
}
Expand All @@ -62,16 +67,15 @@ module.exports = function (comments, options, callback) {
children: ast.children[0].children.concat(ast.children.slice(1))
};
}
return formatMarkdown(ast, namespaces);
},
formatType: function (section) {
return formatMarkdown.type(section.type, namespaces);
return formatters.markdown(ast);
},
autolink: function (text) {
return formatMarkdown.link(namespaces, text);
},
highlight: function (str) {
return highlight(str);
formatType: formatters.type,
autolink: formatters.autolink,
highlight: function (example) {
if (options.hljs && options.hljs.highlightAuto) {
return hljs.highlightAuto(example).value;
}
return hljs.highlight('js', example).value;
}
};

Expand Down
63 changes: 0 additions & 63 deletions docs/_theme/lib/format_markdown.js

This file was deleted.

39 changes: 0 additions & 39 deletions docs/_theme/lib/format_parameters.js

This file was deleted.

14 changes: 0 additions & 14 deletions docs/_theme/lib/highlight.js

This file was deleted.

24 changes: 9 additions & 15 deletions docs/_theme/section.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,14 @@

<%= md(section.description) %>

<% if (section.augments) { %>
<p>Extends <%= section.augments.map(function(tag) { return autolink(tag.name); }).join(', ') %>.</p>
<% } %>

<% if (section.kind === 'class' && !section.interface) { %>
<div class='code pad1 small round fill-light'><%= signature(section, true) %></div>
<% } %>

<% if (section.augments) { %>
<p>
Extends
<% if (section.augments) { %>
<%= autolink(section.name) %>
<% } %>
</p>
<% } %>

<% if (section.version) { %><div>Version: <%- section.version %></div><% }%>
<% if (section.license) { %><div>License: <%- section.license %></div><% }%>
<% if (section.author) { %><div>Author: <%- section.author %></div><% }%>
Expand All @@ -41,7 +35,7 @@
<% section.params.forEach(function(param) { %>
<div class='space-bottom0'>
<div>
<span class='code strong'><%- param.name%></span> <code class='quiet'>(<%= formatType(param) %><% if (param.default) { %>
<span class='code strong'><%- param.name%></span> <code class='quiet'>(<%= formatType(param.type) %><% if (param.default) { %>
(default <code><%- param.default %></code>)
<% } %>)</code> <%= md(param.description, true) %>
</div>
Expand All @@ -60,7 +54,7 @@
<tbody class='space-top1'>
<% param.properties.forEach(function(property) { %>
<tr>
<td class='break-word'><span class='code strong'><%- property.name %></span> <code class='quiet'><%= formatType(property) %></code>
<td class='break-word'><span class='code strong'><%- property.name %></span> <code class='quiet'><%= formatType(property.type) %></code>
<% if (property.default) { %>
(default <code><%- property.default %></code>)
<% } %></td>
Expand All @@ -80,7 +74,7 @@
<div>
<% section.properties.forEach(function(property) { %>
<div class='space-bottom0'>
<span class='code strong'><%- property.name%></span> <code class='quiet'>(<%= formatType(property) %>)</code>
<span class='code strong'><%- property.name%></span> <code class='quiet'>(<%= formatType(property.type) %>)</code>
<% if (property.default) { %>
(default <code><%- property.default %></code>)
<% } %><% if (property.description) {
Expand All @@ -89,7 +83,7 @@
<% if (property.properties) { %>
<ul>
<% property.properties.forEach(function(property) { %>
<li><code><%- name%></code> <%= formatType(property) %>
<li><code><%- name%></code> <%= formatType(property.type) %>
<% if (property.default) { %>
(default <code><%- property.default %></code>)
<% } %>
Expand All @@ -105,7 +99,7 @@
<% if (section.returns) { %>
<% section.returns.forEach(function(ret) { %>
<div class='pad1y quiet space-top2 prose-big'>Returns</div>
<code><%= formatType(ret) %></code><% if (ret.description) { %>:
<code><%= formatType(ret.type) %></code><% if (ret.description) { %>:
<%= md(ret.description, true) %>
<% }%>
<% }) %>
Expand All @@ -115,7 +109,7 @@
<div class='pad1y quiet space-top2 prose-big'>Throws</div>
<ul>
<% section.throws.forEach(function(throws) { %>
<li><%= formatType(throws) %>: <%= md(throws.description, true) %></li>
<li><%= formatType(throws.type) %>: <%= md(throws.description, true) %></li>
<% }); %>
</ul>
<% } %>
Expand Down
87 changes: 0 additions & 87 deletions docs/_theme/test/format_markdown.js

This file was deleted.

10 changes: 0 additions & 10 deletions docs/_theme/test/format_parameters.js

This file was deleted.

Loading