Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion build/build_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

require("./make_default_helpers_test");

var getRenderer = require('./get_renderer'),
getPartials = require('./get_partials'),
Expand Down
8 changes: 7 additions & 1 deletion build/make_default_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,24 @@ module.exports = function(docMap, config, getCurrent, Handlebars){
var replacer = function (match, content) {
var parts = content.match(linkRegExp),
name,
hashParts,
description,
linkText,
docObject;

name = parts ? parts[1].replace('::', '.prototype.') : content;
hashParts = name.split("#");

if(hashParts.length > 1){
name = hashParts[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’d be nice if there were comments so people reading this code could more easily understand what’s going on here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

docObject = docMap[name]
if (docObject) {
linkText = parts && parts[2] ? parts[2] : docObject.title || name;
description = docObject.description || name;

return '<a href="' + urlTo(name) + '" title="' + stripMarkdown(description) + '">' + linkText + '</a>';
return '<a href="' + urlTo(name) + (hashParts.length > 1 ? ("#" + hashParts.slice(1).join("#")) : "") + '" title="' + stripMarkdown(description) + '">' + linkText + '</a>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be easier to read if this logic happened before the string concatenation.

Also, you could use shift to get the name and then you wouldn't have to slice the array here. 😝

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that

}

if (httpRegExp.test(name)) {
Expand Down
77 changes: 77 additions & 0 deletions build/make_default_helpers_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.