Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fb5f597

Browse files
fixes skygragon#112: use "--" as comment in sql file
Signed-off-by: Eric Wang <skygragon@gmail.com>
1 parent 045528e commit fb5f597

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎lib/helper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const LANGS = [
3838
{lang: 'java', ext: '.java', style: 'c'},
3939
{lang: 'javascript', ext: '.js', style: 'c'},
4040
{lang: 'kotlin', ext: '.kt', style: 'c'},
41-
{lang: 'mysql', ext: '.sql', style: '#'},
41+
{lang: 'mysql', ext: '.sql', style: '--'},
4242
{lang: 'python', ext: '.py', style: '#'},
4343
{lang: 'python3', ext: '.py', style: '#'},
4444
{lang: 'ruby', ext: '.rb', style: '#'},
@@ -131,9 +131,9 @@ h.extToLang = function(fullpath) {
131131
h.langToCommentStyle = function(lang) {
132132
const res = LANGS.find(x => x.lang === lang);
133133

134-
return (res && res.style === '#') ?
135-
{start: '#', line: '#', end: '#'} :
136-
{start: '/*',line: ' *',end: ' */'};
134+
return (res && res.style === 'c') ?
135+
{start: '/*', line: ' *', end: ' */'} :
136+
{start: res.style,line: res.style,end: res.style};
137137
};
138138

139139
h.readStdin = function(cb) {

‎test/test_helper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ describe('helper', function() {
159159
it('should ok', function() {
160160
const C_STYLE = {start: '/*', line: ' *', end: ' */'};
161161
const RUBY_STYLE = {start: '#', line: '#', end: '#'};
162+
const SQL_STYLE = {start: '--', line: '--', end: '--'};
162163

163164
assert.deepEqual(h.langToCommentStyle('bash'), RUBY_STYLE);
164165
assert.deepEqual(h.langToCommentStyle('c'), C_STYLE);
@@ -167,7 +168,7 @@ describe('helper', function() {
167168
assert.deepEqual(h.langToCommentStyle('golang'), C_STYLE);
168169
assert.deepEqual(h.langToCommentStyle('java'), C_STYLE);
169170
assert.deepEqual(h.langToCommentStyle('javascript'), C_STYLE);
170-
assert.deepEqual(h.langToCommentStyle('mysql'), RUBY_STYLE);
171+
assert.deepEqual(h.langToCommentStyle('mysql'), SQL_STYLE);
171172
assert.deepEqual(h.langToCommentStyle('python'), RUBY_STYLE);
172173
assert.deepEqual(h.langToCommentStyle('python3'), RUBY_STYLE);
173174
assert.deepEqual(h.langToCommentStyle('ruby'), RUBY_STYLE);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /