Permalink
Browse files

Merge pull request #80 from kss-node/fix-multiline-comment-start

Fix multiline comment start
  • Loading branch information...
2 parents 80e3d34 + eef2e23 commit 2f8f170b9ebd88f2412989ef62a87b9f831cf171 @JohnAlbin JohnAlbin committed Jul 21, 2014
Showing with 67 additions and 4 deletions.
  1. +3 −4 lib/kss.js
  2. +47 −0 test/fixtures-styles/options-comment-syntax.less
  3. +17 −0 test/kss.js
View
@@ -13,10 +13,9 @@ var walk = require('./walk.js'),
traverse, parse, parseChunk, checkReference, findBlocks, processMarkup,
isDeprecated, isExperimental, hasPrefix,
commentExpressions = {
- single: /\s*?\/\/(.*?)$/g,
- multiStart: /\/\*\!?(.*?)$/,
- multiFinish: /\*\//,
- multiBeforeFinish: /(.*?)\*\//
+ single: /^\s*\/\/.*$/g,
+ multiStart: /^\s*\/\*+\s*$/,
+ multiFinish: /^\s*\*\/\s*$/
};
/**
@@ -0,0 +1,47 @@
+/*
+Comment syntax: multi-line
+
+Using multi-line comment syntax.
+
+Markup:
+<a href="#" class="{$modifiers}">Hello World</a>
+
+:hover - Highlights when moused over
+:disabled - Dims when unavailable
+.primary - Indicates this is a key element
+
+Styleguide 1.1
+*/
+
+// Comment syntax: inline
+//
+// Using inline comment syntax.
+//
+// Styleguide 1.2
+
+
+.example-1-3 {
+ content: 'This string includes the start of a multi-line comment: /*';
+}
+
+// False-positive of multi-line comment block #1
+//
+// Styleguide 1.3
+
+// This single-line comment includes the end of a multi-line comment: */
+
+
+/* A multi-line comment on a single line. */
+
+// False-positive of multi-line comment block #2
+//
+// Markup:
+// <a href="#" class="{$modifiers}">Hello World</a>
+//
+// :hover - Highlights when moused over
+// :disabled - Dims when unavailable
+// .primary - Indicates this is a key element
+//
+// Styleguide 1.4
+
+// This single-line comment includes the end of a multi-line comment: */
View
@@ -306,6 +306,23 @@ suite('#traverse', function() {
});
});
suite('options', function() {
+ suite('.comment-syntax', function() {
+ common.testSection('Comment syntax: multi-line', 'options-comment-syntax.less', function(section) {
+ assert.equal(section.data.reference, '1.1');
+ }, false, { markup: true });
+
+ common.testSection('Comment syntax: inline', 'options-comment-syntax.less', function(section) {
+ assert.equal(section.data.reference, '1.2');
+ }, false, { markup: true });
+
+ common.testSection('False-positive of multi-line comment block #1', 'options-comment-syntax.less', function(section) {
+ assert.equal(section.data.reference, '1.3');
+ }, false, { markup: true });
+
+ common.testSection('False-positive of multi-line comment block #2', 'options-comment-syntax.less', function(section) {
+ assert.equal(section.data.reference, '1.4');
+ }, false, { markup: true });
+ }),
suite('.markup', function() {
common.testSection('Second paragraph', 'options-markup.less', function(section) {
assert.equal(

0 comments on commit 2f8f170

Please sign in to comment.