├── test └── unit │ └── Stor.service.spec.js ├── .bowerrc ├── views ├── partials │ └── templates.jade ├── templates │ └── drawer.jade ├── 404.jade └── layout.jade ├── cm ├── .travis.yml ├── .gitignore ├── doc │ ├── baboon.png │ ├── reporting.html │ ├── docs.css │ └── upgrade_v2.2.html ├── .gitattributes ├── theme │ ├── ambiance-mobile.css │ ├── neat.css │ ├── elegant.css │ ├── cobalt.css │ ├── eclipse.css │ ├── night.css │ ├── monokai.css │ ├── erlang-dark.css │ ├── blackboard.css │ ├── rubyblue.css │ ├── vibrant-ink.css │ ├── twilight.css │ ├── lesser-dark.css │ └── xq-dark.css ├── test │ ├── mode_test.css │ ├── run.js │ ├── phantom_driver.js │ └── lint │ │ └── lint.js ├── README.md ├── package.json ├── demo │ ├── resize.html │ ├── matchhighlighter.html │ ├── loadmode.html │ ├── closetag.html │ ├── changemode.html │ ├── variableheight.html │ ├── visibletabs.html │ ├── marker.html │ ├── multiplex.html │ ├── mustache.html │ ├── emacs.html │ ├── runmode.html │ ├── vim.html │ ├── preview.html │ ├── xmlcomplete.html │ ├── complete.html │ ├── folding.html │ ├── formatting.html │ ├── widget.html │ ├── theme.html │ ├── activeline.html │ ├── btree.html │ ├── search.html │ └── collapserange.html ├── LICENSE ├── keymap │ └── emacs.js ├── bin │ └── compress └── CONTRIBUTING.md ├── art └── options-btn.tif ├── public ├── images │ ├── favicon.ico │ ├── loading.gif │ ├── options-btn.png │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── stylesheets │ ├── style.less │ ├── bootstrap │ │ ├── layouts.less │ │ ├── component-animations.less │ │ ├── utilities.less │ │ ├── grid.less │ │ ├── breadcrumbs.less │ │ ├── responsive-768px-979px.less │ │ ├── hero-unit.less │ │ ├── wells.less │ │ ├── responsive-1200px-min.less │ │ ├── close.less │ │ ├── accordion.less │ │ ├── pager.less │ │ ├── media.less │ │ ├── scaffolding.less │ │ ├── responsive.less │ │ ├── thumbnails.less │ │ ├── code.less │ │ ├── alerts.less │ │ ├── bootstrap.less │ │ ├── responsive-utilities.less │ │ ├── tooltip.less │ │ ├── labels-badges.less │ │ ├── modals.less │ │ ├── pagination.less │ │ ├── carousel.less │ │ ├── progress-bars.less │ │ └── popovers.less │ └── app │ │ ├── navbar.less │ │ └── gh.less └── javascripts │ ├── src │ ├── lodash-extenders.js │ ├── Less2Css │ │ ├── controllers │ │ │ ├── AppCtrl.js │ │ │ ├── Less2CssCtrl.js │ │ │ └── OptionsCtrl.js │ │ ├── less2css.js │ │ ├── directives │ │ │ ├── drawer.js │ │ │ └── lessEditor.js │ │ └── services │ │ │ ├── LessLoader.js │ │ │ ├── LessOptions.js │ │ │ └── LessCompiler.js │ ├── Stor │ │ └── angular-stor.js │ └── base-extenders.js │ └── vendor │ └── cm │ └── addon │ ├── fold │ ├── foldcode.js │ └── brace-fold.js │ └── edit │ ├── closebrackets.js │ └── matchbrackets.js ├── .gitmodules ├── .tern-project ├── bower.json ├── express ├── versions.js ├── shortener.js ├── less-express-compiler.js ├── app-scripts.js ├── karma.e2e.conf.js ├── less-options.js └── karma.conf.js ├── todo.todo ├── routes └── index.js ├── .jshintrc ├── less-preview.sublime-project ├── package.json ├── changelog.md ├── .gitignore ├── app.js ├── Readme.md └── Gruntfile.js /test/unit/Stor.service.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/components" 3 | } -------------------------------------------------------------------------------- /views/partials/templates.jade: -------------------------------------------------------------------------------- 1 | include ../templates/drawer -------------------------------------------------------------------------------- /cm/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | -------------------------------------------------------------------------------- /cm/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /npm-debug.log 3 | test.html 4 | -------------------------------------------------------------------------------- /cm/doc/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/cm/doc/baboon.png -------------------------------------------------------------------------------- /art/options-btn.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/art/options-btn.tif -------------------------------------------------------------------------------- /public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/favicon.ico -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/options-btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/options-btn.png -------------------------------------------------------------------------------- /public/images/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/glyphicons-halflings.png -------------------------------------------------------------------------------- /public/images/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /cm/.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt text 2 | *.js text 3 | *.html text 4 | *.md text 5 | *.json text 6 | *.yml text 7 | *.css text 8 | *.svg text 9 | -------------------------------------------------------------------------------- /cm/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | -o-box-shadow: none; 5 | box-shadow: none; 6 | } 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "less"] 2 | path = less 3 | url = https://github.com/less/less.js 4 | [submodule "CodeMirror"] 5 | path = CodeMirror 6 | url = https://github.com/marijnh/CodeMirror.git 7 | -------------------------------------------------------------------------------- /.tern-project: -------------------------------------------------------------------------------- 1 | { 2 | "libs": [ 3 | "ecma5", 4 | "browser", 5 | "jquery", 6 | "underscore" 7 | ], 8 | "plugins": { 9 | "angular": true, 10 | "node": {} 11 | } 12 | } -------------------------------------------------------------------------------- /views/templates/drawer.jade: -------------------------------------------------------------------------------- 1 | | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "less2css", 3 | "private": true, 4 | "dependencies": { 5 | "angular": "~1.2.15", 6 | "angular-animate": "~1.2.15", 7 | "bootstrap": "~3.1.1", 8 | "lodash": "~2.4.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /cm/test/mode_test.css: -------------------------------------------------------------------------------- 1 | .mt-output .mt-token { 2 | border: 1px solid #ddd; 3 | white-space: pre; 4 | font-family: "Consolas", monospace; 5 | text-align: center; 6 | } 7 | 8 | .mt-output .mt-style { 9 | font-size: x-small; 10 | } 11 | -------------------------------------------------------------------------------- /public/stylesheets/style.less: -------------------------------------------------------------------------------- 1 | // Tweak bootstrap imports to customize for requirements 2 | @import "codemirror"; 3 | @import "bootstrap/bootstrap"; 4 | @import "bootstrap/responsive"; 5 | @import "app/gh"; 6 | @import "app/navbar"; 7 | @import "app/main"; -------------------------------------------------------------------------------- /public/javascripts/src/lodash-extenders.js: -------------------------------------------------------------------------------- 1 | _.mixin({ 2 | hasContent: function(obj) { 3 | return !_.isEmpty(obj); 4 | }, 5 | 6 | lastIndex: function(obj) { 7 | return _.size(obj) - 1; 8 | }, 9 | 10 | slice: function(obj, idx1, idx2) { 11 | return Array.prototype.slice.call(obj, idx1, idx2); 12 | } 13 | }); -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/controllers/AppCtrl.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .controller('AppCtrl', [ 4 | '$scope', 5 | 'LessOptions', 6 | function($scope, LessOptions) { 7 | $scope.opts = LessOptions.options; 8 | 9 | $scope.toggleDrawer = function(ev) { 10 | ev.preventDefault(); 11 | $scope.drawerOpen = !$scope.drawerOpen; 12 | }; 13 | } 14 | ]); 15 | -------------------------------------------------------------------------------- /views/404.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block topScripts 4 | 5 | block header 6 | li.brand: a(href='/') LESS2CSS 7 | li.divider-vertical 8 | 9 | block content 10 | div.row-fluid 11 | div.span3.four-oh-four 12 | h1 4 13 | h1 0 14 | h1 4 15 | 16 | div.span9.four-oh-four.right-text 17 | h2 The page you are requesting does not exist. 18 | 19 | block bottomScripts -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/layouts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Layouts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container (centered, fixed-width layouts) 7 | .container { 8 | .container-fixed(); 9 | } 10 | 11 | // Fluid layouts (left aligned, with sidebar, min- & max-width content) 12 | .container-fluid { 13 | padding-right: @gridGutterWidth; 14 | padding-left: @gridGutterWidth; 15 | .clearfix(); 16 | } -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | 6 | .fade { 7 | opacity: 0; 8 | .transition(opacity .15s linear); 9 | &.in { 10 | opacity: 1; 11 | } 12 | } 13 | 14 | .collapse { 15 | position: relative; 16 | height: 0; 17 | overflow: hidden; 18 | .transition(height .35s ease); 19 | &.in { 20 | height: auto; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /express/versions.js: -------------------------------------------------------------------------------- 1 | var q = require('q'); 2 | var path = require('path'); 3 | var exec = require('child_process').exec; 4 | 5 | exec('git tag', { 6 | cwd: path.join(__dirname, '../less') 7 | }, function(err, stdout, stderr) { 8 | if (err) { 9 | var errorMsg = ["Ummm, some issues w/ getting tags", err, stderr].join('\n'); 10 | console.error(errorMsg); 11 | process.exit(0); 12 | } 13 | 14 | var tags = stdout.split('\n'); 15 | console.log(tags); 16 | }); -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Quick floats 7 | .pull-right { 8 | float: right; 9 | } 10 | .pull-left { 11 | float: left; 12 | } 13 | 14 | // Toggling content 15 | .hide { 16 | display: none; 17 | } 18 | .show { 19 | display: block; 20 | } 21 | 22 | // Visibility 23 | .invisible { 24 | visibility: hidden; 25 | } 26 | 27 | // For Affix plugin 28 | .affix { 29 | position: fixed; 30 | } 31 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Fixed (940px) 7 | #grid > .core(@gridColumnWidth, @gridGutterWidth); 8 | 9 | // Fluid (940px) 10 | #grid > .fluid(@fluidGridColumnWidth, @fluidGridGutterWidth); 11 | 12 | // Reset utility classes due to specificity 13 | [class*="span"].hide, 14 | .row-fluid [class*="span"].hide { 15 | display: none; 16 | } 17 | 18 | [class*="span"].pull-right, 19 | .row-fluid [class*="span"].pull-right { 20 | float: right; 21 | } 22 | -------------------------------------------------------------------------------- /cm/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: 8px 15px; 8 | margin: 0 0 @baseLineHeight; 9 | list-style: none; 10 | background-color: #f5f5f5; 11 | .border-radius(@baseBorderRadius); 12 | > li { 13 | display: inline-block; 14 | .ie7-inline-block(); 15 | text-shadow: 0 1px 0 @white; 16 | > .divider { 17 | padding: 0 5px; 18 | color: #ccc; 19 | } 20 | } 21 | > .active { 22 | color: @grayLight; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-768px-979px.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Tablet to desktop 3 | // -------------------------------------------------- 4 | 5 | 6 | @media (min-width: 768px) and (max-width: 979px) { 7 | 8 | // Fixed grid 9 | #grid > .core(@gridColumnWidth768, @gridGutterWidth768); 10 | 11 | // Fluid grid 12 | #grid > .fluid(@fluidGridColumnWidth768, @fluidGridGutterWidth768); 13 | 14 | // Input grid 15 | #grid > .input(@gridColumnWidth768, @gridGutterWidth768); 16 | 17 | // No need to reset .thumbnails here since it's the same @gridGutterWidth 18 | 19 | } 20 | -------------------------------------------------------------------------------- /cm/README.md: -------------------------------------------------------------------------------- 1 | # CodeMirror [](http://travis-ci.org/marijnh/CodeMirror) 2 | 3 | CodeMirror is a JavaScript component that provides a code editor in 4 | the browser. When a mode is available for the language you are coding 5 | in, it will color your code, and optionally help with indentation. 6 | 7 | The project page is http://codemirror.net 8 | The manual is at http://codemirror.net/doc/manual.html 9 | The contributing guidelines are in [CONTRIBUTING.md](https://github.com/marijnh/CodeMirror/blob/master/CONTRIBUTING.md) 10 | -------------------------------------------------------------------------------- /cm/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | .cm-s-elegant span.cm-link {color: #762;} 11 | -------------------------------------------------------------------------------- /todo.todo: -------------------------------------------------------------------------------- 1 | Routes: 2 | 3 | ☐ Hook up all routing 4 | ☐ Move route definitions to routes folder 5 | 6 | General: 7 | 8 | ☐ Add dev / prod hooks for conditional rendering 9 | 10 | Snippets: 11 | 12 | ☐ Define module and associated Mongoose schema 13 | ☐ Investigate utility of redis cache layer 14 | 15 | Gists: 16 | 17 | ☐ Hook up oAuth layer 18 | ☐ Create "sign in" 19 | ☐ Connect to gist api 20 | 21 | Build: 22 | 23 | ☐ Fix banners (use concat) 24 | ☐ Fix coffee build using manual task and concat 25 | ☐ Add daily build for pre-release (fetch dist and project and build) 26 | ☐ Move away from using github for LESS dist .js -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var lessOpts = require('../express/less-options'); 2 | 3 | module.exports = { 4 | four_oh_four: function(req, res) { 5 | res.status(404); 6 | 7 | if (req.accepts('html')) return res.render("404", { app: '', title: 'LESS2CSS | 404' }); 8 | if (req.accepts('json')) return res.send({ error: 'Not Found' }); 9 | return res.type('txt').send('404 Not Found'); 10 | }, 11 | 12 | home: function(req, res) { 13 | var opts = { app: 'Less2Css', title : 'LESS2CSS | LESS Live Preview' }; 14 | res.render('less2css', opts); 15 | }, 16 | 17 | less_options: function(req, res) { 18 | res.json(lessOpts); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /express/shortener.js: -------------------------------------------------------------------------------- 1 | var alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split(''); 2 | var base = alphabet.length; 3 | 4 | module.exports = { 5 | encode: function(i) { 6 | if (i === 0) return alphabet[0]; 7 | var s = ''; 8 | 9 | while (i > 0) { 10 | s += alphabet[i % base]; 11 | i = parseInt(i / base, 10); 12 | } 13 | 14 | return s.split('').reverse().join(''); 15 | }, 16 | 17 | decode: function(s) { 18 | var len = s.length; 19 | var i = 0; 20 | 21 | while (i < len) { 22 | var c = s[i]; 23 | var i = i * base + alphabet.indexOf(c); 24 | } 25 | 26 | return i; 27 | } 28 | }; -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/hero-unit.less: -------------------------------------------------------------------------------- 1 | // 2 | // Hero unit 3 | // -------------------------------------------------- 4 | 5 | 6 | .hero-unit { 7 | padding: 60px; 8 | margin-bottom: 30px; 9 | font-size: 18px; 10 | font-weight: 200; 11 | line-height: @baseLineHeight * 1.5; 12 | color: @heroUnitLeadColor; 13 | background-color: @heroUnitBackground; 14 | .border-radius(6px); 15 | h1 { 16 | margin-bottom: 0; 17 | font-size: 60px; 18 | line-height: 1; 19 | color: @heroUnitHeadingColor; 20 | letter-spacing: -1px; 21 | } 22 | li { 23 | line-height: @baseLineHeight * 1.5; // Reset since we specify in type.less 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "sub" : true, 3 | "boss" : true, 4 | "expr" : true, 5 | "node" : true, 6 | "devel" : true, 7 | "curly" : false, 8 | "immed" : true, 9 | "noarg" : true, 10 | "undef" : true, 11 | "newcap" : true, 12 | "shadow" : true, 13 | "newcap" : false, 14 | "eqnull" : true, 15 | "jquery" : true, 16 | "eqeqeq" : true, 17 | "browser" : true, 18 | "latedef" : false, 19 | "supernew" : true, 20 | "laxcomma" : false, 21 | "laxbreak" : true, 22 | "globals" : { 23 | "_" : true, 24 | "less" : true, 25 | "angular" : true, 26 | "CodeMirror" : true 27 | } 28 | } -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @wellBackground; 12 | border: 1px solid darken(@wellBackground, 7%); 13 | .border-radius(@baseBorderRadius); 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-large { 23 | padding: 24px; 24 | .border-radius(@borderRadiusLarge); 25 | } 26 | .well-small { 27 | padding: 9px; 28 | .border-radius(@borderRadiusSmall); 29 | } 30 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-1200px-min.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Large desktop and up 3 | // -------------------------------------------------- 4 | 5 | 6 | @media (min-width: 1200px) { 7 | 8 | // Fixed grid 9 | #grid > .core(@gridColumnWidth1200, @gridGutterWidth1200); 10 | 11 | // Fluid grid 12 | #grid > .fluid(@fluidGridColumnWidth1200, @fluidGridGutterWidth1200); 13 | 14 | // Input grid 15 | #grid > .input(@gridColumnWidth1200, @gridGutterWidth1200); 16 | 17 | // Thumbnails 18 | .thumbnails { 19 | margin-left: -@gridGutterWidth1200; 20 | } 21 | .thumbnails > li { 22 | margin-left: @gridGutterWidth1200; 23 | } 24 | .row-fluid .thumbnails { 25 | margin-left: 0; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: 20px; 9 | font-weight: bold; 10 | line-height: @baseLineHeight; 11 | color: @black; 12 | text-shadow: 0 1px 0 rgba(255,255,255,1); 13 | .opacity(20); 14 | &:hover, 15 | &:focus { 16 | color: @black; 17 | text-decoration: none; 18 | cursor: pointer; 19 | .opacity(40); 20 | } 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | button.close { 27 | padding: 0; 28 | cursor: pointer; 29 | background: transparent; 30 | border: 0; 31 | -webkit-appearance: none; 32 | } 33 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/accordion.less: -------------------------------------------------------------------------------- 1 | // 2 | // Accordion 3 | // -------------------------------------------------- 4 | 5 | 6 | // Parent container 7 | .accordion { 8 | margin-bottom: @baseLineHeight; 9 | } 10 | 11 | // Group == heading + body 12 | .accordion-group { 13 | margin-bottom: 2px; 14 | border: 1px solid #e5e5e5; 15 | .border-radius(@baseBorderRadius); 16 | } 17 | .accordion-heading { 18 | border-bottom: 0; 19 | } 20 | .accordion-heading .accordion-toggle { 21 | display: block; 22 | padding: 8px 15px; 23 | } 24 | 25 | // General toggle styles 26 | .accordion-toggle { 27 | cursor: pointer; 28 | } 29 | 30 | // Inner needs the styles because you can't animate properly with any styles on the element 31 | .accordion-inner { 32 | padding: 9px 15px; 33 | border-top: 1px solid #e5e5e5; 34 | } 35 | -------------------------------------------------------------------------------- /less-preview.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "name": "Base", 6 | "follow_symlinks": true, 7 | "path": ".", 8 | "folder_exclude_patterns": ["*"] 9 | }, 10 | { 11 | "name": "CodeMirror", 12 | "path": "CodeMirror" 13 | }, 14 | { 15 | "name": "Express", 16 | "path": "express" 17 | }, 18 | { 19 | "name": "LESS", 20 | "path": "less" 21 | }, 22 | { 23 | "name": "Routes", 24 | "path": "routes" 25 | }, 26 | { 27 | "name": "Views", 28 | "path": "views" 29 | }, 30 | { 31 | "name": "Stylesheets", 32 | "path": "public/stylesheets" 33 | }, 34 | { 35 | "name": "JavaScripts", 36 | "path": "public/javascripts" 37 | }, 38 | { 39 | "name": "Components", 40 | "path": "public/components" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | margin: @baseLineHeight 0; 8 | list-style: none; 9 | text-align: center; 10 | .clearfix(); 11 | } 12 | .pager li { 13 | display: inline; 14 | } 15 | .pager li > a, 16 | .pager li > span { 17 | display: inline-block; 18 | padding: 5px 14px; 19 | background-color: #fff; 20 | border: 1px solid #ddd; 21 | .border-radius(15px); 22 | } 23 | .pager li > a:hover, 24 | .pager li > a:focus { 25 | text-decoration: none; 26 | background-color: #f5f5f5; 27 | } 28 | .pager .next > a, 29 | .pager .next > span { 30 | float: right; 31 | } 32 | .pager .previous > a, 33 | .pager .previous > span { 34 | float: left; 35 | } 36 | .pager .disabled > a, 37 | .pager .disabled > a:hover, 38 | .pager .disabled > a:focus, 39 | .pager .disabled > span { 40 | color: @grayLight; 41 | background-color: #fff; 42 | cursor: default; 43 | } 44 | -------------------------------------------------------------------------------- /cm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codemirror", 3 | "version":"3.0.21", 4 | "main": "codemirror.js", 5 | "description": "In-browser code editing made bearable", 6 | "licenses": [{"type": "MIT", 7 | "url": "http://codemirror.net/LICENSE"}], 8 | "directories": {"lib": "./lib"}, 9 | "scripts": {"test": "node ./test/run.js"}, 10 | "devDependencies": {"node-static": "0.6.0"}, 11 | "bugs": "http://github.com/marijnh/CodeMirror/issues", 12 | "keywords": ["JavaScript", "CodeMirror", "Editor"], 13 | "homepage": "http://codemirror.net", 14 | "maintainers":[{"name": "Marijn Haverbeke", 15 | "email": "marijnh@gmail.com", 16 | "web": "http://marijnhaverbeke.nl"}], 17 | "repositories": [{"type": "git", 18 | "url": "http://marijnhaverbeke.nl/git/codemirror"}, 19 | {"type": "git", 20 | "url": "https://github.com/marijnh/CodeMirror.git"}] 21 | } 22 | -------------------------------------------------------------------------------- /cm/test/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var lint = require("./lint/lint"); 4 | 5 | lint.checkDir("mode"); 6 | lint.checkDir("lib"); 7 | 8 | var ok = lint.success(); 9 | 10 | var files = new (require('node-static').Server)('.'); 11 | 12 | var server = require('http').createServer(function (req, res) { 13 | req.addListener('end', function () { 14 | files.serve(req, res); 15 | }); 16 | }).addListener('error', function (err) { 17 | throw err; 18 | }).listen(3000, function () { 19 | var child_process = require('child_process'); 20 | child_process.exec("which phantomjs", function (err) { 21 | if (err) { 22 | console.error("PhantomJS is not installed. Download from http://phantomjs.org"); 23 | process.exit(1); 24 | } 25 | var cmd = 'phantomjs test/phantom_driver.js'; 26 | child_process.exec(cmd, function (err, stdout) { 27 | server.close(); 28 | console.log(stdout); 29 | process.exit(err || !ok ? 1 : 0); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /cm/test/phantom_driver.js: -------------------------------------------------------------------------------- 1 | var page = require('webpage').create(); 2 | 3 | page.open("http://localhost:3000/test/index.html", function (status) { 4 | if (status != "success") { 5 | console.log("page couldn't be loaded successfully"); 6 | phantom.exit(1); 7 | } 8 | waitFor(function () { 9 | return page.evaluate(function () { 10 | var output = document.getElementById('status'); 11 | if (!output) { return false; } 12 | return (/^(\d+ failures?|all passed)/i).test(output.innerText); 13 | }); 14 | }, function () { 15 | var failed = page.evaluate(function () { return window.failed; }); 16 | var output = page.evaluate(function () { 17 | return document.getElementById('output').innerText + "\n" + 18 | document.getElementById('status').innerText; 19 | }); 20 | console.log(output); 21 | phantom.exit(failed > 0 ? 1 : 0); 22 | }); 23 | }); 24 | 25 | function waitFor (test, cb) { 26 | if (test()) { 27 | cb(); 28 | } else { 29 | setTimeout(function () { waitFor(test, cb); }, 250); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cm/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | .cm-s-cobalt span.cm-link { color: #845dc4; } 19 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/media.less: -------------------------------------------------------------------------------- 1 | // Media objects 2 | // Source: http://stubbornella.org/content/?p=497 3 | // -------------------------------------------------- 4 | 5 | 6 | // Common styles 7 | // ------------------------- 8 | 9 | // Clear the floats 10 | .media, 11 | .media-body { 12 | overflow: hidden; 13 | *overflow: visible; 14 | zoom: 1; 15 | } 16 | 17 | // Proper spacing between instances of .media 18 | .media, 19 | .media .media { 20 | margin-top: 15px; 21 | } 22 | .media:first-child { 23 | margin-top: 0; 24 | } 25 | 26 | // For images and videos, set to block 27 | .media-object { 28 | display: block; 29 | } 30 | 31 | // Reset margins on headings for tighter default spacing 32 | .media-heading { 33 | margin: 0 0 5px; 34 | } 35 | 36 | 37 | // Media image alignment 38 | // ------------------------- 39 | 40 | .media > .pull-left { 41 | margin-right: 10px; 42 | } 43 | .media > .pull-right { 44 | margin-left: 10px; 45 | } 46 | 47 | 48 | // Media list variation 49 | // ------------------------- 50 | 51 | // Undo default ul/ol styles 52 | .media-list { 53 | margin-left: 0; 54 | list-style: none; 55 | } 56 | -------------------------------------------------------------------------------- /cm/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | .cm-s-eclipse span.cm-link {color: #219;} 21 | 22 | .cm-s-eclipse .CodeMirror-matchingbracket { 23 | border:1px solid grey; 24 | color:black !important;; 25 | } 26 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/scaffolding.less: -------------------------------------------------------------------------------- 1 | // 2 | // Scaffolding 3 | // -------------------------------------------------- 4 | 5 | 6 | // Body reset 7 | // ------------------------- 8 | 9 | body { 10 | margin: 0; 11 | font-family: @baseFontFamily; 12 | font-size: @baseFontSize; 13 | line-height: @baseLineHeight; 14 | color: @textColor; 15 | background-color: @bodyBackground; 16 | } 17 | 18 | 19 | // Links 20 | // ------------------------- 21 | 22 | a { 23 | color: @linkColor; 24 | text-decoration: none; 25 | } 26 | a:hover, 27 | a:focus { 28 | color: @linkColorHover; 29 | text-decoration: underline; 30 | } 31 | 32 | 33 | // Images 34 | // ------------------------- 35 | 36 | // Rounded corners 37 | .img-rounded { 38 | .border-radius(6px); 39 | } 40 | 41 | // Add polaroid-esque trim 42 | .img-polaroid { 43 | padding: 4px; 44 | background-color: #fff; 45 | border: 1px solid #ccc; 46 | border: 1px solid rgba(0,0,0,.2); 47 | .box-shadow(0 1px 3px rgba(0,0,0,.1)); 48 | } 49 | 50 | // Perfect circle 51 | .img-circle { 52 | .border-radius(500px); // crank the border-radius so it works with most reasonably sized images 53 | } 54 | -------------------------------------------------------------------------------- /public/javascripts/src/Stor/angular-stor.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Stor', []) 3 | .factory('Stor', [ 4 | '$q', 5 | '$window', 6 | '$timeout', 7 | '$rootScope', 8 | function($q, $window, $timeout, $rootScope) { 9 | var StorageClass = $window.Stor; 10 | 11 | _.extend(StorageClass.prototype, { 12 | getAsync: function(fn) { 13 | var ret = {}; 14 | var self = this; 15 | var data = self.get.call(self); // Try from localStorage 16 | var deferred = $q.defer(); 17 | var req; 18 | 19 | if (data) { 20 | var mockdefer = $q.defer(); 21 | req = mockdefer.promise; 22 | 23 | $timeout(function() { 24 | mockdefer.resolve({ data: data, status: 200, type: 'local' }); 25 | }, 1, false); 26 | } else { 27 | req = fn(); 28 | ret.type = 'xhr'; 29 | } 30 | 31 | req.then(function(res) { 32 | return $rootScope.$safeApply(function() { 33 | _.extend(ret, res); 34 | deferred.resolve(ret); 35 | }); 36 | }); 37 | 38 | return deferred.promise; 39 | } 40 | }); 41 | 42 | return StorageClass; 43 | } 44 | ]); -------------------------------------------------------------------------------- /cm/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | .cm-s-night span.cm-link { color: #845dc4; } 22 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/less2css.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css', ['Stor', 'TransitionHelper']) 3 | .config([ 4 | '$provide', 5 | function($provide) { 6 | $provide.decorator('$rootScope', [ 7 | '$delegate', 8 | function($rootScope) { 9 | $rootScope.$safeApply = function() { 10 | var $scope, fn; 11 | var args = arguments; 12 | var force = false; 13 | 14 | switch (args.length) { 15 | case 1: 16 | var arg = args[0]; 17 | if (_.isFunction(arg)) fn = arg; 18 | else $scope = arg; 19 | break; 20 | case 3: 21 | force = !!args[2]; 22 | /* falls through */ 23 | case 2: 24 | $scope = args[0]; 25 | fn = args[1]; 26 | break; 27 | } 28 | 29 | $scope = $scope || $rootScope; 30 | fn = fn || _.noop; 31 | 32 | if(force || !$scope.$$phase) { 33 | $scope.$apply ? $scope.$apply(fn) : $scope.apply(fn); 34 | } else { 35 | fn(); 36 | } 37 | }; 38 | 39 | return $rootScope; 40 | } 41 | ]); 42 | } 43 | ]); -------------------------------------------------------------------------------- /cm/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |By setting a few CSS properties, CodeMirror can be made to 37 | automatically resize to fit its content.
38 | 39 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /cm/theme/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 22 | .cm-s-monokai span.cm-tag {color: #f92672;} 23 | .cm-s-monokai span.cm-link {color: #ae81ff;} 24 | 25 | .cm-s-monokai .CodeMirror-matchingbracket { 26 | text-decoration: underline; 27 | color: white !important; 28 | } 29 | -------------------------------------------------------------------------------- /express/less-express-compiler.js: -------------------------------------------------------------------------------- 1 | var __ = require('lodash'); 2 | var lessOpts = require('./less-options'); 3 | var lessPath = '../public/javascripts/less'; 4 | var LessCompiler; 5 | 6 | exports.LessCompiler = LessCompiler = (function(){ 7 | function LessCompiler(version, options) { 8 | this.version = version || __.find(lessOpts.lessVersions, function(version) { 9 | return version.type === 'current'; 10 | }); 11 | this.options = options || lessOpts.lessOptions; 12 | this.setupVersions(lessOpts.lessVersions); 13 | } 14 | 15 | LessCompiler.prototype = { 16 | setupVersions: function(versions) { 17 | var len = versions.length; 18 | var i = 0; 19 | 20 | this.versions = []; 21 | 22 | while(i < len) { 23 | var version = versions[i]; 24 | var obj = {}; 25 | var sub = version.type === 'pre' ? version.label.replace(/[\d\.]+\s\(([\w\d-]+)\)/i, '-$1') : ''; 26 | var fileName = 'less-' + version.number + sub; 27 | 28 | obj.version = version.number; 29 | obj.less = require(lessPath + "/" + fileName); 30 | // File still WIP 31 | this.versions.push(obj); 32 | i++; 33 | } 34 | }, 35 | 36 | compile: function(version, options) {} 37 | }; 38 | 39 | return LessCompiler; 40 | }()); -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/directives/drawer.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .directive('drawer', [ 4 | 'TransitionHelper', 5 | function(TransitionHelper) { 6 | return { 7 | replace : true, 8 | restrict : 'E', 9 | transclude : true, 10 | templateUrl : 'drawer.html', 11 | scope: { 12 | open : '=', 13 | opts : '=', 14 | offset : '=', 15 | position : '=' 16 | }, 17 | 18 | link: function(scope, elem) { 19 | var el = scope.el = elem[0]; 20 | var translateAxis = scope.position === 'top' || scope.position === 'bottom' 21 | ? 'Y' 22 | : 'X'; 23 | 24 | function toggleDrawer(isOpen) { 25 | updateModelDimensions(); 26 | 27 | var translateVal = isOpen 28 | ? scope.offset 29 | : -scope.height + _.parseInt(scope.offset); 30 | 31 | TransitionHelper['translate' + translateAxis](el, translateVal); 32 | el.style.opacity = isOpen ? 1 : 0; 33 | } 34 | 35 | function updateModelDimensions() { 36 | scope.height = el.offsetHeight; 37 | scope.width = el.offsetWidth; 38 | } 39 | 40 | scope.$watch('open', toggleDrawer); 41 | } 42 | }; 43 | } 44 | ]); -------------------------------------------------------------------------------- /cm/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Marijn HaverbekeHighlight matches of selected text on select
34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /cm/demo/loadmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |24 | 25 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Note: `.thumbnails` and `.thumbnails > li` are overriden in responsive files 7 | 8 | // Make wrapper ul behave like the grid 9 | .thumbnails { 10 | margin-left: -@gridGutterWidth; 11 | list-style: none; 12 | .clearfix(); 13 | } 14 | // Fluid rows have no left margin 15 | .row-fluid .thumbnails { 16 | margin-left: 0; 17 | } 18 | 19 | // Float li to make thumbnails appear in a row 20 | .thumbnails > li { 21 | float: left; // Explicity set the float since we don't require .span* classes 22 | margin-bottom: @baseLineHeight; 23 | margin-left: @gridGutterWidth; 24 | } 25 | 26 | // The actual thumbnail (can be `a` or `div`) 27 | .thumbnail { 28 | display: block; 29 | padding: 4px; 30 | line-height: @baseLineHeight; 31 | border: 1px solid #ddd; 32 | .border-radius(@baseBorderRadius); 33 | .box-shadow(0 1px 3px rgba(0,0,0,.055)); 34 | .transition(all .2s ease-in-out); 35 | } 36 | // Add a hover/focus state for linked versions only 37 | a.thumbnail:hover, 38 | a.thumbnail:focus { 39 | border-color: @linkColor; 40 | .box-shadow(0 1px 4px rgba(0,105,214,.25)); 41 | } 42 | 43 | // Images and captions 44 | .thumbnail > img { 45 | display: block; 46 | max-width: 100%; 47 | margin-left: auto; 48 | margin-right: auto; 49 | } 50 | .thumbnail .caption { 51 | padding: 9px; 52 | color: @gray; 53 | } 54 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 0.0.9 4 | - Test 5 | 6 | ### 0.0.8 7 | - Fix issue where error of type `File` (e.g. 404 on @import) kills the parser until refresh. 8 | - Fix bug in `Stor` where cache doesn't expire 9 | - Added daily options check to keep versions up to date and allow additional options 10 | - Clean-up modules and upgrade Lodash to 2.4.1 11 | - Update Less to 1.5.1 12 | 13 | ### 0.0.7 14 | - Huge refactor / mess reduction 15 | - Fixed LESS core stuff from 1.4 16 | - Lots of styling improvements 17 | 18 | ### 0.0.6 19 | - Major changes to build 20 | - Converted to from Coffee to full JS 21 | - Rename `strictMaths` to `strictMath` per LESS 1.4 beta 22 | 23 | ### 0.0.5 24 | - Added "Legacy Maths/Units" for LESS 1.4 compatibility. 25 | - Upgraded Grunt and all Grunt-contrib to 0.4.0 stable 26 | - Various tweaks and improvements 27 | 28 | ### 0.0.4 29 | - Converted site to AngularJS for a better framework to manage future feature additions 30 | - Removed highlight.js 31 | - Both input and output use CodeMirror editors now for line-numbers and easily selectable CSS 32 | - Some styling and performance tweaks 33 | 34 | ### 0.0.3 35 | - Added options drawer for better control 36 | - Cleaned up build process 37 | - Added middleware for better performance / security 38 | 39 | ### 0.0.2 40 | - No longer running on gh-pages. 41 | - Re-wrote with Express and Coffeescript 42 | - Grunt build 43 | - Added pre-release LESS 44 | -------------------------------------------------------------------------------- /cm/demo/closetag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
On changes to the content of the above editor, a (crude) script 28 | tries to auto-detect the language used, and switches the editor to 29 | either JavaScript or Scheme mode based on that.
30 | 31 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/controllers/Less2CssCtrl.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .controller('Less2CssCtrl', [ 4 | '$scope', 5 | 'LessLoader', 6 | 'LessOptions', 7 | 'LessCompiler', 8 | function($scope, LessLoader, LessOptions, LessCompiler) { 9 | var _opts; 10 | // Start req for options 11 | LessOptions.request.then(setupOptions); 12 | 13 | function setupOptions() { 14 | _opts = $scope.opts = LessOptions.options; 15 | updateOptions(_opts); 16 | 17 | // Setup watchers 18 | $scope.$watch('lessInput', compileLess); 19 | $scope.$watch('opts.selectedVersion', loadLess); 20 | $scope.$watch('opts', updateOptions, true); 21 | } 22 | 23 | // Set defaults 24 | _.extend($scope, { 25 | lessInput: LessCompiler.getCache(), 26 | cssOutput: '', 27 | loading: false, 28 | compileError: false 29 | }); 30 | 31 | function updateOptions(opts) { 32 | LessCompiler.updateOptions(opts); 33 | LessOptions.setCache(opts); 34 | compileLess(); 35 | } 36 | 37 | // Private fns 38 | function loadLess() { 39 | $scope.loading = true; 40 | 41 | LessLoader 42 | .load(_opts.selectedVersion, _opts.version.type === 'pre') 43 | .then(function() { 44 | LessCompiler.initLess(); 45 | compileLess(); 46 | $scope.loading = false; 47 | }); 48 | } 49 | 50 | function compileLess() { 51 | $scope.$safeApply(function() { 52 | _.extend($scope, { 53 | cssOutput: LessCompiler.compileLess($scope.lessInput), 54 | compileError: LessCompiler.error 55 | }); 56 | }); 57 | } 58 | } 59 | ]); -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: 8px 35px 8px 14px; 11 | margin-bottom: @baseLineHeight; 12 | text-shadow: 0 1px 0 rgba(255,255,255,.5); 13 | background-color: @warningBackground; 14 | border: 1px solid @warningBorder; 15 | .border-radius(@baseBorderRadius); 16 | } 17 | .alert, 18 | .alert h4 { 19 | // Specified for the h4 to prevent conflicts of changing @headingsColor 20 | color: @warningText; 21 | } 22 | .alert h4 { 23 | margin: 0; 24 | } 25 | 26 | // Adjust close link position 27 | .alert .close { 28 | position: relative; 29 | top: -2px; 30 | right: -21px; 31 | line-height: @baseLineHeight; 32 | } 33 | 34 | 35 | // Alternate styles 36 | // ------------------------- 37 | 38 | .alert-success { 39 | background-color: @successBackground; 40 | border-color: @successBorder; 41 | color: @successText; 42 | } 43 | .alert-success h4 { 44 | color: @successText; 45 | } 46 | .alert-danger, 47 | .alert-error { 48 | background-color: @errorBackground; 49 | border-color: @errorBorder; 50 | color: @errorText; 51 | } 52 | .alert-danger h4, 53 | .alert-error h4 { 54 | color: @errorText; 55 | } 56 | .alert-info { 57 | background-color: @infoBackground; 58 | border-color: @infoBorder; 59 | color: @infoText; 60 | } 61 | .alert-info h4 { 62 | color: @infoText; 63 | } 64 | 65 | 66 | // Block alerts 67 | // ------------------------- 68 | 69 | .alert-block { 70 | padding-top: 14px; 71 | padding-bottom: 14px; 72 | } 73 | .alert-block > p, 74 | .alert-block > ul { 75 | margin-bottom: 0; 76 | } 77 | .alert-block p + p { 78 | margin-top: 5px; 79 | } 80 | -------------------------------------------------------------------------------- /cm/demo/variableheight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Tabs inside the editor are spans with the
40 | class cm-tab, and can be styled.
41 |
42 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/cm/demo/marker.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Click the line-number gutter to add or remove 'breakpoints'.
39 | 40 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/bootstrap.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v2.3.2 3 | * 4 | * Copyright 2012 Twitter, Inc 5 | * Licensed under the Apache License v2.0 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Designed and built with all the love in the world @twitter by @mdo and @fat. 9 | */ 10 | 11 | // Core variables and mixins 12 | @import "variables.less"; // Modify this for custom colors, font-sizes, etc 13 | @import "mixins.less"; 14 | 15 | // CSS Reset 16 | @import "reset.less"; 17 | 18 | // Grid system and page structure 19 | @import "scaffolding.less"; 20 | @import "grid.less"; 21 | @import "layouts.less"; 22 | 23 | // Base CSS 24 | @import "type.less"; 25 | @import "code.less"; 26 | @import "forms.less"; 27 | // @import "tables.less"; 28 | 29 | // Components: common 30 | @import "sprites.less"; 31 | @import "dropdowns.less"; 32 | @import "wells.less"; 33 | // @import "component-animations.less"; 34 | @import "close.less"; 35 | 36 | // Components: Buttons & Alerts 37 | @import "buttons.less"; 38 | @import "button-groups.less"; 39 | @import "alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less 40 | 41 | // Components: Nav 42 | // @import "navs.less"; 43 | // @import "navbar.less"; 44 | // @import "breadcrumbs.less"; 45 | // @import "pagination.less"; 46 | // @import "pager.less"; 47 | 48 | // Components: Popovers 49 | // @import "modals.less"; 50 | // @import "tooltip.less"; 51 | // @import "popovers.less"; 52 | 53 | // Components: Misc 54 | // @import "thumbnails.less"; 55 | // @import "media.less"; 56 | // @import "labels-badges.less"; 57 | // @import "progress-bars.less"; 58 | // @import "accordion.less"; 59 | // @import "carousel.less"; 60 | // @import "hero-unit.less"; 61 | 62 | // Utility classes 63 | @import "utilities.less"; // Has to be last to override when necessary -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // IE10 Metro responsive 7 | // Required for Windows 8 Metro split-screen snapping with IE10 8 | // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/ 9 | @-ms-viewport{ 10 | width: device-width; 11 | } 12 | 13 | // Hide from screenreaders and browsers 14 | // Credit: HTML5 Boilerplate 15 | .hidden { 16 | display: none; 17 | visibility: hidden; 18 | } 19 | 20 | // Visibility utilities 21 | 22 | // For desktops 23 | .visible-phone { display: none !important; } 24 | .visible-tablet { display: none !important; } 25 | .hidden-phone { } 26 | .hidden-tablet { } 27 | .hidden-desktop { display: none !important; } 28 | .visible-desktop { display: inherit !important; } 29 | 30 | // Tablets & small desktops only 31 | @media (min-width: 768px) and (max-width: 979px) { 32 | // Hide everything else 33 | .hidden-desktop { display: inherit !important; } 34 | .visible-desktop { display: none !important ; } 35 | // Show 36 | .visible-tablet { display: inherit !important; } 37 | // Hide 38 | .hidden-tablet { display: none !important; } 39 | } 40 | 41 | // Phones only 42 | @media (max-width: 767px) { 43 | // Hide everything else 44 | .hidden-desktop { display: inherit !important; } 45 | .visible-desktop { display: none !important; } 46 | // Show 47 | .visible-phone { display: inherit !important; } // Use inherit to restore previous behavior 48 | // Hide 49 | .hidden-phone { display: none !important; } 50 | } 51 | 52 | // Print utilities 53 | .visible-print { display: none !important; } 54 | .hidden-print { } 55 | 56 | @media print { 57 | .visible-print { display: inherit !important; } 58 | .hidden-print { display: none !important; } 59 | } 60 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var routes = require('./routes'); 3 | var express = require('express'); 4 | 5 | var app = express(); 6 | http.createServer(app); 7 | 8 | app.locals.env = app.get('env'); 9 | app.locals.scripts = (require('./express/app-scripts')(process.cwd())).getScriptSrc(app.get('env')); 10 | 11 | // Perform canonicalization 12 | app.use(function(req, res, next) { 13 | var host = req.headers.host; 14 | 15 | if (host === 'less2css.org') { 16 | next(); // Quick next for canonical 17 | } else if (host === 'www.less2css.org') { 18 | res.redirect(301, 'http://less2css.org' + req.url); 19 | } else { 20 | next(); 21 | } 22 | }); 23 | 24 | // Begin config 25 | app.configure('all', function() { 26 | app.set('port', '3000'); 27 | app.set('views', __dirname + '/views'); 28 | app.set('view engine', 'jade'); 29 | app.use(express.compress()); 30 | app.use(express.logger()); 31 | app.use(express.cookieParser()); 32 | app.use(express.bodyParser()); 33 | app.use(express.methodOverride()); 34 | app.use(app.router); 35 | app.use(express.static(__dirname + '/public')); 36 | }); 37 | 38 | app.configure('development', function() { 39 | app.use(express.errorHandler({ 40 | showStack: true, 41 | dumpExceptions: true 42 | })); 43 | }); 44 | 45 | app.configure('production', function() { 46 | app.use(express.errorHandler()); 47 | }); 48 | 49 | app.use(routes.four_oh_four); 50 | 51 | // Begin Routes 52 | app.get('/', routes.home); 53 | app.get('/less-options', routes.less_options); 54 | 55 | // app.get('/logout', function(req, res) { 56 | // req.logout(); 57 | // res.redirect('/'); 58 | // }); 59 | 60 | // app.get('/share/:id([A-Za-z0-9]{1,6})', routes.share); 61 | // app.post('/compile', routes.compile); 62 | 63 | // Init 64 | app.listen(app.get('port'), function(){ 65 | console.log("Server started on port " + app.get('port') + ' in ' + app.get('env') + ' mode.'); 66 | }); 67 | -------------------------------------------------------------------------------- /cm/demo/multiplex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Demonstration of a multiplexing mode, which, at certain
52 | boundary strings, switches to one or more inner modes. The out
53 | (HTML) mode does not get fed the content of the <<
54 | >> blocks. See
55 | the manual and
56 | the source for more
57 | information.
Demonstration of a mode that parses HTML, highlighting
53 | the Mustache templating
54 | directives inside of it by using the code
55 | in overlay.js. View
56 | source to see the 15 lines of code needed to accomplish this.
The emacs keybindings are enabled by
36 | including keymap/emacs.js and setting
37 | the keyMap option to "emacs". Because
38 | CodeMirror's internal API is quite different from Emacs, they are only
39 | a loose approximation of actual emacs bindings, though.
Also note that a lot of browsers disallow certain keys from being 42 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the 43 | result that idiomatic use of Emacs keys will constantly close your tab 44 | or open a new window.
45 | 46 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /cm/demo/runmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Running a CodeMirror mode outside of the editor.
32 | The CodeMirror.runMode function, defined
33 | in lib/runmode.js takes the following arguments:
text (string)mode (mode spec)output (function or DOM node)null for unstyled tokens). If it is a DOM node,
44 | the tokens will be converted to span elements as in
45 | an editor, and inserted into the node
46 | (through innerHTML).The vim keybindings are enabled by
43 | including keymap/vim.js and setting
44 | the keyMap option to "vim". Because
45 | CodeMirror's internal API is quite different from Vim, they are only
46 | a loose approximation of actual vim bindings, though.
16 | 17 | /* Reporting bugs 18 | effectively */ 19 |20 |
So you found a problem in CodeMirror. By all means, report it! Bug 25 | reports from users are the main drive behind improvements to 26 | CodeMirror. But first, please read over these points:
27 | 28 |Type '<' or space inside tag or 25 | press ctrl-space to activate autocompletion. See 26 | the code (here 27 | and here) to figure out how 28 | it works.
29 | 30 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /express/karma.e2e.conf.js: -------------------------------------------------------------------------------- 1 | /* jshint undef: false */ 2 | // // It's used for running client tests on Travis (http://travis-ci.org/#!/vojtajina/testacular) 3 | // Most of the options can be overriden by cli arguments (see testacular --help) 4 | // 5 | // For all available config options and default values, see: 6 | // https://github.com/vojtajina/testacular/blob/stable/lib/config.js#L54 7 | 8 | 9 | // base path, that will be used to resolve files and exclude 10 | basePath = '.'; 11 | jsPath = '../public/javascripts'; 12 | 13 | // list of files / patterns to load in the browser 14 | files = [ 15 | JASMINE 16 | , JASMINE_ADAPTER 17 | , jsPath + '/vendor/jquery.js' 18 | , jsPath + '/vendor/angular.js' 19 | , jsPath + '/vendor/lodash.js' 20 | , ANGULAR_SCENARIO 21 | , ANGULAR_SCENARIO_ADAPTER 22 | , jsPath + '/less2css.js' 23 | , 'test/client/*.spec.js' 24 | ]; 25 | 26 | // list of files to exclude 27 | // exclude = [ 28 | // 'adapter/require.src.js' 29 | // ]; 30 | 31 | // use dots reporter, as travis terminal does not support escaping sequences 32 | // possible values: 'dots', 'progress', 'junit' 33 | // CLI --reporters progress 34 | reporters = ['growl']; 35 | 36 | // junitReporter = { 37 | // // will be resolved to basePath (in the same way as files/exclude patterns) 38 | // outputFile: 'test-results.xml' 39 | // }; 40 | 41 | // web server port 42 | // CLI --port 9876 43 | port = 9876; 44 | 45 | // cli runner port 46 | // CLI --runner-port 9100 47 | runnerPort = 9100; 48 | 49 | // enable / disable colors in the output (reporters and logs) 50 | // CLI --colors --no-colors 51 | colors = true; 52 | 53 | // level of logging 54 | // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG 55 | // CLI --log-level debug 56 | logLevel = LOG_INFO; 57 | 58 | // enable / disable watching file and executing tests whenever any file changes 59 | // CLI --auto-watch --no-auto-watch 60 | autoWatch = false; 61 | 62 | // Start these browsers, currently available: 63 | // - Chrome 64 | // - ChromeCanary 65 | // - Firefox 66 | // - Opera 67 | // - Safari (only Mac) 68 | // - PhantomJS 69 | // - IE (only Windows) 70 | // CLI --browsers Chrome,Firefox,Safari 71 | browsers = ['Chrome']; 72 | 73 | // If browser does not capture in given timeout [ms], kill it 74 | // CLI --capture-timeout 5000 75 | captureTimeout = 5000; 76 | 77 | // Auto run tests on start (when browsers are captured) and exit 78 | // CLI --single-run --no-single-run 79 | singleRun = false; 80 | 81 | // report which specs are slower than 500ms 82 | // CLI --report-slower-than 500 83 | reportSlowerThan = 500; -------------------------------------------------------------------------------- /express/less-options.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | versions: [ 3 | { label: "1.7.5", number: "1.7.5", type: "current" }, 4 | { label: "1.7.4", number: "1.7.4", type: "old" }, 5 | { label: "1.7.3", number: "1.7.3", type: "old" }, 6 | { label: "1.7.2", number: "1.7.2", type: "old" }, 7 | { label: "1.7.1", number: "1.7.1", type: "old" }, 8 | { label: "1.7.0", number: "1.7.0", type: "old" }, 9 | { label: "1.6.3", number: "1.6.3", type: "old" }, 10 | { label: "1.6.2", number: "1.6.2", type: "old" }, 11 | { label: "1.6.1", number: "1.6.1", type: "old" }, 12 | { label: "1.6.0", number: "1.6.0", type: "old" }, 13 | { label: "1.5.1", number: "1.5.1", type: "old" }, 14 | { label: "1.5.0", number: "1.5.0", type: "old" }, 15 | { label: "1.4.2", number: "1.4.2", type: "old" }, 16 | { label: "1.4.1", number: "1.4.1", type: "old" }, 17 | { label: "1.4.0", number: "1.4.0", type: "old" }, 18 | { label: "1.3.3", number: "1.3.3", type: "old" }, 19 | { label: "1.3.2", number: "1.3.2", type: "old" }, 20 | { label: "1.3.1", number: "1.3.1", type: "old" }, 21 | { label: "1.3.0", number: "1.3.0", type: "old" }, 22 | { label: "1.2.2", number: "1.2.2", type: "old" }, 23 | { label: "1.2.1", number: "1.2.1", type: "old" }, 24 | { label: "1.2.0", number: "1.2.0", type: "old" }, 25 | { label: "1.1.6", number: "1.1.6", type: "old" }, 26 | { label: "1.1.5", number: "1.1.5", type: "old" }, 27 | { label: "1.1.4", number: "1.1.4", type: "old" }, 28 | { label: "1.1.3", number: "1.1.3", type: "old" }, 29 | { label: "1.1.2", number: "1.1.2", type: "old" }, 30 | { label: "1.1.1", number: "1.1.1", type: "old" }, 31 | { label: "1.1.0", number: "1.1.0", type: "old" } 32 | ], 33 | 34 | options: { 35 | filename : "less2css.org.less", 36 | rootpath : false, 37 | strictUnits : false, 38 | strictMath : false, 39 | relativeUrls : false, 40 | dumpLineNumbers : false 41 | }, 42 | 43 | lessEditorOptions: { 44 | theme : "lesser-dark", 45 | tabSize : 2, 46 | lineNumbers : true, 47 | matchBrackets : true, 48 | autoCloseBrackets : true 49 | }, 50 | 51 | cssEditorOptions: { 52 | theme : "lesser-dark", 53 | tabSize : 2, 54 | readOnly : true, 55 | lineNumbers : true, 56 | matchBrackets : true 57 | }, 58 | 59 | lineNumberOptions: [ 60 | { label: "Comments", value: "comments", "default": true }, 61 | { label: "Media Query", value: 'mediaquery' }, 62 | { label: "All", value: 'all' } 63 | ] 64 | }; 65 | -------------------------------------------------------------------------------- /express/karma.conf.js: -------------------------------------------------------------------------------- 1 | /* jshint undef: false */ 2 | // // It's used for running client tests on Travis (http://travis-ci.org/#!/vojtajina/testacular) 3 | // Most of the options can be overriden by cli arguments (see testacular --help) 4 | // 5 | // For all available config options and default values, see: 6 | // https://github.com/vojtajina/testacular/blob/stable/lib/config.js#L54 7 | 8 | 9 | // base path, that will be used to resolve files and exclude 10 | try { 11 | basePath = process.cwd().match(/(^[\/\w\d-_]+)(less-preview)/)[0]; 12 | } catch (err) { 13 | throw new Error('Directory structure invalid'); 14 | } 15 | 16 | jsPath = basePath + '/public/javascripts'; 17 | var scripts = require(basePath + '/express/app-scripts.js')(process.cwd()); 18 | 19 | // list of files / patterns to load in the browser 20 | files = [ 21 | JASMINE 22 | , JASMINE_ADAPTER 23 | ]; 24 | 25 | files = files.concat(scripts.testUnit()); 26 | 27 | // list of files to exclude 28 | // exclude = [ 29 | // 'adapter/require.src.js' 30 | // ]; 31 | 32 | // use dots reporter, as travis terminal does not support escaping sequences 33 | // possible values: 'dots', 'progress', 'junit' 34 | // CLI --reporters progress 35 | reporters = ['growl']; 36 | 37 | // junitReporter = { 38 | // // will be resolved to basePath (in the same way as files/exclude patterns) 39 | // outputFile: 'test-results.xml' 40 | // }; 41 | 42 | // web server port 43 | // CLI --port 9876 44 | port = 9876; 45 | 46 | // cli runner port 47 | // CLI --runner-port 9100 48 | runnerPort = 9100; 49 | 50 | // enable / disable colors in the output (reporters and logs) 51 | // CLI --colors --no-colors 52 | colors = true; 53 | 54 | // level of logging 55 | // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG 56 | // CLI --log-level debug 57 | logLevel = LOG_INFO; 58 | 59 | // enable / disable watching file and executing tests whenever any file changes 60 | // CLI --auto-watch --no-auto-watch 61 | autoWatch = false; 62 | 63 | // Start these browsers, currently available: 64 | // - Chrome 65 | // - ChromeCanary 66 | // - Firefox 67 | // - Opera 68 | // - Safari (only Mac) 69 | // - PhantomJS 70 | // - IE (only Windows) 71 | // CLI --browsers Chrome,Firefox,Safari 72 | browsers = ['Chrome']; 73 | 74 | // If browser does not capture in given timeout [ms], kill it 75 | // CLI --capture-timeout 5000 76 | captureTimeout = 5000; 77 | 78 | // Auto run tests on start (when browsers are captured) and exit 79 | // CLI --single-run --no-single-run 80 | singleRun = false; 81 | 82 | // report which specs are slower than 500ms 83 | // CLI --report-slower-than 500 84 | reportSlowerThan = 500; -------------------------------------------------------------------------------- /cm/demo/complete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Press ctrl-space to activate autocompletion. See 56 | the code (here 57 | and here) to figure out 58 | how it works.
59 | 60 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /cm/demo/folding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Demonstration of code folding using the code
28 | in foldcode.js.
29 | Press ctrl-q or click on the gutter to fold a block, again
30 | to unfold.
Try the Range Colapse demo as well.
Select a piece of code and click one of the links below to apply automatic formatting to the selected text or comment/uncomment the selected text. Note that the formatting behavior depends on the current block's mode. 38 |
| 41 | 42 | Autoformat Selected 43 | 44 | | 45 |46 | 47 | Comment Selected 48 | 49 | | 50 |51 | 52 | Uncomment Selected 53 | 54 | | 55 |
This demo runs JSHint over the code 70 | in the editor (which is the script used on this page), and 71 | inserts line widgets to 72 | display the warnings that JSHint comes up with.
73 | 74 | 75 | -------------------------------------------------------------------------------- /cm/bin/compress: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Compression helper for CodeMirror 4 | // 5 | // Example: 6 | // 7 | // bin/compress codemirror runmode javascript xml 8 | // 9 | // Will take lib/codemirror.js, lib/util/runmode.js, 10 | // mode/javascript/javascript.js, and mode/xml/xml.js, run them though 11 | // the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit 12 | // out the result. 13 | // 14 | // bin/compress codemirror --local /path/to/bin/UglifyJS 15 | // 16 | // Will use a local minifier instead of the online default one. 17 | // 18 | // Script files are specified without .js ending. Prefixing them with 19 | // their full (local) path is optional. So you may say lib/codemirror 20 | // or mode/xml/xml to be more precise. In fact, even the .js suffix 21 | // may be speficied, if wanted. 22 | 23 | "use strict"; 24 | 25 | var fs = require("fs"); 26 | 27 | function help(ok) { 28 | console.log("usage: " + process.argv[1] + " [--local /path/to/uglifyjs] files..."); 29 | process.exit(ok ? 0 : 1); 30 | } 31 | 32 | var local = null, args = null, files = [], blob = ""; 33 | 34 | for (var i = 2; i < process.argv.length; ++i) { 35 | var arg = process.argv[i]; 36 | if (arg == "--local" && i + 1 < process.argv.length) { 37 | var parts = process.argv[++i].split(/\s+/); 38 | local = parts[0]; 39 | args = parts.slice(1); 40 | } else if (arg == "--help") { 41 | help(true); 42 | } else if (arg[0] != "-") { 43 | files.push({name: arg, re: new RegExp("(?:\\/|^)" + arg + (/\.js$/.test(arg) ? "$" : "\\.js$"))}); 44 | } else help(false); 45 | } 46 | 47 | function walk(dir) { 48 | fs.readdirSync(dir).forEach(function(fname) { 49 | if (/^[_\.]/.test(fname)) return; 50 | var file = dir + fname; 51 | if (fs.statSync(file).isDirectory()) return walk(file + "/"); 52 | if (files.some(function(spec, i) { 53 | var match = spec.re.test(file); 54 | if (match) files.splice(i, 1); 55 | return match; 56 | })) { 57 | if (local) args.push(file); 58 | else blob += fs.readFileSync(file, "utf8"); 59 | } 60 | }); 61 | } 62 | 63 | walk("lib/"); 64 | walk("mode/"); 65 | 66 | if (!blob) help(false); 67 | 68 | if (files.length) { 69 | console.log("Some speficied files were not found: " + 70 | files.map(function(a){return a.name;}).join(", ")); 71 | process.exit(1); 72 | } 73 | 74 | if (local) { 75 | require("child_process").spawn(local, args, {stdio: ["ignore", process.stdout, process.stderr]}); 76 | } else { 77 | var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8"); 78 | var req = require("http").request({ 79 | host: "marijnhaverbeke.nl", 80 | port: 80, 81 | method: "POST", 82 | path: "/uglifyjs", 83 | headers: {"content-type": "application/x-www-form-urlencoded", 84 | "content-length": data.length} 85 | }); 86 | req.on("response", function(resp) { 87 | resp.on("data", function (chunk) { process.stdout.write(chunk); }); 88 | }); 89 | req.end(data); 90 | } 91 | -------------------------------------------------------------------------------- /cm/demo/theme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Select a theme: 66 |
67 | 68 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /cm/demo/activeline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Styling the current cursor line.
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | //if lt IE 7 3 | html.lt-ie9.lt-ie8.lt-ie7(lang='en') 4 | //if IE 7 5 | html.lt-ie9.lt-ie8(lang='en') 6 | //if IE 8 7 | html.lt-ie9(lang='en') 8 | //[if gt IE 8]> pre { 58 | background:none; 59 | border-radius:0; 60 | padding:0; 61 | margin:0; 62 | font-size:2.2em; 63 | line-height:1.2em; 64 | } 65 | 66 | a:link, a:visited, .quasilink { 67 | color: #df0019; 68 | cursor: pointer; 69 | text-decoration: none; 70 | } 71 | 72 | a:hover, .quasilink:hover { 73 | color: #800004; 74 | } 75 | 76 | h1 a:link, h1 a:visited, h1 a:hover { 77 | color: black; 78 | } 79 | 80 | ul { 81 | margin: 0; 82 | padding-left: 1.2em; 83 | } 84 | 85 | a.download { 86 | color: white; 87 | background-color: #df0019; 88 | width: 100%; 89 | display: block; 90 | text-align: center; 91 | font-size: 1.23em; 92 | font-weight: bold; 93 | text-decoration: none; 94 | -moz-border-radius: 6px; 95 | -webkit-border-radius: 6px; 96 | border-radius: 6px; 97 | padding: .5em 0; 98 | margin-bottom: 1em; 99 | } 100 | 101 | a.download:hover { 102 | background-color: #bb0010; 103 | } 104 | 105 | .rel { 106 | margin-bottom: 0; 107 | } 108 | 109 | .rel-note { 110 | color: #777; 111 | font-size: .9em; 112 | margin-top: .1em; 113 | } 114 | 115 | .logo-braces { 116 | color: #df0019; 117 | position: relative; 118 | top: -4px; 119 | } 120 | 121 | .blk { 122 | float: left; 123 | } 124 | 125 | .left { 126 | margin-right: 20.68em; 127 | max-width: 37em; 128 | padding-right: 6.53em; 129 | padding-bottom: 1em; 130 | } 131 | 132 | .left1 { 133 | width: 15.24em; 134 | padding-right: 6.45em; 135 | } 136 | 137 | .left2 { 138 | max-width: 15.24em; 139 | } 140 | 141 | .right { 142 | width: 20.68em; 143 | margin-left: -20.68em; 144 | } 145 | 146 | .leftbig { 147 | width: 42.44em; 148 | padding-right: 6.53em; 149 | } 150 | 151 | .rightsmall { 152 | width: 15.24em; 153 | } 154 | 155 | .clear:after { 156 | visibility: hidden; 157 | display: block; 158 | font-size: 0; 159 | content: " "; 160 | clear: both; 161 | height: 0; 162 | } 163 | .clear { display: inline-block; } 164 | /* start commented backslash hack \*/ 165 | * html .clear { height: 1%; } 166 | .clear { display: block; } 167 | /* close commented backslash hack */ 168 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/pagination.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pagination (multiple pages) 3 | // -------------------------------------------------- 4 | 5 | // Space out pagination from surrounding content 6 | .pagination { 7 | margin: @baseLineHeight 0; 8 | } 9 | 10 | .pagination ul { 11 | // Allow for text-based alignment 12 | display: inline-block; 13 | .ie7-inline-block(); 14 | // Reset default ul styles 15 | margin-left: 0; 16 | margin-bottom: 0; 17 | // Visuals 18 | .border-radius(@baseBorderRadius); 19 | .box-shadow(0 1px 2px rgba(0,0,0,.05)); 20 | } 21 | .pagination ul > li { 22 | display: inline; // Remove list-style and block-level defaults 23 | } 24 | .pagination ul > li > a, 25 | .pagination ul > li > span { 26 | float: left; // Collapse white-space 27 | padding: 4px 12px; 28 | line-height: @baseLineHeight; 29 | text-decoration: none; 30 | background-color: @paginationBackground; 31 | border: 1px solid @paginationBorder; 32 | border-left-width: 0; 33 | } 34 | .pagination ul > li > a:hover, 35 | .pagination ul > li > a:focus, 36 | .pagination ul > .active > a, 37 | .pagination ul > .active > span { 38 | background-color: @paginationActiveBackground; 39 | } 40 | .pagination ul > .active > a, 41 | .pagination ul > .active > span { 42 | color: @grayLight; 43 | cursor: default; 44 | } 45 | .pagination ul > .disabled > span, 46 | .pagination ul > .disabled > a, 47 | .pagination ul > .disabled > a:hover, 48 | .pagination ul > .disabled > a:focus { 49 | color: @grayLight; 50 | background-color: transparent; 51 | cursor: default; 52 | } 53 | .pagination ul > li:first-child > a, 54 | .pagination ul > li:first-child > span { 55 | border-left-width: 1px; 56 | .border-left-radius(@baseBorderRadius); 57 | } 58 | .pagination ul > li:last-child > a, 59 | .pagination ul > li:last-child > span { 60 | .border-right-radius(@baseBorderRadius); 61 | } 62 | 63 | 64 | // Alignment 65 | // -------------------------------------------------- 66 | 67 | .pagination-centered { 68 | text-align: center; 69 | } 70 | .pagination-right { 71 | text-align: right; 72 | } 73 | 74 | 75 | // Sizing 76 | // -------------------------------------------------- 77 | 78 | // Large 79 | .pagination-large { 80 | ul > li > a, 81 | ul > li > span { 82 | padding: @paddingLarge; 83 | font-size: @fontSizeLarge; 84 | } 85 | ul > li:first-child > a, 86 | ul > li:first-child > span { 87 | .border-left-radius(@borderRadiusLarge); 88 | } 89 | ul > li:last-child > a, 90 | ul > li:last-child > span { 91 | .border-right-radius(@borderRadiusLarge); 92 | } 93 | } 94 | 95 | // Small and mini 96 | .pagination-mini, 97 | .pagination-small { 98 | ul > li:first-child > a, 99 | ul > li:first-child > span { 100 | .border-left-radius(@borderRadiusSmall); 101 | } 102 | ul > li:last-child > a, 103 | ul > li:last-child > span { 104 | .border-right-radius(@borderRadiusSmall); 105 | } 106 | } 107 | 108 | // Small 109 | .pagination-small { 110 | ul > li > a, 111 | ul > li > span { 112 | padding: @paddingSmall; 113 | font-size: @fontSizeSmall; 114 | } 115 | } 116 | // Mini 117 | .pagination-mini { 118 | ul > li > a, 119 | ul > li > span { 120 | padding: @paddingMini; 121 | font-size: @fontSizeMini; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | var scripts = require('./express/app-scripts')(process.cwd()); 2 | var src = scripts.development(); 3 | 4 | module.exports = function(grunt) { 5 | var js_globals = Object.keys(grunt.file.readJSON('./.jshintrc').globals); 6 | var uglify_options = { 7 | compress: { 8 | loops : true, 9 | unused : true, 10 | unsafe : true, 11 | cascade : true, 12 | warnings : true, 13 | booleans : true, 14 | evaluate : true, 15 | dead_code : true, 16 | join_vars : true, 17 | if_return : true, 18 | sequences : true, 19 | hoist_vars : false, 20 | hoist_funs : true, 21 | properties : true, 22 | comparisons : true, 23 | conditionals : true 24 | }, 25 | mangle: { except: js_globals } 26 | }; 27 | 28 | grunt.loadNpmTasks('grunt-contrib-uglify'); 29 | grunt.loadNpmTasks('grunt-contrib-concat'); 30 | grunt.loadNpmTasks('grunt-contrib-watch'); 31 | grunt.loadNpmTasks('grunt-contrib-jshint'); 32 | 33 | grunt.initConfig({ 34 | pkg: grunt.file.readJSON('package.json'), 35 | meta: { 36 | banner: [ 37 | '/* <%= pkg.name %> - v<%= pkg.version %> - <%= pkg.homepage %>', 38 | ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>. All rights reserved.', 39 | ' * Licensed <%= _.pluck(pkg.licenses, "type")[0] %> - <%= _.pluck(pkg.licenses, "url")[0] %>', 40 | ' */', 41 | '' 42 | ].join('\n') 43 | }, 44 | 45 | paths: { 46 | js : './public/javascripts', 47 | tmp : './tmp', 48 | test : './test', 49 | routes : './routes', 50 | express : './express' 51 | }, 52 | 53 | concat: { 54 | app: { 55 | src: src.app, 56 | dest: '<%= paths.tmp %>/less2css.js' 57 | }, 58 | 59 | vendor: { 60 | src: src.vendor, 61 | dest: '<%= paths.tmp %>/vendor.js' 62 | }, 63 | 64 | build: { 65 | options: { banner: '<%= meta.banner %>'}, 66 | files: { 67 | '<%= paths.js %>/less2css.min.js': ['<%= paths.js %>/less2css.min.js'] 68 | } 69 | } 70 | }, 71 | 72 | watch: { 73 | js: { 74 | files: [ 75 | '<%= paths.js %>/options-drawer.js', 76 | '<%= paths.js %>/src/**/*.js' 77 | ], 78 | tasks: ['concat:app', 'jshint'] 79 | }, 80 | tests: { 81 | files: ['<%= paths.test %>/**/*.spec.js'], 82 | tasks: ['karma:unit:run'] 83 | } 84 | }, 85 | 86 | uglify: { 87 | app: { 88 | options: uglify_options, 89 | files: { 90 | '<%= paths.js %>/less2css.min.js': ['<%= paths.tmp %>/less2css.js'] 91 | } 92 | }, 93 | vendor: { 94 | options: uglify_options, 95 | files: { 96 | '<%= paths.js %>/vendor.min.js': ['<%= paths.tmp %>/vendor.js'] 97 | } 98 | } 99 | }, 100 | jshint: { 101 | options: { jshintrc: './.jshintrc' }, 102 | all: ['<%= paths.tmp %>/less2css.js'] 103 | } 104 | }); 105 | 106 | grunt.registerTask('default', [ 107 | 'concat:app', 108 | 'concat:vendor', 109 | 'jshint', 110 | 'uglify', 111 | 'concat:build' 112 | ]); 113 | }; -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/carousel.less: -------------------------------------------------------------------------------- 1 | // 2 | // Carousel 3 | // -------------------------------------------------- 4 | 5 | 6 | .carousel { 7 | position: relative; 8 | margin-bottom: @baseLineHeight; 9 | line-height: 1; 10 | } 11 | 12 | .carousel-inner { 13 | overflow: hidden; 14 | width: 100%; 15 | position: relative; 16 | } 17 | 18 | .carousel-inner { 19 | 20 | > .item { 21 | display: none; 22 | position: relative; 23 | .transition(.6s ease-in-out left); 24 | 25 | // Account for jankitude on images 26 | > img, 27 | > a > img { 28 | display: block; 29 | line-height: 1; 30 | } 31 | } 32 | 33 | > .active, 34 | > .next, 35 | > .prev { display: block; } 36 | 37 | > .active { 38 | left: 0; 39 | } 40 | 41 | > .next, 42 | > .prev { 43 | position: absolute; 44 | top: 0; 45 | width: 100%; 46 | } 47 | 48 | > .next { 49 | left: 100%; 50 | } 51 | > .prev { 52 | left: -100%; 53 | } 54 | > .next.left, 55 | > .prev.right { 56 | left: 0; 57 | } 58 | 59 | > .active.left { 60 | left: -100%; 61 | } 62 | > .active.right { 63 | left: 100%; 64 | } 65 | 66 | } 67 | 68 | // Left/right controls for nav 69 | // --------------------------- 70 | 71 | .carousel-control { 72 | position: absolute; 73 | top: 40%; 74 | left: 15px; 75 | width: 40px; 76 | height: 40px; 77 | margin-top: -20px; 78 | font-size: 60px; 79 | font-weight: 100; 80 | line-height: 30px; 81 | color: @white; 82 | text-align: center; 83 | background: @grayDarker; 84 | border: 3px solid @white; 85 | .border-radius(23px); 86 | .opacity(50); 87 | 88 | // we can't have this transition here 89 | // because webkit cancels the carousel 90 | // animation if you trip this while 91 | // in the middle of another animation 92 | // ;_; 93 | // .transition(opacity .2s linear); 94 | 95 | // Reposition the right one 96 | &.right { 97 | left: auto; 98 | right: 15px; 99 | } 100 | 101 | // Hover/focus state 102 | &:hover, 103 | &:focus { 104 | color: @white; 105 | text-decoration: none; 106 | .opacity(90); 107 | } 108 | } 109 | 110 | // Carousel indicator pips 111 | // ----------------------------- 112 | .carousel-indicators { 113 | position: absolute; 114 | top: 15px; 115 | right: 15px; 116 | z-index: 5; 117 | margin: 0; 118 | list-style: none; 119 | 120 | li { 121 | display: block; 122 | float: left; 123 | width: 10px; 124 | height: 10px; 125 | margin-left: 5px; 126 | text-indent: -999px; 127 | background-color: #ccc; 128 | background-color: rgba(255,255,255,.25); 129 | border-radius: 5px; 130 | } 131 | .active { 132 | background-color: #fff; 133 | } 134 | } 135 | 136 | // Caption for text below images 137 | // ----------------------------- 138 | 139 | .carousel-caption { 140 | position: absolute; 141 | left: 0; 142 | right: 0; 143 | bottom: 0; 144 | padding: 15px; 145 | background: @grayDark; 146 | background: rgba(0,0,0,.75); 147 | } 148 | .carousel-caption h4, 149 | .carousel-caption p { 150 | color: @white; 151 | line-height: @baseLineHeight; 152 | } 153 | .carousel-caption h4 { 154 | margin: 0 0 5px; 155 | } 156 | .carousel-caption p { 157 | margin-bottom: 0; 158 | } 159 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/progress-bars.less: -------------------------------------------------------------------------------- 1 | // 2 | // Progress bars 3 | // -------------------------------------------------- 4 | 5 | 6 | // ANIMATIONS 7 | // ---------- 8 | 9 | // Webkit 10 | @-webkit-keyframes progress-bar-stripes { 11 | from { background-position: 40px 0; } 12 | to { background-position: 0 0; } 13 | } 14 | 15 | // Firefox 16 | @-moz-keyframes progress-bar-stripes { 17 | from { background-position: 40px 0; } 18 | to { background-position: 0 0; } 19 | } 20 | 21 | // IE9 22 | @-ms-keyframes progress-bar-stripes { 23 | from { background-position: 40px 0; } 24 | to { background-position: 0 0; } 25 | } 26 | 27 | // Opera 28 | @-o-keyframes progress-bar-stripes { 29 | from { background-position: 0 0; } 30 | to { background-position: 40px 0; } 31 | } 32 | 33 | // Spec 34 | @keyframes progress-bar-stripes { 35 | from { background-position: 40px 0; } 36 | to { background-position: 0 0; } 37 | } 38 | 39 | 40 | 41 | // THE BARS 42 | // -------- 43 | 44 | // Outer container 45 | .progress { 46 | overflow: hidden; 47 | height: @baseLineHeight; 48 | margin-bottom: @baseLineHeight; 49 | #gradient > .vertical(#f5f5f5, #f9f9f9); 50 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); 51 | .border-radius(@baseBorderRadius); 52 | } 53 | 54 | // Bar of progress 55 | .progress .bar { 56 | width: 0%; 57 | height: 100%; 58 | color: @white; 59 | float: left; 60 | font-size: 12px; 61 | text-align: center; 62 | text-shadow: 0 -1px 0 rgba(0,0,0,.25); 63 | #gradient > .vertical(#149bdf, #0480be); 64 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); 65 | .box-sizing(border-box); 66 | .transition(width .6s ease); 67 | } 68 | .progress .bar + .bar { 69 | .box-shadow(~"inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15)"); 70 | } 71 | 72 | // Striped bars 73 | .progress-striped .bar { 74 | #gradient > .striped(#149bdf); 75 | .background-size(40px 40px); 76 | } 77 | 78 | // Call animation for the active one 79 | .progress.active .bar { 80 | -webkit-animation: progress-bar-stripes 2s linear infinite; 81 | -moz-animation: progress-bar-stripes 2s linear infinite; 82 | -ms-animation: progress-bar-stripes 2s linear infinite; 83 | -o-animation: progress-bar-stripes 2s linear infinite; 84 | animation: progress-bar-stripes 2s linear infinite; 85 | } 86 | 87 | 88 | 89 | // COLORS 90 | // ------ 91 | 92 | // Danger (red) 93 | .progress-danger .bar, .progress .bar-danger { 94 | #gradient > .vertical(#ee5f5b, #c43c35); 95 | } 96 | .progress-danger.progress-striped .bar, .progress-striped .bar-danger { 97 | #gradient > .striped(#ee5f5b); 98 | } 99 | 100 | // Success (green) 101 | .progress-success .bar, .progress .bar-success { 102 | #gradient > .vertical(#62c462, #57a957); 103 | } 104 | .progress-success.progress-striped .bar, .progress-striped .bar-success { 105 | #gradient > .striped(#62c462); 106 | } 107 | 108 | // Info (teal) 109 | .progress-info .bar, .progress .bar-info { 110 | #gradient > .vertical(#5bc0de, #339bb9); 111 | } 112 | .progress-info.progress-striped .bar, .progress-striped .bar-info { 113 | #gradient > .striped(#5bc0de); 114 | } 115 | 116 | // Warning (orange) 117 | .progress-warning .bar, .progress .bar-warning { 118 | #gradient > .vertical(lighten(@orange, 15%), @orange); 119 | } 120 | .progress-warning.progress-striped .bar, .progress-striped .bar-warning { 121 | #gradient > .striped(lighten(@orange, 15%)); 122 | } 123 | -------------------------------------------------------------------------------- /cm/test/lint/lint.js: -------------------------------------------------------------------------------- 1 | /* 2 | Simple linter, based on the Acorn [1] parser module 3 | 4 | All of the existing linters either cramp my style or have huge 5 | dependencies (Closure). So here's a very simple, non-invasive one 6 | that only spots 7 | 8 | - missing semicolons and trailing commas 9 | - variables or properties that are reserved words 10 | - assigning to a variable you didn't declare 11 | 12 | [1]: https://github.com/marijnh/acorn/ 13 | */ 14 | 15 | var fs = require("fs"), acorn = require("./acorn.js"), walk = require("./walk.js"); 16 | 17 | var scopePasser = walk.make({ 18 | ScopeBody: function(node, prev, c) { c(node, node.scope); } 19 | }); 20 | 21 | function checkFile(fileName) { 22 | var file = fs.readFileSync(fileName, "utf8"); 23 | var badChar = file.match(/[\x00-\x08\x0b\x0c\x0e-\x19\uFEFF]/); 24 | if (badChar) 25 | fail("Undesirable character " + badChar[0].charCodeAt(0) + " at position " + badChar.index, 26 | {source: fileName}); 27 | 28 | try { 29 | var parsed = acorn.parse(file, { 30 | locations: true, 31 | ecmaVersion: 3, 32 | strictSemicolons: true, 33 | forbidReserved: true, 34 | sourceFile: fileName 35 | }); 36 | } catch (e) { 37 | fail(e.message, {source: fileName}); 38 | return; 39 | } 40 | 41 | var scopes = []; 42 | 43 | walk.simple(parsed, { 44 | ScopeBody: function(node, scope) { 45 | node.scope = scope; 46 | scopes.push(scope); 47 | } 48 | }, walk.scopeVisitor, {vars: Object.create(null)}); 49 | 50 | var ignoredGlobals = Object.create(null); 51 | 52 | function inScope(name, scope) { 53 | for (var cur = scope; cur; cur = cur.prev) 54 | if (name in cur.vars) return true; 55 | } 56 | function checkLHS(node, scope) { 57 | if (node.type == "Identifier" && !(node.name in ignoredGlobals) && 58 | !inScope(node.name, scope)) { 59 | ignoredGlobals[node.name] = true; 60 | fail("Assignment to global variable", node.loc); 61 | } 62 | } 63 | 64 | walk.simple(parsed, { 65 | UpdateExpression: function(node, scope) {checkLHS(node.argument, scope);}, 66 | AssignmentExpression: function(node, scope) {checkLHS(node.left, scope);}, 67 | Identifier: function(node, scope) { 68 | // Mark used identifiers 69 | for (var cur = scope; cur; cur = cur.prev) 70 | if (node.name in cur.vars) { 71 | cur.vars[node.name].used = true; 72 | return; 73 | } 74 | } 75 | }, scopePasser); 76 | 77 | for (var i = 0; i < scopes.length; ++i) { 78 | var scope = scopes[i]; 79 | for (var name in scope.vars) { 80 | var info = scope.vars[name]; 81 | if (!info.used && info.type != "catch clause" && info.type != "function name" && name.charAt(0) != "_") 82 | fail("Unused " + info.type + " " + name, info.node.loc); 83 | } 84 | } 85 | } 86 | 87 | var failed = false; 88 | function fail(msg, pos) { 89 | if (pos.start) msg += " (" + pos.start.line + ":" + pos.start.column + ")"; 90 | console.log(pos.source.match(/[^\/]+$/)[0] + ": " + msg); 91 | failed = true; 92 | } 93 | 94 | function checkDir(dir) { 95 | fs.readdirSync(dir).forEach(function(file) { 96 | var fname = dir + "/" + file; 97 | if (/\.js$/.test(file)) checkFile(fname); 98 | else if (fs.lstatSync(fname).isDirectory()) checkDir(fname); 99 | }); 100 | } 101 | 102 | exports.checkDir = checkDir; 103 | exports.checkFile = checkFile; 104 | exports.success = function() { return !failed; }; 105 | -------------------------------------------------------------------------------- /public/javascripts/vendor/cm/addon/edit/closebrackets.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var DEFAULT_BRACKETS = "()[]{}''\"\""; 3 | var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; 4 | var SPACE_CHAR_REGEX = /\s/; 5 | 6 | CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { 7 | if (old != CodeMirror.Init && old) 8 | cm.removeKeyMap("autoCloseBrackets"); 9 | if (!val) return; 10 | var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER; 11 | if (typeof val == "string") pairs = val; 12 | else if (typeof val == "object") { 13 | if (val.pairs != null) pairs = val.pairs; 14 | if (val.explode != null) explode = val.explode; 15 | } 16 | var map = buildKeymap(pairs); 17 | if (explode) map.Enter = buildExplodeHandler(explode); 18 | cm.addKeyMap(map); 19 | }); 20 | 21 | function charsAround(cm, pos) { 22 | var str = cm.getRange(CodeMirror.Pos(pos.line, pos.ch - 1), 23 | CodeMirror.Pos(pos.line, pos.ch + 1)); 24 | return str.length == 2 ? str : null; 25 | } 26 | 27 | function buildKeymap(pairs) { 28 | var map = { 29 | name : "autoCloseBrackets", 30 | Backspace: function(cm) { 31 | if (cm.somethingSelected()) return CodeMirror.Pass; 32 | var cur = cm.getCursor(), around = charsAround(cm, cur); 33 | if (around && pairs.indexOf(around) % 2 == 0) 34 | cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1)); 35 | else 36 | return CodeMirror.Pass; 37 | } 38 | }; 39 | var closingBrackets = ""; 40 | for (var i = 0; i < pairs.length; i += 2) (function(left, right) { 41 | if (left != right) closingBrackets += right; 42 | function surround(cm) { 43 | var selection = cm.getSelection(); 44 | cm.replaceSelection(left + selection + right); 45 | } 46 | function maybeOverwrite(cm) { 47 | var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1)); 48 | if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass; 49 | else cm.execCommand("goCharRight"); 50 | } 51 | map["'" + left + "'"] = function(cm) { 52 | if (left == "'" && cm.getTokenAt(cm.getCursor()).type == "comment") 53 | return CodeMirror.Pass; 54 | if (cm.somethingSelected()) return surround(cm); 55 | if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return; 56 | var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1); 57 | var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch); 58 | if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar)) 59 | cm.replaceSelection(left + right, {head: ahead, anchor: ahead}); 60 | else 61 | return CodeMirror.Pass; 62 | }; 63 | if (left != right) map["'" + right + "'"] = maybeOverwrite; 64 | })(pairs.charAt(i), pairs.charAt(i + 1)); 65 | return map; 66 | } 67 | 68 | function buildExplodeHandler(pairs) { 69 | return function(cm) { 70 | var cur = cm.getCursor(), around = charsAround(cm, cur); 71 | if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; 72 | cm.operation(function() { 73 | var newPos = CodeMirror.Pos(cur.line + 1, 0); 74 | cm.replaceSelection("\n\n", {anchor: newPos, head: newPos}, "+input"); 75 | cm.indentLine(cur.line + 1, null, true); 76 | cm.indentLine(cur.line + 2, null, true); 77 | }); 78 | }; 79 | } 80 | })(); 81 | -------------------------------------------------------------------------------- /cm/demo/btree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Shows a visual representation of the b-tree that CodeMirror 19 | uses to store its document. See 20 | the corresponding 21 | blog post for a description of this format. The gray blocks 22 | under each leaf show the lines it holds (with their width 23 | representing the line height). Add and remove content to see how 24 | the nodes are split and merged to keep the tree balanced.
25 | 26 |Demonstration of primitive search/replace functionality. The 70 | keybindings (which can be overridden by custom keymaps) are:
71 |Searching is enabled by 79 | including lib/util/search.js 80 | and lib/util/searchcursor.js. 81 | For good-looking input dialogs, you also want to include 82 | lib/util/dialog.js 83 | and lib/util/dialog.css.
84 | 85 | 86 | -------------------------------------------------------------------------------- /public/stylesheets/app/gh.less: -------------------------------------------------------------------------------- 1 | .github-fork-ribbon { 2 | // The right and left lasses determine the side we attach our banner to 3 | position: absolute; 4 | 5 | // Add a bit of padding to give some substance outside the "stitching" 6 | padding: 2px 0; 7 | 8 | // Set the base colour 9 | background-color: #505050; 10 | 11 | background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.00)), to(rgba(0, 0, 0, 0.15))); 12 | background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 13 | background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 14 | background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 15 | background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 16 | background-image: linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 17 | 18 | .box-shadow(0 2px 3px 0 rgba(0,0,0,0.5)); 19 | } 20 | 21 | .github-fork-ribbon a { 22 | #font > #family > .sans-serif(); 23 | font-size: 13px; 24 | font-weight: 700; 25 | color: white; 26 | 27 | // Set the text properties 28 | text-decoration: none; 29 | text-shadow: 0 -1px rgba(0,0,0,0.5); 30 | text-align: center; 31 | 32 | // Set the geometry. If you fiddle with these you'll also need to tweak the top and right values in #github-fork-ribbon. 33 | width: 200px; 34 | line-height: 20px; 35 | 36 | // Set the layout properties 37 | display: inline-block; 38 | padding: 2px 0; 39 | 40 | // Add "stitching" effect 41 | border-width: 1px 0; 42 | border-style: dotted; 43 | border-color: rgba(255,255,255,0.7); 44 | } 45 | 46 | .github-fork-ribbon-wrapper { 47 | width: 150px; 48 | height: 150px; 49 | position: absolute; 50 | overflow: hidden; 51 | top: 0; 52 | } 53 | 54 | .github-fork-ribbon-wrapper.left { 55 | left: 0; 56 | } 57 | 58 | .github-fork-ribbon-wrapper.right { 59 | right: 0; 60 | } 61 | 62 | .github-fork-ribbon-wrapper.left-bottom { 63 | position: fixed; 64 | top: inherit; 65 | bottom: 0; 66 | left: 0; 67 | } 68 | 69 | .github-fork-ribbon-wrapper.right-bottom { 70 | z-index: 6; 71 | position: fixed; 72 | top: inherit; 73 | bottom: 0; 74 | right: 0; 75 | } 76 | 77 | .github-fork-ribbon-wrapper.right .github-fork-ribbon { 78 | top: 42px; 79 | right: -43px; 80 | 81 | // Rotate the banner 45 degrees 82 | -webkit-transform: rotate(45deg); 83 | -moz-transform: rotate(45deg); 84 | -o-transform: rotate(45deg); 85 | transform: rotate(45deg); 86 | } 87 | 88 | .github-fork-ribbon-wrapper.left .github-fork-ribbon { 89 | // Attach to the left of the page 90 | top: 42px; 91 | left: -43px; 92 | 93 | // Rotate the banner -45 degrees 94 | -webkit-transform: rotate(-45deg); 95 | -moz-transform: rotate(-45deg); 96 | -o-transform: rotate(-45deg); 97 | transform: rotate(-45deg); 98 | } 99 | 100 | 101 | .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon { 102 | // Attach to the left of the page 103 | top: 75px; 104 | left: -64px; 105 | 106 | // Rotate the banner -45 degrees 107 | -webkit-transform: rotate(45deg); 108 | -moz-transform: rotate(45deg); 109 | -o-transform: rotate(45deg); 110 | transform: rotate(45deg); 111 | } 112 | .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon a { 113 | padding-left: 18px; 114 | } 115 | 116 | .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon { 117 | // Attach to the left of the page 118 | top: 89px; 119 | left: -10px; 120 | 121 | // Rotate the banner -45 degrees 122 | -webkit-transform: rotate(-45deg); 123 | -moz-transform: rotate(-45deg); 124 | -o-transform: rotate(-45deg); 125 | transform: rotate(-45deg); 126 | } 127 | .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon a { 128 | padding-left: 15px; 129 | } -------------------------------------------------------------------------------- /cm/doc/upgrade_v2.2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
15 | 16 | /* Upgrading to 17 | v2.2 */ 18 |19 |
There are a few things in the 2.2 release that require some care 24 | when upgrading.
25 | 26 |The default theme is now included
29 | in codemirror.css, so
30 | you do not have to included it separately anymore. (It was tiny, so
31 | even if you're not using it, the extra data overhead is negligible.)
32 |
33 |
CodeMirror has moved to a system 36 | where keymaps are used to 37 | bind behavior to keys. This means custom 38 | bindings are now possible.
39 | 40 |Three options that influenced key
41 | behavior, tabMode, enterMode,
42 | and smartHome, are no longer supported. Instead, you can
43 | provide custom bindings to influence the way these keys act. This is
44 | done through the
45 | new extraKeys
46 | option, which can hold an object mapping key names to functionality. A
47 | simple example would be:
extraKeys: {
50 | "Ctrl-S": function(instance) { saveText(instance.getValue()); },
51 | "Ctrl-/": "undo"
52 | }
53 |
54 | Keys can be mapped either to functions, which will be given the
55 | editor instance as argument, or to strings, which are mapped through
56 | functions through the CodeMirror.commands table, which
57 | contains all the built-in editing commands, and can be inspected and
58 | extended by external code.
By default, the Home key is bound to
61 | the "goLineStartSmart" command, which moves the cursor to
62 | the first non-whitespace character on the line. You can set do this to
63 | make it always go to the very start instead:
extraKeys: {"Home": "goLineStart"}
66 |
67 | Similarly, Enter is bound
68 | to "newlineAndIndent" by default. You can bind it to
69 | something else to get different behavior. To disable special handling
70 | completely and only get a newline character inserted, you can bind it
71 | to false:
extraKeys: {"Enter": false}
74 |
75 | The same works for Tab. If you don't want CodeMirror
76 | to handle it, bind it to false. The default behaviour is
77 | to indent the current line more ("indentMore" command),
78 | and indent it less when shift is held ("indentLess").
79 | There are also "indentAuto" (smart indent)
80 | and "insertTab" commands provided for alternate
81 | behaviors. Or you can write your own handler function to do something
82 | different altogether.
Handling of tabs changed completely. The display width of tabs can
87 | now be set with the tabSize option, and tabs can
88 | be styled by setting CSS rules
89 | for the cm-tab class.
The default width for tabs is now 4, as opposed to the 8 that is
92 | hard-wired into browsers. If you are relying on 8-space tabs, make
93 | sure you explicitly set tabSize: 8 in your options.
Click on the right side of the gutter, then click again below,
99 | the code between will collapse. Click on either arrow to expand.
100 | To use, simply include the collapserange.js file and
101 | set collapseRange: true in options.