Skip to content

Commit

Permalink
Merge pull request #59 from straker/trimSectionName
Browse files Browse the repository at this point in the history
trim section name and replace all @ in example
  • Loading branch information
straker authored Apr 17, 2018
2 parents b5e062d + d39b394 commit 7c269dd
Show file tree
Hide file tree
Showing 6 changed files with 7,376 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
.DS_Store
/coverage
examples/**/*.html
bower_components
bower_components
npm-debug.log
7 changes: 4 additions & 3 deletions lib/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var normalizeNewline = require('normalize-newline');
var validFileRegex = /\.[\w]+$/;
var firstLineRegex = /^[\n\r]?([^\n\r]+)/;
var trailingNewline = /\s+$/;
var atSymbolRegex = /@/g;

var forwardReferenceSections = {};

Expand Down Expand Up @@ -46,14 +47,14 @@ var tags = {
// description as the section name and use the rest as the section description
if (!this.tag.description) {
var normDescription = normalizeNewline(this.comment.description);
name = normDescription.match(firstLineRegex)[1];
name = normDescription.match(firstLineRegex)[1].trimRight();
description = normDescription.substr(name.length + 1);
}

// @section defined the name so use the comment description as the section
// description
else {
name = this.tag.description;
name = this.tag.description.trimRight();
description = this.comment.description;
}

Expand Down Expand Up @@ -258,7 +259,7 @@ var tags = {
// @extend %placeholder-selector;
// }
if (this.block.code) {
this.block.code.description = this.block.code.description.replace('@', '@');
this.block.code.description = this.block.code.description.replace(atSymbolRegex, '@');
}
},

Expand Down
Loading

0 comments on commit 7c269dd

Please sign in to comment.