Skip to content

Commit

Permalink
Merge 1f01b5e into c8c8c45
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriangalliat committed Apr 24, 2015
2 parents c8c8c45 + 1f01b5e commit 998f073
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -95,6 +95,7 @@
"sass-convert": "^0.5.0",
"sassdoc-theme-default": "^2.3.4",
"scss-comment-parser": "^0.6.0",
"strip-indent": "^1.0.1",
"through2": "^0.6.3",
"update-notifier": "^0.3.0",
"vinyl-fs": "^1.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/annotation/annotations/example.js
Expand Up @@ -7,6 +7,7 @@
* <div></div>
*/

const stripIndent = require('strip-indent');
const descRegEx = /(\w+)\s*(?:-?\s*(.*))/;

export default function example() {
Expand Down Expand Up @@ -34,6 +35,8 @@ export default function example() {
// Remove all leading/trailing line breaks.
instance.code = instance.code.replace(/^\n|\n$/g, '');

instance.code = stripIndent(instance.code);

return instance;
},
};
Expand Down
4 changes: 4 additions & 0 deletions test/annotations/example.test.js
Expand Up @@ -15,6 +15,10 @@ describe('#example', function () {
assert.deepEqual(example.parse('\nsome code\n'), { type: 'scss', code: 'some code' });
});

it('should strip indent', function () {
assert.deepEqual(example.parse('\n some code\n indented\n'), { type: 'scss', code: 'some code\n indented' });
});

it('should extract type and description from first line', function () {
assert.deepEqual(example.parse('type\nsome code'), { type: 'type', code: 'some code' });
assert.deepEqual(example.parse('type - description\nsome code'), { type: 'type', description: 'description', code: 'some code' });
Expand Down

0 comments on commit 998f073

Please sign in to comment.