Movatterモバイル変換


[0]ホーム

URL:


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

Commit464257c

Browse files
committed
feat: add php lang
1 parent8dc0b2a commit464257c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

‎lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const DEFAULT_CONFIG = {
2222
'javascript',
2323
'kotlin',
2424
'mysql',
25+
'php',
2526
'python',
2627
'python3',
2728
'ruby',

‎lib/helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const LANGS = [
3939
{lang:'javascript',ext:'.js',style:'c'},
4040
{lang:'kotlin',ext:'.kt',style:'c'},
4141
{lang:'mysql',ext:'.sql',style:'--'},
42+
{lang:'php',ext:'.php',style:'c'},
4243
{lang:'python',ext:'.py',style:'#'},
4344
{lang:'python3',ext:'.py',style:'#'},
4445
{lang:'ruby',ext:'.rb',style:'#'},

‎test/test_helper.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,13 @@ describe('helper', function() {
128128
assert.equal(h.langToExt('java'),'.java');
129129
assert.equal(h.langToExt('javascript'),'.js');
130130
assert.equal(h.langToExt('mysql'),'.sql');
131+
assert.equal(h.langToExt('php'),'.php');
131132
assert.equal(h.langToExt('python'),'.py');
132133
assert.equal(h.langToExt('python3'),'.py');
133134
assert.equal(h.langToExt('ruby'),'.rb');
135+
assert.equal(h.langToExt('rust'),'.rs');
134136
assert.equal(h.langToExt('scala'),'.scala');
135137
assert.equal(h.langToExt('swift'),'.swift');
136-
assert.equal(h.langToExt('rust'),'.rs');
137138
});
138139
});// #langToExt
139140

@@ -146,13 +147,14 @@ describe('helper', function() {
146147
assert.equal(h.extToLang('../file.go'),'golang');
147148
assert.equal(h.extToLang('file.java'),'java');
148149
assert.equal(h.extToLang('c:/file.js'),'javascript');
150+
assert.equal(h.extToLang('~/leetcode/../file.sql'),'mysql');
151+
assert.equal(h.extToLang('~/leetcode/hello.php'),'php');
149152
assert.equal(h.extToLang('c:/Users/skygragon/file.py'),'python');
150153
assert.equal(h.extToLang('~/file.rb'),'ruby');
154+
assert.equal(h.extToLang('~/leetcode/file.rs'),'rust');
151155
assert.equal(h.extToLang('/tmp/file.scala'),'scala');
152156
assert.equal(h.extToLang('~/leetcode/file.swift'),'swift');
153-
assert.equal(h.extToLang('~/leetcode/../file.sql'),'mysql');
154157
assert.equal(h.extToLang('/home/skygragon/file.dat'),'unknown');
155-
assert.equal(h.extToLang('~/leetcode/file.rs'),'rust');
156158
});
157159
});// #extToLang
158160

@@ -170,9 +172,11 @@ describe('helper', function() {
170172
assert.deepEqual(h.langToCommentStyle('java'),C_STYLE);
171173
assert.deepEqual(h.langToCommentStyle('javascript'),C_STYLE);
172174
assert.deepEqual(h.langToCommentStyle('mysql'),SQL_STYLE);
175+
assert.deepEqual(h.langToCommentStyle('php'),C_STYLE);
173176
assert.deepEqual(h.langToCommentStyle('python'),RUBY_STYLE);
174177
assert.deepEqual(h.langToCommentStyle('python3'),RUBY_STYLE);
175178
assert.deepEqual(h.langToCommentStyle('ruby'),RUBY_STYLE);
179+
assert.deepEqual(h.langToCommentStyle('rust'),C_STYLE);
176180
assert.deepEqual(h.langToCommentStyle('scala'),C_STYLE);
177181
assert.deepEqual(h.langToCommentStyle('swift'),C_STYLE);
178182
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp