Skip to content

Commit 361e5bf

Browse files
author
Forbes Lindesay
committed
Initial code
0 parents  commit 361e5bf

File tree

6 files changed

+193
-0
lines changed

6 files changed

+193
-0
lines changed

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
lib-cov
2+
*.seed
3+
*.log
4+
*.csv
5+
*.dat
6+
*.out
7+
*.pid
8+
*.gz
9+
pids
10+
logs
11+
results
12+
npm-debug.log
13+
node_modules
14+
/output

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- "0.8"
4+
- "0.10"

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013 Forbes Lindesay
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# brackets-language-extensions
2+
3+
Plugins for langauges supported by CodeMirror but not by brackets
4+
5+
[![Build Status](https://travis-ci.org/ForbesLindesay/brackets-language-extensions.png?branch=master)](https://travis-ci.org/ForbesLindesay/brackets-language-extensions)
6+
[![Dependency Status](https://gemnasium.com/ForbesLindesay/brackets-language-extensions.png)](https://gemnasium.com/ForbesLindesay/brackets-language-extensions)
7+
[![NPM version](https://badge.fury.io/js/brackets-language-extensions.png)](http://badge.fury.io/js/brackets-language-extensions)
8+
9+
## Installation
10+
11+
npm install brackets-language-extensions
12+
13+
## License
14+
15+
MIT

index.js

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
'use strict';
2+
3+
// http://codemirror.net/mode/index.html
4+
// https://github.com/adobe/brackets/blob/master/src/language/languages.json
5+
// https://github.com/git/hello-world
6+
7+
var fs = require('fs');
8+
var rimraf = require('rimraf').sync;
9+
var Zip = require('node-zip');
10+
11+
var languages = {
12+
'apl': {
13+
name: 'APL',
14+
mode: 'apl',
15+
fileExtensions: ['apl'],
16+
lineComment: ['⍝']
17+
},
18+
'cobol': {
19+
name: 'COBOL',
20+
mode: 'cobol',
21+
fileExtensions: ['cbl']
22+
},
23+
'commonlisp': {
24+
name: 'Common Lisp',
25+
mode: 'commonlisp',
26+
fileExtensions: ['clisp', 'lisp'],
27+
lineComment: [';', ';;']
28+
},
29+
'd': {
30+
name: 'D',
31+
mode: 'd',
32+
fileExtensions: ['d'],
33+
lineComment: ['//'],
34+
blockComment: ['/*', '*/']
35+
},
36+
'dtd': {
37+
name: 'DTD',
38+
mode: 'dtd',
39+
fileExtensions: ['dtd'],
40+
blockComment: ['<!--', '-->']
41+
},
42+
'ecl': {
43+
name: 'ECL',
44+
mode: 'ecl',
45+
fileExtensions: ['ecl'],
46+
lineComment: ['//'],
47+
blockComment: ['/*', '*/']
48+
},
49+
'eiffel': {
50+
name: 'Eiffel',
51+
mode: 'eiffel',
52+
fileExtensions: ['e', 'eiff'],
53+
lineComment: ['--']
54+
},
55+
'erlang': {
56+
name: 'Erlang',
57+
mode: 'erlang',
58+
fileExtensions: ['erl', 'escript'],
59+
lineComment: ['%%']
60+
},
61+
'fortran': {
62+
name: 'FORTRAN',
63+
mode: 'fortran',
64+
fileExtensions: ['f90', 'f77'],
65+
lineComment: ['!']
66+
},
67+
'haskell': {
68+
name: 'Haskell',
69+
mode: 'haskell',
70+
fileExtensions: ['hs'],
71+
lineComment: ['--']
72+
},
73+
'haxe': {
74+
name: 'Haxe',
75+
mode: 'haxe',
76+
fileExtensions: ['hx'],
77+
lineComment: ['//'],
78+
blockComment: ['/*', '*/']
79+
},
80+
'http': {
81+
name: 'HTTP',
82+
mode: 'http',
83+
fileExtensions: ['http']
84+
}
85+
};
86+
87+
function plugin(name, mode) {
88+
return 'define(function (require, exports, module) {\n' +
89+
' "use strict";\n' +
90+
' var LanguageManager = brackets.getModule("language/LanguageManager");\n' +
91+
' LanguageManager.defineLanguage(' + JSON.stringify(name) + ', ' +
92+
JSON.stringify(mode) + ');\n' +
93+
'});';
94+
}
95+
function pkg(name, mode) {
96+
var extensions = mode.fileExtensions.map(function (e) { return '.' + e }).join(', ');
97+
return JSON.stringify({
98+
name: name,
99+
title: mode.name + ' Syntax Highlighter',
100+
description: 'Add syntax highlighting support for the ' + mode.name + ' language (' + extensions + ').',
101+
homepage: 'https://github.com/ForbesLindesay/brackets-language-extensions',
102+
version: '1.0.0',
103+
author: 'Forbes Lindesay (http://www.forbeslindesay.co.uk)',
104+
license: 'MIT',
105+
engines: {
106+
'brackets': '>=0.24.0'
107+
}
108+
}, null, ' ');
109+
}
110+
111+
rimraf(__dirname + '/output');
112+
fs.mkdirSync(__dirname + '/output');
113+
Object.keys(languages).forEach(function (name) {
114+
var zip = new Zip();
115+
zip.file('main.js', plugin(name, languages[name]));
116+
zip.file('package.json', pkg(name, languages[name]));
117+
var data = new Buffer(zip.generate({base64: false, compression: 'DEFLATE'}), 'binary');
118+
fs.writeFileSync(__dirname + '/output/' + name + '.zip', data);
119+
});

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "brackets-language-extensions",
3+
"version": "0.0.0",
4+
"description": "Plugins for langauges supported by CodeMirror but not by brackets",
5+
"keywords": [],
6+
"dependencies": {
7+
"node-zip": "~1.0.1",
8+
"rimraf": "~2.2.4"
9+
},
10+
"devDependencies": {
11+
"mocha": "*"
12+
},
13+
"scripts": {
14+
"test": "mocha -R spec"
15+
},
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/ForbesLindesay/brackets-language-extensions.git"
19+
},
20+
"author": "ForbesLindesay",
21+
"license": "MIT"
22+
}

0 commit comments

Comments
 (0)