├── .gitignore ├── .npmignore ├── .travis.yml ├── CONTRIBUTING.md ├── Gruntfile.coffee ├── Guardfile ├── LICENSE.md ├── README.md ├── bin └── biscotto ├── config ├── assets.yml └── compass.rb ├── package.json ├── spec ├── metadata_spec.coffee ├── metadata_templates │ ├── classes │ │ ├── basic_class.coffee │ │ ├── basic_class.json │ │ ├── class_with_class_properties.coffee │ │ ├── class_with_class_properties.json │ │ ├── class_with_comment_indentation.coffee │ │ ├── class_with_comment_indentation.json │ │ ├── class_with_comment_section.coffee │ │ ├── class_with_comment_section.json │ │ ├── class_with_prototype_properties.coffee │ │ ├── class_with_prototype_properties.json │ │ ├── classes_with_similar_methods.coffee │ │ └── classes_with_similar_methods.json │ ├── exports │ │ ├── basic_exports.coffee │ │ ├── basic_exports.json │ │ ├── class_exports.coffee │ │ └── class_exports.json │ ├── requires │ │ ├── basic_requires.coffee │ │ ├── basic_requires.json │ │ ├── multiple_requires_single_line.coffee │ │ ├── multiple_requires_single_line.json │ │ ├── references │ │ │ ├── buffer-patch.coffee │ │ │ └── buffer-patch.json │ │ ├── requires_with_colon.coffee │ │ └── requires_with_colon.json │ └── test_package │ │ ├── Gruntfile.coffee │ │ ├── package.json │ │ ├── src │ │ ├── point.coffee │ │ ├── range.coffee │ │ └── test.coffee │ │ ├── test │ │ └── text-buffer-test.coffee │ │ └── test_metadata.json ├── parser_spec.coffee └── parser_templates │ ├── classes │ ├── class_description_markdown.coffee │ ├── class_description_markdown.json │ ├── class_documentation.coffee │ ├── class_documentation.json │ ├── class_extends.coffee │ ├── class_extends.json │ ├── empty_class.coffee │ ├── empty_class.json │ ├── export_class.coffee │ ├── export_class.json │ ├── inner_class.coffee │ ├── inner_class.json │ ├── namespaced_class.coffee │ ├── namespaced_class.json │ ├── simple_class.coffee │ ├── simple_class.json │ ├── uppercase_identifiers.coffee │ └── uppercase_identifiers.json │ ├── files │ ├── non_class_file.coffee │ └── non_class_file.json │ └── methods │ ├── assigned_parameters.coffee │ ├── assigned_parameters.json │ ├── class_methods.coffee │ ├── class_methods.json │ ├── curly_method_documentation.coffee │ ├── curly_method_documentation.json │ ├── fixtures │ └── private_class.coffee │ ├── hash_parameters.coffee │ ├── hash_parameters.json │ ├── instance_methods.coffee │ ├── instance_methods.json │ ├── links.coffee │ ├── links.json │ ├── method_delegation.coffee │ ├── method_delegation.json │ ├── method_delegation_as_private.coffee │ ├── method_delegation_as_private.json │ ├── method_example.coffee │ ├── method_example.json │ ├── method_paragraph_param.coffee │ ├── method_paragraph_param.json │ ├── method_shortdesc.coffee │ ├── method_shortdesc.json │ ├── optional_arguments.coffee │ ├── optional_arguments.json │ ├── paragraph_desc.coffee │ ├── paragraph_desc.json │ ├── preprocessor_flagging.coffee │ ├── preprocessor_flagging.json │ ├── prototypical_methods.coffee │ ├── prototypical_methods.json │ ├── return_values.coffee │ ├── return_values.json │ ├── return_values_long.coffee │ └── return_values_long.json ├── src ├── biscotto.coffee ├── generator.coffee ├── metadata.coffee ├── nodes │ ├── class.coffee │ ├── doc.coffee │ ├── file.coffee │ ├── method.coffee │ ├── mixin.coffee │ ├── node.coffee │ ├── parameter.coffee │ ├── property.coffee │ ├── variable.coffee │ └── virtual_method.coffee ├── parser.coffee └── util │ ├── markdown.coffee │ ├── referencer.coffee │ ├── standardObjs.json │ ├── templater.coffee │ └── text.coffee └── theme └── default ├── assets ├── biscotto.css └── biscotto.js ├── lib ├── scripts │ ├── biscotto.js │ ├── fuzzy.js │ ├── highlight.js │ ├── jquery.js │ ├── keymaster.js │ ├── languages │ │ ├── apache.js │ │ ├── bash.js │ │ ├── coffeescript.js │ │ ├── css.js │ │ ├── diff.js │ │ ├── javascript.js │ │ ├── nginx.js │ │ ├── ruby.js │ │ ├── sql.js │ │ └── xml.js │ └── underscore.js └── styles │ ├── base.css │ ├── class.css │ ├── footer.css │ ├── github.css │ ├── header.css │ ├── highlight.css │ ├── index.css │ ├── lists.css │ └── toc.css ├── src ├── coffee │ ├── biscotto.coffee │ └── fuzzy.coffee └── styles │ ├── base.scss │ ├── class.scss │ ├── footer.scss │ ├── header.scss │ ├── highlight.scss │ ├── index.scss │ ├── lists.scss │ └── toc.scss └── templates ├── class.hamlc ├── class_list.hamlc ├── extra.hamlc ├── extra_list.hamlc ├── file.hamlc ├── file_list.hamlc ├── frames.hamlc ├── index.hamlc ├── method_list.hamlc ├── mixin.hamlc ├── mixin_list.hamlc └── partials ├── doc.hamlc ├── footer.hamlc ├── head.hamlc ├── header.hamlc ├── list_nav.hamlc ├── method_list.hamlc └── method_summary.hamlc /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/**/* 3 | !/spec/metadata_templates/test_package/node_modules/grim 4 | Gemfile.lock 5 | .bundle 6 | .idea 7 | .sass-cache 8 | doc 9 | out.json 10 | atom_src 11 | npm-debug.log 12 | js_src/ 13 | dummy/ 14 | .grunt/ 15 | metadata.json 16 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | spec 2 | .npmignore 3 | .travis.yml 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.10 4 | before_script: 5 | - npm install -g grunt-cli 6 | git: 7 | depth: 10 8 | 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to Biscotto 2 | 3 | ## Report issues 4 | 5 | Issues hosted at [GitHub Issues](https://github.com/atom/biscotto/issues). 6 | 7 | The Codo specs are template based, so make sure you provide a code snippet that can be added as failing spec to the 8 | project when reporting an issue with parsing your CoffeeScript code. 9 | 10 | _You can check if some parsing errors have occurred by running Biscotto in verbose mode._ 11 | 12 | ## Development 13 | 14 | Source hosted at [GitHub](https://github.com/atom/biscotto). 15 | 16 | Pull requests are very welcome! Please try to follow these simple rules if applicable: 17 | 18 | * Please create a topic branch for every separate change you make. 19 | * Make sure your patches are well tested. 20 | * Update the documentation. 21 | * Update the README. 22 | * Update the CHANGELOG for noteworthy changes. 23 | * Please **do not change** the version number. 24 | -------------------------------------------------------------------------------- /Gruntfile.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | 3 | grunt.loadNpmTasks 'grunt-release' 4 | grunt.loadNpmTasks 'grunt-exec' 5 | grunt.loadNpmTasks 'grunt-gh-pages' 6 | 7 | grunt.initConfig 8 | release: 9 | options: 10 | bump: false 11 | add: false 12 | push: false 13 | tagName: "v<%= version %>" 14 | exec: 15 | test: 16 | command: "./node_modules/jasmine-node/bin/jasmine-node --coffee spec" 17 | build_docs: 18 | command: "./bin/biscotto src/" 19 | 20 | 'gh-pages': 21 | options: 22 | base: "doc" 23 | src: ['**'] 24 | 25 | grunt.registerTask('test', 'exec:test') 26 | grunt.registerTask('publish', ['exec:build_docs', 'gh-pages']) 27 | grunt.registerTask('default', ['test']) 28 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | notification :gntp 2 | 3 | group :biscotto do 4 | # CoffeeScript for the biscotto library 5 | guard :coffeescript, input: 'src', output: 'lib', noop: true 6 | 7 | # Run Jasmine specs 8 | guard :shell do 9 | jasmine_node = File.expand_path('../node_modules/jasmine-node/bin/jasmine-node', __FILE__) 10 | watch(%r{src|spec}) { `#{jasmine_node} --coffee --color spec/parser_spec.coffee` } 11 | end 12 | 13 | # Generate biscotto doc 14 | guard :shell do 15 | watch(%r{src|theme}) { `./bin/biscotto` } 16 | end 17 | end 18 | 19 | group :theme do 20 | # CoffeeScript for the default template 21 | guard :coffeescript, input: 'theme/default/src/coffee', output: 'theme/default/lib/scripts' 22 | 23 | # Compile the Compass style sheets 24 | guard :compass, configuration_file: 'config/compass.rb' do 25 | watch(%r{^theme\/default\/src\/styles\/(.*)\.scss}) 26 | end 27 | 28 | # Pack assets with Jammit for NPM distribution 29 | guard :jammit, hide_success: true, public_root: 'theme/default' do 30 | watch(/^theme\/default\/lib\/scripts\/(.*)\.js$/) 31 | watch(/^theme\/default\/lib\/styles\/(.*)\.css$/) 32 | end 33 | 34 | # Pack assets with Jammit for LiveReload 35 | guard :jammit, public_root: 'doc' do 36 | watch(/^theme\/default\/lib\/scripts\/(.*)\.js$/) 37 | watch(/^theme\/default\/lib\/styles\/(.*)\.css$/) 38 | end 39 | 40 | # Load changes with LiveReload into browser 41 | guard :livereload do 42 | watch(%r{^doc\/(.+)$}) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2013 Garen J. Torikian 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /bin/biscotto: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('coffee-script/register'); 3 | require('../src/biscotto').run(); 4 | -------------------------------------------------------------------------------- /config/assets.yml: -------------------------------------------------------------------------------- 1 | embed_assets: off 2 | compress_assets: on 3 | gzip_assets: off 4 | 5 | javascripts: 6 | biscotto: 7 | - theme/default/lib/scripts/jquery.js 8 | - theme/default/lib/scripts/keymaster.js 9 | - theme/default/lib/scripts/underscore.js 10 | - theme/default/lib/scripts/biscotto.js 11 | - theme/default/lib/scripts/fuzzy.js 12 | - theme/default/lib/scripts/highlight.js 13 | - theme/default/lib/scripts/languages/*.js 14 | 15 | stylesheets: 16 | biscotto: 17 | - theme/default/lib/styles/*.css 18 | -------------------------------------------------------------------------------- /config/compass.rb: -------------------------------------------------------------------------------- 1 | # Set this to the root of your project when deployed: 2 | http_path = "/" 3 | css_dir = "theme/default/lib/styles" 4 | sass_dir = "theme/default/src/styles" 5 | images_dir = "theme/default/lib/images" 6 | javascripts_dir = "theme/default/lib/scripts" 7 | 8 | # You can select your preferred output style here (can be overridden via the command line): 9 | # output_style = :expanded or :nested or :compact or :compressed 10 | 11 | # To enable relative paths to assets via compass helper functions. Uncomment: 12 | # relative_assets = true 13 | 14 | # To disable debugging comments that display the original location of your selectors. Uncomment: 15 | # line_comments = false 16 | 17 | 18 | # If you prefer the indented syntax, you might want to regenerate this 19 | # project again passing --syntax sass, or you can uncomment this: 20 | # preferred_syntax = :sass 21 | # and then run: 22 | # sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "biscotto", 3 | "description": "A CoffeeScript documentation generator.", 4 | "keywords": [ 5 | "coffeescript", 6 | "doc", 7 | "api", 8 | "tomdoc" 9 | ], 10 | "author": "Garen J. Torikian ", 11 | "maintainers": [ 12 | { 13 | "name": "Garen J. Torikian" 14 | } 15 | ], 16 | "version": "2.3.1", 17 | "engines": { 18 | "node": ">=0.10.0" 19 | }, 20 | "main": "./src/biscotto", 21 | "bin": { 22 | "biscotto": "./bin/biscotto" 23 | }, 24 | "dependencies": { 25 | "coffee-script": ">= 1.6.2", 26 | "source-map": "0.1.29", 27 | "walkdir": ">= 0.0.2", 28 | "optimist": "~0.3.5", 29 | "marked": ">= 0.1.9", 30 | "underscore": "1.6.0", 31 | "underscore.string": ">= 0.1.0", 32 | "haml-coffee": ">= 0.6.0", 33 | "mkdirp": ">= 0.1.0", 34 | "connect": ">= 0.1.0", 35 | "async": ">= 0.1.22", 36 | "colors": "~0.6.2", 37 | "builtins": "0.0.4" 38 | }, 39 | "devDependencies": { 40 | "grunt": "~0.4.1", 41 | "grunt-release": "~0.6.0", 42 | "grunt-exec": "0.4.3", 43 | "grunt-gh-pages": "0.9.0", 44 | "jasmine-node": ">= 1.0.13", 45 | "jasmine-focused": ">= 1.0.5", 46 | "jsondiffpatch": "~0.1", 47 | "grunt-cli": "~0.1.13" 48 | }, 49 | "homepage": "https://github.com/atom/biscotto", 50 | "repository": { 51 | "type": "git", 52 | "url": "git://github.com/atom/biscotto.git" 53 | }, 54 | "scripts": { 55 | "test": "grunt test" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /spec/metadata_spec.coffee: -------------------------------------------------------------------------------- 1 | fs = require 'fs' 2 | path = require 'path' 3 | 4 | {inspect} = require 'util' 5 | walkdir = require 'walkdir' 6 | Biscotto = require '../src/biscotto' 7 | Parser = require '../src/parser' 8 | Metadata = require '../src/metadata' 9 | 10 | {diff} = require 'jsondiffpatch' 11 | _ = require 'underscore' 12 | _.str = require 'underscore.string' 13 | 14 | require 'jasmine-focused' 15 | 16 | describe "Metadata", -> 17 | parser = null 18 | 19 | constructDelta = (filename, hasReferences = false) -> 20 | source = fs.readFileSync filename, 'utf8' 21 | 22 | parser.parseContent source, filename 23 | metadata = new Metadata({}, parser) 24 | metadata.generate(CoffeeScript.nodes(source)) 25 | generated = Biscotto.populateSlug({ files: {} }, filename, metadata) 26 | 27 | expected_filename = filename.replace(/\.coffee$/, '.json') 28 | expected = JSON.stringify(JSON.parse(fs.readFileSync expected_filename, 'utf8'), null, 2) 29 | generated = JSON.stringify(generated, null, 2) 30 | 31 | checkDelta(expected_filename, expected, generated, diff(expected, generated)) 32 | 33 | checkDelta = (expected_filename, expected, generated, delta) -> 34 | if delta? 35 | if process.env.BISCOTTO_DEBUG 36 | fs.writeFileSync(expected_filename, generated + "\n") 37 | else 38 | console.error expected, generated 39 | console.error(delta) 40 | expect(delta).toBe(undefined) 41 | 42 | beforeEach -> 43 | parser = new Parser({ 44 | inputs: [] 45 | output: '' 46 | extras: [] 47 | readme: '' 48 | title: '' 49 | quiet: false 50 | private: true 51 | verbose: true 52 | metadata: true 53 | github: '' 54 | }) 55 | 56 | describe "Classes", -> 57 | it 'understands descriptions', -> 58 | constructDelta("spec/metadata_templates/classes/basic_class.coffee") 59 | 60 | it 'understands class properties', -> 61 | constructDelta("spec/metadata_templates/classes/class_with_class_properties.coffee") 62 | 63 | it 'understands prototype properties', -> 64 | constructDelta("spec/metadata_templates/classes/class_with_prototype_properties.coffee") 65 | 66 | it 'understands comment sections properties', -> 67 | constructDelta("spec/metadata_templates/classes/class_with_comment_section.coffee") 68 | 69 | it 'selects the correct doc string for each function', -> 70 | constructDelta("spec/metadata_templates/classes/classes_with_similar_methods.coffee") 71 | 72 | it 'preserves comment indentation', -> 73 | constructDelta("spec/metadata_templates/classes/class_with_comment_indentation.coffee") 74 | 75 | describe "Exports", -> 76 | it 'understands basic exports', -> 77 | constructDelta("spec/metadata_templates/exports/basic_exports.coffee") 78 | 79 | it 'understands class exports', -> 80 | constructDelta("spec/metadata_templates/exports/class_exports.coffee") 81 | 82 | describe "Requires", -> 83 | it 'understands basic requires', -> 84 | constructDelta("spec/metadata_templates/requires/basic_requires.coffee") 85 | 86 | it 'understands multiple requires on a single line', -> 87 | constructDelta("spec/metadata_templates/requires/multiple_requires_single_line.coffee") 88 | 89 | it 'understands requires with a colon', -> 90 | constructDelta("spec/metadata_templates/requires/requires_with_colon.coffee") 91 | 92 | it 'understands importing', -> 93 | constructDelta("spec/metadata_templates/requires/references/buffer-patch.coffee") 94 | 95 | describe "A real package", -> 96 | packageJsonPath = null 97 | test_path = null 98 | 99 | beforeEach -> 100 | test_path = path.join("spec", "metadata_templates", "test_package") 101 | packageJsonPath = path.join(test_path, 'package.json') 102 | for file in fs.readdirSync(path.join(test_path, "src")) 103 | parser.parseFile path.join(test_path, "src", file) 104 | 105 | it "renders the package correctly", -> 106 | slug = Biscotto.generateMetadataSlug(packageJsonPath, parser, {output: ""}) 107 | 108 | expected_filename = path.join(test_path, 'test_metadata.json') 109 | expected = JSON.stringify(JSON.parse(fs.readFileSync expected_filename, 'utf8'), null, 2) 110 | generated = JSON.stringify(slug, null, 2) 111 | 112 | checkDelta(expected_filename, expected, generated, diff(expected, generated)) 113 | expect(_.keys(slug.files)).not.toContain "./Gruntfile.coffee" 114 | expect(_.keys(slug.files)).not.toContain "./spec/text-buffer-spec.coffee" 115 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/basic_class.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | # 4 | module.exports = 5 | class TextBuffer 6 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/basic_class.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/basic_class.coffee": { 4 | "objects": { 5 | "4": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "bindingType": "exports", 10 | "classProperties": [], 11 | "prototypeProperties": [], 12 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", 13 | "range": [ 14 | [ 15 | 4, 16 | 0 17 | ], 18 | [ 19 | 4, 20 | 15 21 | ] 22 | ] 23 | } 24 | } 25 | }, 26 | "exports": 4 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_class_properties.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | # 4 | class TextBuffer 5 | @prop2: "bar" 6 | 7 | # Public: Takes an argument and does some stuff. 8 | # 9 | # a - A {String} 10 | # 11 | # Returns {Boolean}. 12 | @method2: (a) -> 13 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_class_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/class_with_class_properties.coffee": { 4 | "objects": { 5 | "3": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "classProperties": [ 10 | [ 11 | 4, 12 | 10 13 | ], 14 | [ 15 | 11, 16 | 12 17 | ] 18 | ], 19 | "prototypeProperties": [], 20 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", 21 | "range": [ 22 | [ 23 | 3, 24 | 0 25 | ], 26 | [ 27 | 11, 28 | 18 29 | ] 30 | ] 31 | } 32 | }, 33 | "4": { 34 | "10": { 35 | "name": "prop2", 36 | "type": "primitive", 37 | "range": [ 38 | [ 39 | 4, 40 | 10 41 | ], 42 | [ 43 | 4, 44 | 14 45 | ] 46 | ], 47 | "bindingType": "classProperty" 48 | } 49 | }, 50 | "11": { 51 | "12": { 52 | "name": "method2", 53 | "bindingType": "classProperty", 54 | "type": "function", 55 | "paramNames": [ 56 | "a" 57 | ], 58 | "range": [ 59 | [ 60 | 11, 61 | 12 62 | ], 63 | [ 64 | 11, 65 | 17 66 | ] 67 | ], 68 | "doc": " Public: Takes an argument and does some stuff.\n\na - A {String}\n\nReturns {Boolean}. " 69 | } 70 | } 71 | }, 72 | "exports": {} 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_comment_indentation.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | class TextBuffer 4 | 5 | # Public: Takes an argument and does some stuff. 6 | # 7 | # * one 8 | # * two 9 | # * three 10 | # * four 11 | # * five 12 | @copy: -> 13 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_comment_indentation.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/class_with_comment_indentation.coffee": { 4 | "objects": { 5 | "2": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "classProperties": [ 10 | [ 11 | 11, 12 | 9 13 | ] 14 | ], 15 | "prototypeProperties": [], 16 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text. ", 17 | "range": [ 18 | [ 19 | 2, 20 | 0 21 | ], 22 | [ 23 | 11, 24 | 11 25 | ] 26 | ] 27 | } 28 | }, 29 | "11": { 30 | "9": { 31 | "name": "copy", 32 | "bindingType": "classProperty", 33 | "type": "function", 34 | "paramNames": [], 35 | "range": [ 36 | [ 37 | 11, 38 | 9 39 | ], 40 | [ 41 | 11, 42 | 10 43 | ] 44 | ], 45 | "doc": " Public: Takes an argument and does some stuff.\n\n* one\n * two\n * three\n * four\n * five " 46 | } 47 | } 48 | }, 49 | "exports": {} 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_comment_section.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | # 4 | class TextBuffer 5 | prop2: "bar" 6 | 7 | ### 8 | Section: Something 9 | ### 10 | 11 | # Public: Takes an argument and does some stuff. 12 | # 13 | # a - A {String} 14 | # 15 | # Returns {Boolean}. 16 | method2: (a) -> 17 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_comment_section.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/class_with_comment_section.coffee": { 4 | "objects": { 5 | "3": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "classProperties": [], 10 | "prototypeProperties": [ 11 | [ 12 | 4, 13 | 9 14 | ], 15 | [ 16 | 15, 17 | 11 18 | ] 19 | ], 20 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", 21 | "range": [ 22 | [ 23 | 3, 24 | 0 25 | ], 26 | [ 27 | 15, 28 | 17 29 | ] 30 | ] 31 | } 32 | }, 33 | "4": { 34 | "9": { 35 | "name": "prop2", 36 | "type": "primitive", 37 | "range": [ 38 | [ 39 | 4, 40 | 9 41 | ], 42 | [ 43 | 4, 44 | 13 45 | ] 46 | ], 47 | "bindingType": "prototypeProperty" 48 | } 49 | }, 50 | "6": { 51 | "2": { 52 | "type": "comment", 53 | "doc": "\nSection: Something\n", 54 | "range": [ 55 | [ 56 | 6, 57 | 2 58 | ], 59 | [ 60 | 8, 61 | 4 62 | ] 63 | ] 64 | } 65 | }, 66 | "15": { 67 | "11": { 68 | "name": "method2", 69 | "bindingType": "prototypeProperty", 70 | "type": "function", 71 | "paramNames": [ 72 | "a" 73 | ], 74 | "range": [ 75 | [ 76 | 15, 77 | 11 78 | ], 79 | [ 80 | 15, 81 | 16 82 | ] 83 | ], 84 | "doc": " Public: Takes an argument and does some stuff.\n\na - A {String}\n\nReturns {Boolean}. " 85 | } 86 | } 87 | }, 88 | "exports": {} 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_prototype_properties.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | # 4 | class TextBuffer 5 | prop2: "bar" 6 | 7 | # Public: Takes an argument and does some stuff. 8 | # 9 | # a - A {String} 10 | # 11 | # Returns {Boolean}. 12 | method2: (a) -> 13 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/class_with_prototype_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/class_with_prototype_properties.coffee": { 4 | "objects": { 5 | "3": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "classProperties": [], 10 | "prototypeProperties": [ 11 | [ 12 | 4, 13 | 9 14 | ], 15 | [ 16 | 11, 17 | 11 18 | ] 19 | ], 20 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", 21 | "range": [ 22 | [ 23 | 3, 24 | 0 25 | ], 26 | [ 27 | 11, 28 | 17 29 | ] 30 | ] 31 | } 32 | }, 33 | "4": { 34 | "9": { 35 | "name": "prop2", 36 | "type": "primitive", 37 | "range": [ 38 | [ 39 | 4, 40 | 9 41 | ], 42 | [ 43 | 4, 44 | 13 45 | ] 46 | ], 47 | "bindingType": "prototypeProperty" 48 | } 49 | }, 50 | "11": { 51 | "11": { 52 | "name": "method2", 53 | "bindingType": "prototypeProperty", 54 | "type": "function", 55 | "paramNames": [ 56 | "a" 57 | ], 58 | "range": [ 59 | [ 60 | 11, 61 | 11 62 | ], 63 | [ 64 | 11, 65 | 16 66 | ] 67 | ], 68 | "doc": " Public: Takes an argument and does some stuff.\n\na - A {String}\n\nReturns {Boolean}. " 69 | } 70 | } 71 | }, 72 | "exports": {} 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/classes_with_similar_methods.coffee: -------------------------------------------------------------------------------- 1 | # Public: A mutable text container with undo/redo support and the ability to 2 | # annotate logical regions in the text. 3 | class TextBuffer 4 | # Public: Takes an argument and does some stuff. 5 | @copy: -> 6 | 7 | class DisplayBuffer 8 | # Private: Nope, not the same as the other `copy()` 9 | @copy: -> 10 | -------------------------------------------------------------------------------- /spec/metadata_templates/classes/classes_with_similar_methods.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/classes/classes_with_similar_methods.coffee": { 4 | "objects": { 5 | "2": { 6 | "0": { 7 | "type": "class", 8 | "name": "TextBuffer", 9 | "classProperties": [ 10 | [ 11 | 4, 12 | 9 13 | ] 14 | ], 15 | "prototypeProperties": [], 16 | "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text. ", 17 | "range": [ 18 | [ 19 | 2, 20 | 0 21 | ], 22 | [ 23 | 5, 24 | 0 25 | ] 26 | ] 27 | } 28 | }, 29 | "4": { 30 | "9": { 31 | "name": "copy", 32 | "bindingType": "classProperty", 33 | "type": "function", 34 | "paramNames": [], 35 | "range": [ 36 | [ 37 | 4, 38 | 9 39 | ], 40 | [ 41 | 4, 42 | 10 43 | ] 44 | ], 45 | "doc": "Public: Takes an argument and does some stuff. " 46 | } 47 | }, 48 | "6": { 49 | "0": { 50 | "type": "class", 51 | "name": "DisplayBuffer", 52 | "classProperties": [ 53 | [ 54 | 8, 55 | 9 56 | ] 57 | ], 58 | "prototypeProperties": [], 59 | "doc": "~Private~", 60 | "range": [ 61 | [ 62 | 6, 63 | 0 64 | ], 65 | [ 66 | 8, 67 | 11 68 | ] 69 | ] 70 | } 71 | }, 72 | "8": { 73 | "9": { 74 | "name": "copy", 75 | "bindingType": "classProperty", 76 | "type": "function", 77 | "paramNames": [], 78 | "range": [ 79 | [ 80 | 8, 81 | 9 82 | ], 83 | [ 84 | 8, 85 | 10 86 | ] 87 | ], 88 | "doc": "Private: Nope, not the same as the other `copy()` " 89 | } 90 | } 91 | }, 92 | "exports": {} 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /spec/metadata_templates/exports/basic_exports.coffee: -------------------------------------------------------------------------------- 1 | # Public: Returns hello 2 | foo = -> 'hello' 3 | 4 | exports.foo = foo 5 | 6 | # Exporting the answer to life, the universe, and everything. 7 | exports.bar = 42 8 | -------------------------------------------------------------------------------- /spec/metadata_templates/exports/basic_exports.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/exports/basic_exports.coffee": { 4 | "objects": { 5 | "1": { 6 | "6": { 7 | "name": "foo", 8 | "bindingType": "variable", 9 | "type": "function", 10 | "paramNames": [], 11 | "range": [ 12 | [ 13 | 1, 14 | 6 15 | ], 16 | [ 17 | 1, 18 | 15 19 | ] 20 | ], 21 | "doc": { 22 | "comment": "Public: Returns hello ", 23 | "summary": "Returns hello", 24 | "status": "Public" 25 | } 26 | } 27 | }, 28 | "6": { 29 | "0": { 30 | "name": "bar", 31 | "bindingType": "exportsProperty", 32 | "type": "primitive", 33 | "range": [ 34 | [ 35 | 6, 36 | 0 37 | ], 38 | [ 39 | 6, 40 | 6 41 | ] 42 | ] 43 | } 44 | } 45 | }, 46 | "exports": { 47 | "foo": 3, 48 | "bar": 6 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /spec/metadata_templates/exports/class_exports.coffee: -------------------------------------------------------------------------------- 1 | module.exports = 2 | class Foo 3 | -------------------------------------------------------------------------------- /spec/metadata_templates/exports/class_exports.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/exports/class_exports.coffee": { 4 | "objects": { 5 | "1": { 6 | "0": { 7 | "type": "class", 8 | "name": "Foo", 9 | "bindingType": "exports", 10 | "classProperties": [], 11 | "prototypeProperties": [], 12 | "doc": "~Private~", 13 | "range": [ 14 | [ 15 | 1, 16 | 0 17 | ], 18 | [ 19 | 1, 20 | 8 21 | ] 22 | ] 23 | } 24 | } 25 | }, 26 | "exports": 1 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/basic_requires.coffee: -------------------------------------------------------------------------------- 1 | {Foo} = require 'foo' 2 | {defs:foof} = require 'defs2' 3 | {faz, baz} = require 'kaz' 4 | 5 | class Bar 6 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/basic_requires.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/requires/basic_requires.coffee": { 4 | "objects": { 5 | "0": { 6 | "1": { 7 | "type": "import", 8 | "range": [ 9 | [ 10 | 0, 11 | 1 12 | ], 13 | [ 14 | 0, 15 | 3 16 | ] 17 | ], 18 | "bindingType": "variable", 19 | "module": "foo", 20 | "name": "Foo", 21 | "exportsProperty": "Foo" 22 | } 23 | }, 24 | "1": { 25 | "14": { 26 | "type": "import", 27 | "range": [ 28 | [ 29 | 1, 30 | 14 31 | ], 32 | [ 33 | 1, 34 | 28 35 | ] 36 | ], 37 | "bindingType": "variable", 38 | "module": "defs2", 39 | "name": "foof", 40 | "exportsProperty": "defs" 41 | } 42 | }, 43 | "2": { 44 | "1": { 45 | "type": "import", 46 | "range": [ 47 | [ 48 | 2, 49 | 1 50 | ], 51 | [ 52 | 2, 53 | 3 54 | ] 55 | ], 56 | "bindingType": "variable", 57 | "module": "kaz", 58 | "name": "faz", 59 | "exportsProperty": "faz" 60 | }, 61 | "6": { 62 | "type": "import", 63 | "range": [ 64 | [ 65 | 2, 66 | 6 67 | ], 68 | [ 69 | 2, 70 | 8 71 | ] 72 | ], 73 | "bindingType": "variable", 74 | "module": "kaz", 75 | "name": "baz", 76 | "exportsProperty": "baz" 77 | } 78 | }, 79 | "4": { 80 | "0": { 81 | "type": "class", 82 | "name": "Bar", 83 | "classProperties": [], 84 | "prototypeProperties": [], 85 | "doc": "~Private~", 86 | "range": [ 87 | [ 88 | 4, 89 | 0 90 | ], 91 | [ 92 | 4, 93 | 8 94 | ] 95 | ] 96 | } 97 | } 98 | }, 99 | "exports": {} 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/multiple_requires_single_line.coffee: -------------------------------------------------------------------------------- 1 | {faz, baz} = require 'kaz' 2 | 3 | class Bar 4 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/multiple_requires_single_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/requires/multiple_requires_single_line.coffee": { 4 | "objects": { 5 | "0": { 6 | "1": { 7 | "type": "import", 8 | "range": [ 9 | [ 10 | 0, 11 | 1 12 | ], 13 | [ 14 | 0, 15 | 3 16 | ] 17 | ], 18 | "bindingType": "variable", 19 | "module": "kaz", 20 | "name": "faz", 21 | "exportsProperty": "faz" 22 | }, 23 | "6": { 24 | "type": "import", 25 | "range": [ 26 | [ 27 | 0, 28 | 6 29 | ], 30 | [ 31 | 0, 32 | 8 33 | ] 34 | ], 35 | "bindingType": "variable", 36 | "module": "kaz", 37 | "name": "baz", 38 | "exportsProperty": "baz" 39 | } 40 | }, 41 | "2": { 42 | "0": { 43 | "type": "class", 44 | "name": "Bar", 45 | "classProperties": [], 46 | "prototypeProperties": [], 47 | "doc": "~Private~", 48 | "range": [ 49 | [ 50 | 2, 51 | 0 52 | ], 53 | [ 54 | 2, 55 | 8 56 | ] 57 | ] 58 | } 59 | } 60 | }, 61 | "exports": {} 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/references/buffer-patch.coffee: -------------------------------------------------------------------------------- 1 | {getTextOG} = require './helpers' 2 | 3 | module.exports = 4 | class TextBuffer 5 | getText: getTextOG 6 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/references/buffer-patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/requires/references/buffer-patch.coffee": { 4 | "objects": { 5 | "0": { 6 | "1": { 7 | "type": "import", 8 | "range": [ 9 | [ 10 | 0, 11 | 1 12 | ], 13 | [ 14 | 0, 15 | 9 16 | ] 17 | ], 18 | "bindingType": "variable", 19 | "path": "./helpers", 20 | "name": "getTextOG", 21 | "exportsProperty": "getTextOG" 22 | } 23 | }, 24 | "3": { 25 | "0": { 26 | "type": "class", 27 | "name": "TextBuffer", 28 | "bindingType": "exports", 29 | "classProperties": [], 30 | "prototypeProperties": [ 31 | [ 32 | 4, 33 | 11 34 | ] 35 | ], 36 | "doc": "~Private~", 37 | "range": [ 38 | [ 39 | 3, 40 | 0 41 | ], 42 | [ 43 | 4, 44 | 20 45 | ] 46 | ] 47 | } 48 | }, 49 | "4": { 50 | "11": { 51 | "name": "getText", 52 | "type": "primitive", 53 | "range": [ 54 | [ 55 | 4, 56 | 11 57 | ], 58 | [ 59 | 4, 60 | 19 61 | ] 62 | ], 63 | "bindingType": "prototypeProperty", 64 | "reference": { 65 | "position": [ 66 | 0, 67 | 1 68 | ] 69 | } 70 | } 71 | } 72 | }, 73 | "exports": 3 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/requires_with_colon.coffee: -------------------------------------------------------------------------------- 1 | {defs:foof} = require 'defs2' 2 | 3 | class Bar 4 | -------------------------------------------------------------------------------- /spec/metadata_templates/requires/requires_with_colon.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "spec/metadata_templates/requires/requires_with_colon.coffee": { 4 | "objects": { 5 | "0": { 6 | "14": { 7 | "type": "import", 8 | "range": [ 9 | [ 10 | 0, 11 | 14 12 | ], 13 | [ 14 | 0, 15 | 28 16 | ] 17 | ], 18 | "bindingType": "variable", 19 | "module": "defs2", 20 | "name": "foof", 21 | "exportsProperty": "defs" 22 | } 23 | }, 24 | "2": { 25 | "0": { 26 | "type": "class", 27 | "name": "Bar", 28 | "classProperties": [], 29 | "prototypeProperties": [], 30 | "doc": "~Private~", 31 | "range": [ 32 | [ 33 | 2, 34 | 0 35 | ], 36 | [ 37 | 2, 38 | 8 39 | ] 40 | ] 41 | } 42 | } 43 | }, 44 | "exports": {} 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/Gruntfile.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | grunt.initConfig 3 | pkg: grunt.file.readJSON('package.json') 4 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./lib/test", 3 | "dependencies": { 4 | "grim": "0.11.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/src/point.coffee: -------------------------------------------------------------------------------- 1 | # Public: Represents a point in a buffer in row/column coordinates. 2 | # 3 | # Every public method that takes a point also accepts a *point-compatible* 4 | # {Array}. This means a 2-element array containing {Number}s representing the 5 | # row and column. So the following are equivalent: 6 | # 7 | # ```coffee 8 | # new Point(1, 2) 9 | # [1, 2] 10 | # ``` 11 | module.exports = 12 | class Point 13 | # Public: Convert any point-compatible object to a {Point}. 14 | # 15 | # * object: 16 | # This can be an object that's already a {Point}, in which case it's 17 | # simply returned, or an array containing two {Number}s representing the 18 | # row and column. 19 | # 20 | # * copy: 21 | # An optional boolean indicating whether to force the copying of objects 22 | # that are already points. 23 | # 24 | # Returns: A {Point} based on the given object. 25 | @fromObject: (object, copy) -> 26 | if object instanceof Point 27 | if copy then object.copy() else object 28 | else 29 | if Array.isArray(object) 30 | [row, column] = object 31 | else 32 | { row, column } = object 33 | 34 | new Point(row, column) 35 | 36 | # Public: Returns the given point that is earlier in the buffer. 37 | @min: (point1, point2) -> 38 | point1 = @fromObject(point1) 39 | point2 = @fromObject(point2) 40 | if point1.isLessThanOrEqual(point2) 41 | point1 42 | else 43 | point2 44 | 45 | constructor: (@row=0, @column=0) -> 46 | 47 | # Public: Returns a new {Point} with the same row and column. 48 | copy: -> 49 | new Point(@row, @column) 50 | 51 | # Public: Makes this point immutable and returns itself. 52 | freeze: -> 53 | Object.freeze(this) 54 | 55 | # Public: Return a new {Point} based on shifting this point by the given delta, 56 | # which is represented by another {Point}. 57 | translate: (delta) -> 58 | {row, column} = Point.fromObject(delta) 59 | new Point(@row + row, @column + column) 60 | 61 | add: (other) -> 62 | other = Point.fromObject(other) 63 | row = @row + other.row 64 | if other.row == 0 65 | column = @column + other.column 66 | else 67 | column = other.column 68 | 69 | new Point(row, column) 70 | 71 | splitAt: (column) -> 72 | if @row == 0 73 | rightColumn = @column - column 74 | else 75 | rightColumn = @column 76 | 77 | [new Point(0, column), new Point(@row, rightColumn)] 78 | 79 | # Public: 80 | # 81 | # * other: A {Point} or point-compatible {Array}. 82 | # 83 | # Returns: 84 | # * -1 if this point precedes the argument. 85 | # * 0 if this point is equivalent to the argument. 86 | # * 1 if this point follows the argument. 87 | compare: (other) -> 88 | if @row > other.row 89 | 1 90 | else if @row < other.row 91 | -1 92 | else 93 | if @column > other.column 94 | 1 95 | else if @column < other.column 96 | -1 97 | else 98 | 0 99 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/src/range.coffee: -------------------------------------------------------------------------------- 1 | Grim = require 'grim' 2 | Point = require './point' 3 | {newlineRegex} = require './helpers' 4 | Fs = require 'fs' 5 | 6 | # Public: Represents a region in a buffer in row/column coordinates. 7 | # 8 | # Every public method that takes a range also accepts a *range-compatible* 9 | # {Array}. This means a 2-element array containing {Point}s or point-compatible 10 | # arrays. So the following are equivalent: 11 | # 12 | # ```coffee 13 | # new Range(new Point(0, 1), new Point(2, 3)) 14 | # new Range([0, 1], [2, 3]) 15 | # [[0, 1], [2, 3]] 16 | # ``` 17 | module.exports = 18 | class Range 19 | grim: Grim 20 | 21 | # Public: Call this with the result of {Range::serialize} to construct a new Range. 22 | @deserialize: (array) -> 23 | new this(array...) 24 | 25 | # Public: Convert any range-compatible object to a {Range}. 26 | # 27 | # * object: 28 | # This can be an object that's already a {Range}, in which case it's 29 | # simply returned, or an array containing two {Point}s or point-compatible 30 | # arrays. 31 | # * copy: 32 | # An optional boolean indicating whether to force the copying of objects 33 | # that are already ranges. 34 | # 35 | # Returns: A {Range} based on the given object. 36 | @fromObject: (object, copy) -> 37 | if Array.isArray(object) 38 | new this(object...) 39 | else if object instanceof this 40 | if copy then object.copy() else object 41 | else 42 | new this(object.start, object.end) 43 | # Public: Returns a {Range} that starts at the given point and ends at the 44 | # start point plus the given row and column deltas. 45 | # 46 | # * startPoint: 47 | # A {Point} or point-compatible {Array} 48 | # * rowDelta: 49 | # A {Number} indicating how many rows to add to the start point to get the 50 | # end point. 51 | # * columnDelta: 52 | # A {Number} indicating how many rows to columns to the start point to get 53 | # the end point. 54 | # 55 | # Returns a {Range} 56 | @fromPointWithDelta: (startPoint, rowDelta, columnDelta) -> 57 | startPoint = Point.fromObject(startPoint) 58 | endPoint = new Point(startPoint.row + rowDelta, startPoint.column + columnDelta) 59 | new this(startPoint, endPoint) 60 | 61 | constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) -> 62 | pointA = Point.fromObject(pointA) 63 | pointB = Point.fromObject(pointB) 64 | 65 | if pointA.isLessThanOrEqual(pointB) 66 | @start = pointA 67 | @end = pointB 68 | else 69 | @start = pointB 70 | @end = pointA 71 | 72 | # Public: Returns a {Boolean} indicating whether this range has the same start 73 | # and end points as the given {Range} or range-compatible {Array}. 74 | isEqual: (other) -> 75 | return false unless other? 76 | other = @constructor.fromObject(other) 77 | other.start.isEqual(@start) and other.end.isEqual(@end) 78 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/src/test.coffee: -------------------------------------------------------------------------------- 1 | Point = require './point' 2 | Range = require './range' 3 | 4 | # Public: A mutable text container with undo/redo support and the ability to 5 | # annotate logical regions in the text. 6 | module.exports = 7 | class TestClass 8 | @Range: Range 9 | @newlineRegex: newlineRegex 10 | -------------------------------------------------------------------------------- /spec/metadata_templates/test_package/test/text-buffer-test.coffee: -------------------------------------------------------------------------------- 1 | {join} = require 'path' 2 | temp = require 'temp' 3 | {File} = require 'pathwatcher' 4 | TextBuffer = require '../src/text-buffer' 5 | SampleText = readFileSync(join(__dirname, 'fixtures', 'sample.js'), 'utf8') 6 | 7 | describe "TextBuffer", -> 8 | buffer = null 9 | 10 | afterEach -> 11 | buffer = null 12 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_description_markdown.coffee: -------------------------------------------------------------------------------- 1 | # Biscotto - the TomDoc-CoffeeScript API documentation generator 2 | # 3 | # # Header 1 4 | # 5 | # This is a paragraph. 6 | # 7 | # ## Header 2 8 | # 9 | # This is a paragraph. 10 | # 11 | # ### Header 3 12 | # 13 | # This is a paragraph. 14 | # 15 | # #### Header 4 16 | # 17 | # This is a paragraph. 18 | # 19 | # ##### Header 5 20 | # 21 | # This is a paragraph. 22 | # 23 | # ###### Header 6 24 | # 25 | # This is a paragraph. 26 | # 27 | class TestMarkdownDocumentation -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_description_markdown.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/class_description_markdown.coffee", 4 | "doc": { 5 | "comment": " Private: Biscotto - the TomDoc-CoffeeScript API documentation generator\n\n# Header 1\n\nThis is a paragraph.\n\n## Header 2\n\nThis is a paragraph.\n\n### Header 3\n\nThis is a paragraph.\n\n#### Header 4\n\nThis is a paragraph.\n\n##### Header 5\n\nThis is a paragraph.\n\n###### Header 6\n\nThis is a paragraph.\n\n ", 6 | "summary": "Biscotto - the TomDoc-CoffeeScript API documentation generator", 7 | "status": "Private" 8 | }, 9 | "class": { 10 | "className": "TestMarkdownDocumentation", 11 | "name": "TestMarkdownDocumentation", 12 | "namespace": "" 13 | }, 14 | "location": { 15 | "line": 27 16 | }, 17 | "methods": [], 18 | "variables": [], 19 | "properties": [] 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_documentation.coffee: -------------------------------------------------------------------------------- 1 | # Public: This is a test class with `inline.dot`. Beware. 2 | # 3 | # Examples 4 | # 5 | # Class.getType('cat') 6 | # new Class() 7 | # 8 | # # Alternatively, this is possible 9 | # cl = Class.for(obj) 10 | # cl.execute() 11 | class TestClassDocumentation 12 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_documentation.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/class_documentation.coffee", 4 | "doc": { 5 | "examples": [ 6 | "Class.getType('cat')\nnew Class()", 7 | "# Alternatively, this is possible\ncl = Class.for(obj)\ncl.execute() " 8 | ], 9 | "comment": " Public: This is a test class with `inline.dot`. Beware.\n\nExamples\n\n Class.getType('cat')\n new Class()\n\n # Alternatively, this is possible\n cl = Class.for(obj)\n cl.execute() ", 10 | "summary": "This is a test class with inline.dot.", 11 | "status": "Public" 12 | }, 13 | "class": { 14 | "className": "TestClassDocumentation", 15 | "name": "TestClassDocumentation", 16 | "namespace": "" 17 | }, 18 | "location": { 19 | "line": 11 20 | }, 21 | "methods": [], 22 | "variables": [], 23 | "properties": [] 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_extends.coffee: -------------------------------------------------------------------------------- 1 | class NS.Clazz extends Another.Clazz 2 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/class_extends.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/class_extends.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "NS.Clazz", 12 | "name": "Clazz", 13 | "namespace": "NS", 14 | "parent": "Another.Clazz" 15 | }, 16 | "location": { 17 | "line": 1 18 | }, 19 | "methods": [], 20 | "variables": [], 21 | "properties": [] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/empty_class.coffee: -------------------------------------------------------------------------------- 1 | class A 2 | foo: -> 3 | 4 | class extends A 5 | foo: -> 6 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/empty_class.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/empty_class.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "A", 12 | "name": "A", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "type": "instance", 21 | "signature": "::foo()", 22 | "name": "foo", 23 | "bound": false, 24 | "parameters": [], 25 | "location": { 26 | "line": 2 27 | } 28 | } 29 | ], 30 | "variables": [], 31 | "properties": [] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/export_class.coffee: -------------------------------------------------------------------------------- 1 | # Yep, this should be assigned to the class 2 | module.exports = class TestExportClass 3 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/export_class.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/export_class.coffee", 4 | "doc": { 5 | "comment": "Private: Yep, this should be assigned to the class ", 6 | "summary": "Yep, this should be assigned to the class", 7 | "status": "Private" 8 | }, 9 | "class": { 10 | "className": "TestExportClass", 11 | "name": "TestExportClass", 12 | "namespace": "" 13 | }, 14 | "location": { 15 | "line": 2 16 | }, 17 | "methods": [], 18 | "variables": [], 19 | "properties": [] 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/inner_class.coffee: -------------------------------------------------------------------------------- 1 | class Tower.Model.Relation.HasMany extends Tower.Model.Relation 2 | class @Scope extends @Scope 3 | create: -> 4 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/inner_class.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/inner_class.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "Tower.Model.Relation.HasMany", 12 | "name": "HasMany", 13 | "namespace": "Tower.Model.Relation", 14 | "parent": "Tower.Model.Relation" 15 | }, 16 | "location": { 17 | "line": 1 18 | }, 19 | "methods": [], 20 | "variables": [], 21 | "properties": [] 22 | }, 23 | { 24 | "file": "spec/parser_templates/classes/inner_class.coffee", 25 | "class": { 26 | "className": "Tower.Model.Relation.HasMany.Scope", 27 | "name": "Scope", 28 | "namespace": "Tower.Model.Relation.HasMany", 29 | "parent": "Tower.Model.Relation.Scope" 30 | }, 31 | "location": { 32 | "line": 2 33 | }, 34 | "methods": [ 35 | { 36 | "type": "instance", 37 | "signature": "::create()", 38 | "name": "create", 39 | "bound": false, 40 | "parameters": [], 41 | "location": { 42 | "line": 3 43 | } 44 | } 45 | ], 46 | "variables": [], 47 | "properties": [] 48 | } 49 | ] 50 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/namespaced_class.coffee: -------------------------------------------------------------------------------- 1 | class Some.Namespace.MyClass 2 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/namespaced_class.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/namespaced_class.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "Some.Namespace.MyClass", 12 | "name": "MyClass", 13 | "namespace": "Some.Namespace" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [], 19 | "variables": [], 20 | "properties": [] 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/simple_class.coffee: -------------------------------------------------------------------------------- 1 | class MyTestClass 2 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/simple_class.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/simple_class.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "MyTestClass", 12 | "name": "MyTestClass", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [], 19 | "variables": [], 20 | "properties": [] 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/uppercase_identifiers.coffee: -------------------------------------------------------------------------------- 1 | # Public: Test! 2 | class Test 3 | TESTY_TEST: 1000 4 | -------------------------------------------------------------------------------- /spec/parser_templates/classes/uppercase_identifiers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/classes/uppercase_identifiers.coffee", 4 | "doc": { 5 | "comment": "Public: Test! ", 6 | "summary": "Test!", 7 | "status": "Public" 8 | }, 9 | "class": { 10 | "className": "Test", 11 | "name": "Test", 12 | "namespace": "" 13 | }, 14 | "location": { 15 | "line": 2 16 | }, 17 | "methods": [], 18 | "variables": [ 19 | { 20 | "type": "instance", 21 | "constant": true, 22 | "name": "TESTY_TEST", 23 | "value": "1000", 24 | "location": { 25 | "line": 3 26 | } 27 | } 28 | ], 29 | "properties": [] 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /spec/parser_templates/files/non_class_file.coffee: -------------------------------------------------------------------------------- 1 | # Public: The greeting 2 | GREETING = 'Hay' 3 | 4 | # Public: Says hello to a person 5 | # 6 | # name - The name of the person 7 | # 8 | hello = (name) -> 9 | console.log GREETING, name 10 | 11 | # Public: Says bye to a person 12 | # 13 | # name - The name of the person 14 | # 15 | bye = (name) -> 16 | console.log "Bye, bye #{ name }" 17 | 18 | # Public: Say hi to a person 19 | # 20 | # name - The name of the person 21 | # 22 | module.exports.sayHi = (hi) -> console.log "Hi #{ hi}!" 23 | -------------------------------------------------------------------------------- /spec/parser_templates/files/non_class_file.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "non_class_file.coffee", 4 | "path": "spec/parser_templates/files", 5 | "methods": [ 6 | { 7 | "doc": { 8 | "comment": " Public: Says hello to a person\n\nname - The name of the person\n\n ", 9 | "summary": "Says hello to a person", 10 | "status": "Public", 11 | "params": [ 12 | { 13 | "name": "name", 14 | "desc": "The name of the person", 15 | "type": "" 16 | } 17 | ] 18 | }, 19 | "type": "file", 20 | "signature": "? hello(name)", 21 | "name": "hello", 22 | "bound": false, 23 | "parameters": [ 24 | { 25 | "name": "name", 26 | "splat": false 27 | } 28 | ], 29 | "location": { 30 | "line": 8 31 | } 32 | }, 33 | { 34 | "doc": { 35 | "comment": " Public: Says bye to a person\n\nname - The name of the person\n\n ", 36 | "summary": "Says bye to a person", 37 | "status": "Public", 38 | "params": [ 39 | { 40 | "name": "name", 41 | "desc": "The name of the person", 42 | "type": "" 43 | } 44 | ] 45 | }, 46 | "type": "file", 47 | "signature": "? bye(name)", 48 | "name": "bye", 49 | "bound": false, 50 | "parameters": [ 51 | { 52 | "name": "name", 53 | "splat": false 54 | } 55 | ], 56 | "location": { 57 | "line": 15 58 | } 59 | }, 60 | { 61 | "doc": { 62 | "comment": " Public: Say hi to a person\n\nname - The name of the person\n\n ", 63 | "summary": "Say hi to a person", 64 | "status": "Public", 65 | "params": [ 66 | { 67 | "name": "name", 68 | "desc": "The name of the person", 69 | "type": "" 70 | } 71 | ] 72 | }, 73 | "type": "class", 74 | "signature": ".sayHi(hi)", 75 | "name": "sayHi", 76 | "bound": false, 77 | "parameters": [ 78 | { 79 | "name": "hi", 80 | "splat": false 81 | } 82 | ], 83 | "location": { 84 | "line": 22 85 | } 86 | } 87 | ], 88 | "variables": [ 89 | { 90 | "doc": { 91 | "comment": "Public: The greeting ", 92 | "summary": "The greeting", 93 | "status": "Public" 94 | }, 95 | "type": "class", 96 | "constant": true, 97 | "name": "GREETING", 98 | "value": "'Hay'", 99 | "location": { 100 | "line": 2 101 | } 102 | } 103 | ] 104 | } 105 | ] 106 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/assigned_parameters.coffee: -------------------------------------------------------------------------------- 1 | class TestAssignedParameters 2 | help: (@me) -> 3 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/assigned_parameters.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/assigned_parameters.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestAssignedParameters", 12 | "name": "TestAssignedParameters", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "type": "instance", 21 | "signature": "::help(me)", 22 | "name": "help", 23 | "bound": false, 24 | "parameters": [ 25 | { 26 | "name": "me", 27 | "splat": false 28 | } 29 | ], 30 | "location": { 31 | "line": 2 32 | } 33 | } 34 | ], 35 | "variables": [], 36 | "properties": [] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/class_methods.coffee: -------------------------------------------------------------------------------- 1 | class TestClassMethods 2 | 3 | @helper: -> 4 | 5 | @another: (a, b) -> 6 | 7 | @withDefault: (a = 2, c, d = 'hi', e = { a: 2 }, f = new TestClassMethods()) -> 8 | 9 | @nowWithSpalt: (foo, bar...) -> 10 | 11 | @andSoDoesThis = (foo, bar) -> 12 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/class_methods.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/class_methods.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestClassMethods", 12 | "name": "TestClassMethods", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": "~Private~", 22 | "summary": "", 23 | "status": "Private", 24 | "generated": true 25 | }, 26 | "type": "class", 27 | "signature": ".helper()", 28 | "name": "helper", 29 | "bound": false, 30 | "parameters": [], 31 | "location": { 32 | "line": 3 33 | } 34 | }, 35 | { 36 | "doc": { 37 | "comment": "~Private~", 38 | "summary": "", 39 | "status": "Private", 40 | "generated": true 41 | }, 42 | "type": "class", 43 | "signature": ".another(a, b)", 44 | "name": "another", 45 | "bound": false, 46 | "parameters": [ 47 | { 48 | "name": "a", 49 | "splat": false 50 | }, 51 | { 52 | "name": "b", 53 | "splat": false 54 | } 55 | ], 56 | "location": { 57 | "line": 5 58 | } 59 | }, 60 | { 61 | "doc": { 62 | "comment": "~Private~", 63 | "summary": "", 64 | "status": "Private", 65 | "generated": true 66 | }, 67 | "type": "class", 68 | "signature": ".withDefault(a = 2, c, d = 'hi', e = { a: 2 }, f = new TestClassMethods())", 69 | "name": "withDefault", 70 | "bound": false, 71 | "parameters": [ 72 | { 73 | "name": "a", 74 | "default": "2", 75 | "splat": false 76 | }, 77 | { 78 | "name": "c", 79 | "splat": false 80 | }, 81 | { 82 | "name": "d", 83 | "default": "'hi'", 84 | "splat": false 85 | }, 86 | { 87 | "name": "e", 88 | "default": "{\n a: 2\n}", 89 | "splat": false 90 | }, 91 | { 92 | "name": "f", 93 | "default": "new TestClassMethods()", 94 | "splat": false 95 | } 96 | ], 97 | "location": { 98 | "line": 7 99 | } 100 | }, 101 | { 102 | "doc": { 103 | "comment": "~Private~", 104 | "summary": "", 105 | "status": "Private", 106 | "generated": true 107 | }, 108 | "type": "class", 109 | "signature": ".nowWithSpalt(foo, bar...)", 110 | "name": "nowWithSpalt", 111 | "bound": false, 112 | "parameters": [ 113 | { 114 | "name": "foo", 115 | "splat": false 116 | }, 117 | { 118 | "name": "bar", 119 | "splat": true 120 | } 121 | ], 122 | "location": { 123 | "line": 9 124 | } 125 | }, 126 | { 127 | "doc": { 128 | "comment": "~Private~", 129 | "summary": "", 130 | "status": "Private", 131 | "generated": true 132 | }, 133 | "type": "class", 134 | "signature": ".andSoDoesThis(foo, bar)", 135 | "name": "andSoDoesThis", 136 | "bound": false, 137 | "parameters": [ 138 | { 139 | "name": "foo", 140 | "splat": false 141 | }, 142 | { 143 | "name": "bar", 144 | "splat": false 145 | } 146 | ], 147 | "location": { 148 | "line": 11 149 | } 150 | } 151 | ], 152 | "variables": [], 153 | "properties": [] 154 | } 155 | ] 156 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/curly_method_documentation.coffee: -------------------------------------------------------------------------------- 1 | class App.CurlyMethodDocumentation extends App.Doc 2 | 3 | # Should be overloaded to change fetch limit. 4 | # 5 | # Returns the {Number} of items per fetch 6 | # 7 | fetchLimit: () -> 5 8 | 9 | # Private: Do it! 10 | # 11 | # See {#undo} for more information. 12 | # 13 | # it - The {String} thing to do 14 | # again - A {Boolean} for do it again 15 | # options - The do options 16 | # :speed - The {String} speed 17 | # :repeat - How many {Number} times to repeat 18 | # :tasks - The {Tasks} tasks to do 19 | # 20 | # Returns {Boolean} when successfully executed 21 | # 22 | doIt: (it, again, options) -> 23 | 24 | # Private: Do it without spaces! 25 | # 26 | # See {.lets_do_it} for more information. 27 | # 28 | # Returns {Boolean} when successfully executed 29 | # 30 | doWithoutSpace:(it, again, options)-> 31 | 32 | # Private: Do it! 33 | # 34 | # See {::do} for more information. 35 | # 36 | @lets_do_it = (it, options) -> 37 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/fixtures/private_class.coffee: -------------------------------------------------------------------------------- 1 | # Private: This is a private class. 2 | # 3 | # It does private things. 4 | class PrivateClass 5 | 6 | # Delegated method. 7 | delegatedPrivate: () -> 5 8 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/hash_parameters.coffee: -------------------------------------------------------------------------------- 1 | class TestInstanceMethods 2 | 3 | # Public: Does something. 4 | # 5 | # obj - An object with the following defaults: 6 | # :aaa - Does some stuff 7 | # :bbb - Does some {Integer} stuff 8 | # :ccc - Other stuff 9 | someMethod: (obj={}) -> 10 | 11 | 12 | 13 | # Public: Does something else. 14 | # 15 | # obj - An object with some defaults. 16 | # Those defaults are nice! 17 | # Here are some of those defaults: 18 | # :aaa - Does some {String} stuff 19 | # :bbb - Does some {Integer} stuff 20 | # :ccc - Other stuff 21 | someMethod: (obj={}) -> 22 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/hash_parameters.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/hash_parameters.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestInstanceMethods", 12 | "name": "TestInstanceMethods", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": " Public: Does something.\n\nobj - An object with the following defaults:\n :aaa - Does some stuff\n :bbb - Does some {Integer} stuff\n :ccc - Other stuff ", 22 | "summary": "Does something.", 23 | "status": "Public", 24 | "params": [ 25 | { 26 | "name": "obj", 27 | "desc": "An object with the following defaults:", 28 | "type": "", 29 | "options": [ 30 | { 31 | "name": "aaa", 32 | "desc": "Does some stuff", 33 | "type": "" 34 | }, 35 | { 36 | "name": "bbb", 37 | "desc": "Does some {Integer} stuff", 38 | "type": "Integer" 39 | }, 40 | { 41 | "name": "ccc", 42 | "desc": "Other stuff", 43 | "type": "" 44 | } 45 | ] 46 | } 47 | ] 48 | }, 49 | "type": "instance", 50 | "signature": "::someMethod(obj = {})", 51 | "name": "someMethod", 52 | "bound": false, 53 | "parameters": [ 54 | { 55 | "name": "obj", 56 | "default": "{}", 57 | "splat": false 58 | } 59 | ], 60 | "location": { 61 | "line": 9 62 | } 63 | }, 64 | { 65 | "doc": { 66 | "comment": " Public: Does something else.\n\nobj - An object with some defaults.\n Those defaults are nice!\n Here are some of those defaults:\n :aaa - Does some {String} stuff\n :bbb - Does some {Integer} stuff\n :ccc - Other stuff ", 67 | "summary": "Does something else.", 68 | "status": "Public", 69 | "params": [ 70 | { 71 | "name": "obj", 72 | "desc": "An object with some defaults. Those defaults are nice! Here are some of those defaults:", 73 | "type": "", 74 | "options": [ 75 | { 76 | "name": "aaa", 77 | "desc": "Does some {String} stuff", 78 | "type": "String" 79 | }, 80 | { 81 | "name": "bbb", 82 | "desc": "Does some {Integer} stuff", 83 | "type": "Integer" 84 | }, 85 | { 86 | "name": "ccc", 87 | "desc": "Other stuff", 88 | "type": "" 89 | } 90 | ] 91 | } 92 | ] 93 | }, 94 | "type": "instance", 95 | "signature": "::someMethod(obj = {})", 96 | "name": "someMethod", 97 | "bound": false, 98 | "parameters": [ 99 | { 100 | "name": "obj", 101 | "default": "{}", 102 | "splat": false 103 | } 104 | ], 105 | "location": { 106 | "line": 21 107 | } 108 | } 109 | ], 110 | "variables": [], 111 | "properties": [] 112 | } 113 | ] 114 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/instance_methods.coffee: -------------------------------------------------------------------------------- 1 | class TestInstanceMethods 2 | 3 | helper: -> 4 | 5 | another: (param, obj) -> 6 | 7 | anotherWithValues: (param = 123, obj = { a: 1 }, yup, comp = new TestInstanceMethods()) -> 8 | 9 | nowWithSpalt: (foo, bar...) -> 10 | 11 | bound: => 12 | 13 | # This is not exposed to the outside world. 14 | internalToClassClosure = -> alert 'internal!' 15 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/instance_methods.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/instance_methods.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestInstanceMethods", 12 | "name": "TestInstanceMethods", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": "~Private~", 22 | "summary": "", 23 | "status": "Private", 24 | "generated": true 25 | }, 26 | "type": "instance", 27 | "signature": "::helper()", 28 | "name": "helper", 29 | "bound": false, 30 | "parameters": [], 31 | "location": { 32 | "line": 3 33 | } 34 | }, 35 | { 36 | "doc": { 37 | "comment": "~Private~", 38 | "summary": "", 39 | "status": "Private", 40 | "generated": true 41 | }, 42 | "type": "instance", 43 | "signature": "::another(param, obj)", 44 | "name": "another", 45 | "bound": false, 46 | "parameters": [ 47 | { 48 | "name": "param", 49 | "splat": false 50 | }, 51 | { 52 | "name": "obj", 53 | "splat": false 54 | } 55 | ], 56 | "location": { 57 | "line": 5 58 | } 59 | }, 60 | { 61 | "doc": { 62 | "comment": "~Private~", 63 | "summary": "", 64 | "status": "Private", 65 | "generated": true 66 | }, 67 | "type": "instance", 68 | "signature": "::anotherWithValues(param = 123, obj = { a: 1 }, yup, comp = new TestInstanceMethods())", 69 | "name": "anotherWithValues", 70 | "bound": false, 71 | "parameters": [ 72 | { 73 | "name": "param", 74 | "default": "123", 75 | "splat": false 76 | }, 77 | { 78 | "name": "obj", 79 | "default": "{\n a: 1\n}", 80 | "splat": false 81 | }, 82 | { 83 | "name": "yup", 84 | "splat": false 85 | }, 86 | { 87 | "name": "comp", 88 | "default": "new TestInstanceMethods()", 89 | "splat": false 90 | } 91 | ], 92 | "location": { 93 | "line": 7 94 | } 95 | }, 96 | { 97 | "doc": { 98 | "comment": "~Private~", 99 | "summary": "", 100 | "status": "Private", 101 | "generated": true 102 | }, 103 | "type": "instance", 104 | "signature": "::nowWithSpalt(foo, bar...)", 105 | "name": "nowWithSpalt", 106 | "bound": false, 107 | "parameters": [ 108 | { 109 | "name": "foo", 110 | "splat": false 111 | }, 112 | { 113 | "name": "bar", 114 | "splat": true 115 | } 116 | ], 117 | "location": { 118 | "line": 9 119 | } 120 | }, 121 | { 122 | "doc": { 123 | "comment": "~Private~", 124 | "summary": "", 125 | "status": "Private", 126 | "generated": true 127 | }, 128 | "type": "instance", 129 | "signature": "::bound()", 130 | "name": "bound", 131 | "bound": true, 132 | "parameters": [], 133 | "location": { 134 | "line": 11 135 | } 136 | } 137 | ], 138 | "variables": [], 139 | "properties": [] 140 | } 141 | ] 142 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/links.coffee: -------------------------------------------------------------------------------- 1 | class App.TestLinks 2 | 3 | # External link short. 4 | # 5 | # http://coffeescript.org/ 6 | # 7 | externalLinkShort: -> 8 | 9 | # External link [long](http://coffeescript.org/). 10 | # 11 | externalLinkLong: -> 12 | 13 | # internalClassLinkShort 14 | # 15 | # {::internalLinkLong} 16 | # 17 | internalLinkShort: -> 18 | 19 | # internalClass [Link Long]{App.TestLinks} 20 | # 21 | internalLinkLong: -> 22 | 23 | # internalInstanceLinkShort {::externalLinkShort} 24 | # 25 | internalInstanceLinkShort: -> 26 | 27 | # internalInstance [Link Long]{::externalLinkLong} 28 | # 29 | internalInstanceLinkLong: -> 30 | 31 | # internalClassLinkShort {.internalClassLinkLong} 32 | # 33 | @internalClassLinkShort: -> 34 | 35 | # internalClass [LinkLong]{.internalClassLinkShort} 36 | # 37 | @internalClassLinkLong: -> 38 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/links.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "App.TestLinks", 12 | "name": "TestLinks", 13 | "namespace": "App" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": " Private: External link short.\n\nhttp://coffeescript.org/\n\n ", 22 | "summary": "External link short.", 23 | "status": "Private" 24 | }, 25 | "type": "instance", 26 | "signature": "::externalLinkShort()", 27 | "name": "externalLinkShort", 28 | "bound": false, 29 | "parameters": [], 30 | "location": { 31 | "line": 7 32 | } 33 | }, 34 | { 35 | "doc": { 36 | "comment": "Private: External link [long](http://coffeescript.org/).\n\n", 37 | "summary": "External link long.", 38 | "status": "Private" 39 | }, 40 | "type": "instance", 41 | "signature": "::externalLinkLong()", 42 | "name": "externalLinkLong", 43 | "bound": false, 44 | "parameters": [], 45 | "location": { 46 | "line": 11 47 | } 48 | }, 49 | { 50 | "doc": { 51 | "comment": " Private: internalClassLinkShort\n\n{::internalLinkLong}\n\n ", 52 | "summary": "internalClassLinkShort {::internalLinkLong}", 53 | "status": "Private" 54 | }, 55 | "type": "instance", 56 | "signature": "::internalLinkShort()", 57 | "name": "internalLinkShort", 58 | "bound": false, 59 | "parameters": [], 60 | "location": { 61 | "line": 17 62 | } 63 | }, 64 | { 65 | "doc": { 66 | "comment": "Private: internalClass [Link Long]{App.TestLinks}\n\n", 67 | "summary": "internalClass [Link Long]{App.TestLinks}", 68 | "status": "Private" 69 | }, 70 | "type": "instance", 71 | "signature": "::internalLinkLong()", 72 | "name": "internalLinkLong", 73 | "bound": false, 74 | "parameters": [], 75 | "location": { 76 | "line": 21 77 | } 78 | }, 79 | { 80 | "doc": { 81 | "comment": "Private: internalInstanceLinkShort {::externalLinkShort}\n\n", 82 | "summary": "internalInstanceLinkShort {::externalLinkShort}", 83 | "status": "Private" 84 | }, 85 | "type": "instance", 86 | "signature": "::internalInstanceLinkShort()", 87 | "name": "internalInstanceLinkShort", 88 | "bound": false, 89 | "parameters": [], 90 | "location": { 91 | "line": 25 92 | } 93 | }, 94 | { 95 | "doc": { 96 | "comment": "Private: internalInstance [Link Long]{::externalLinkLong}\n\n", 97 | "summary": "internalInstance [Link Long]{::externalLinkLong}", 98 | "status": "Private" 99 | }, 100 | "type": "instance", 101 | "signature": "::internalInstanceLinkLong()", 102 | "name": "internalInstanceLinkLong", 103 | "bound": false, 104 | "parameters": [], 105 | "location": { 106 | "line": 29 107 | } 108 | }, 109 | { 110 | "doc": { 111 | "comment": "Private: internalClassLinkShort {.internalClassLinkLong}\n\n", 112 | "summary": "internalClassLinkShort {.internalClassLinkLong}", 113 | "status": "Private" 114 | }, 115 | "type": "class", 116 | "signature": ".internalClassLinkShort()", 117 | "name": "internalClassLinkShort", 118 | "bound": false, 119 | "parameters": [], 120 | "location": { 121 | "line": 33 122 | } 123 | }, 124 | { 125 | "doc": { 126 | "comment": "Private: internalClass [LinkLong]{.internalClassLinkShort}\n\n", 127 | "summary": "internalClass [LinkLong]{.internalClassLinkShort}", 128 | "status": "Private" 129 | }, 130 | "type": "class", 131 | "signature": ".internalClassLinkLong()", 132 | "name": "internalClassLinkLong", 133 | "bound": false, 134 | "parameters": [], 135 | "location": { 136 | "line": 37 137 | } 138 | } 139 | ], 140 | "variables": [], 141 | "properties": [] 142 | } 143 | ] 144 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_delegation.coffee: -------------------------------------------------------------------------------- 1 | class MethodDelegation 2 | 3 | ### Public ### 4 | 5 | # {Delegates to: @delegatedClassRegular} 6 | delegatedClassname: -> 7 | 8 | # Public: I'm being delegated to! 9 | delegatedRegular: -> 10 | 11 | # Public: {Delegates to: .doubleDelegationTwo} 12 | doubleDelegationOne: -> 13 | 14 | # Public: {Delegates to: @doubleDelegationThree} 15 | doubleDelegationTwo: -> 16 | 17 | # At last, we have the same content! 18 | # 19 | # You might also like {.undelegatedRegular}. 20 | # 21 | # Returns a {Number}. 22 | @doubleDelegationThree: -> 23 | 24 | # {Delegates to: App.CurlyMethodDocumentation@lets_do_it} 25 | delegatedInternalRegular: -> 26 | 27 | # Private: Oh hello. 28 | # 29 | # p - A {String} 30 | # 31 | # Returns a {Boolean}. 32 | @delegatedClassRegular: (p) -> 33 | 34 | # {Delegates to: TestExample.run} 35 | @delegatedIrregular: -> 36 | 37 | # Blah 38 | @undelegatedRegular: -> 39 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_delegation_as_private.coffee: -------------------------------------------------------------------------------- 1 | class MethodDelegationFromPrivate 2 | 3 | ### Public ### 4 | 5 | # {Delegates to: PrivateClass.delegatedPrivate} 6 | delegatedFromPrivate: -> 7 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_delegation_as_private.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/method_delegation_as_private.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "MethodDelegationFromPrivate", 12 | "name": "MethodDelegationFromPrivate", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": "Private: Delegated method. ", 22 | "summary": "Delegated method.", 23 | "status": "Public" 24 | }, 25 | "type": "instance", 26 | "signature": "::delegatedFromPrivate()", 27 | "name": "delegatedFromPrivate", 28 | "bound": false, 29 | "parameters": [], 30 | "location": { 31 | "line": 6 32 | } 33 | } 34 | ], 35 | "variables": [], 36 | "properties": [] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_example.coffee: -------------------------------------------------------------------------------- 1 | class TestExample 2 | 3 | # A method to run. 4 | # 5 | # Examples 6 | # 7 | # biscotto = require 'biscotto' 8 | # file = (filename, content) -> 9 | # console.log "New file %s with content %s", filename, content 10 | # done = (err) -> 11 | # if err 12 | # console.log "Cannot generate documentation:", err 13 | # else 14 | # console.log "Documentation generated" 15 | # biscotto.run file, done 16 | run: -> 17 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_example.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/method_example.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestExample", 12 | "name": "TestExample", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "examples": [ 22 | "biscotto = require 'biscotto'\nfile = (filename, content) ->\n console.log \"New file %s with content %s\", filename, content\ndone = (err) ->\n if err\n console.log \"Cannot generate documentation:\", err\n else\n console.log \"Documentation generated\"\nbiscotto.run file, done " 23 | ], 24 | "comment": " Private: A method to run.\n\nExamples\n\n biscotto = require 'biscotto'\n file = (filename, content) ->\n console.log \"New file %s with content %s\", filename, content\n done = (err) ->\n if err\n console.log \"Cannot generate documentation:\", err\n else\n console.log \"Documentation generated\"\n biscotto.run file, done ", 25 | "summary": "A method to run.", 26 | "status": "Private" 27 | }, 28 | "type": "instance", 29 | "signature": "::run()", 30 | "name": "run", 31 | "bound": false, 32 | "parameters": [], 33 | "location": { 34 | "line": 16 35 | } 36 | } 37 | ], 38 | "variables": [], 39 | "properties": [] 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_paragraph_param.coffee: -------------------------------------------------------------------------------- 1 | class ParagraphParm 2 | 3 | # Public: Does stuff 4 | # 5 | # something - Blah blah blah. 6 | # Foo foo foo! 7 | helper: (something) -> 8 | 9 | # Public: Does other stuff 10 | # 11 | # something - Blah blah blah. 12 | # Fah fah fah? 13 | # Foo foo foo! 14 | # something2 - Bar bar bar. 15 | # Cha cha cha!! 16 | # options - The do options 17 | # :speed - The {String} speed 18 | # :repeat - How many {Number} times to repeat 19 | # :tasks - The {Tasks} tasks to do 20 | bound: (something, something2) => 21 | 22 | # Public: Does more other stuff 23 | # 24 | # something - Blah **blah blah**. 25 | # Fah fah fah? 26 | # Foo foo foo! 27 | # something2 - Bar bar bar. 28 | # Cha cha cha!! 29 | # opts - The do options 30 | # :speed - The {String} speed 31 | # :repeat - How many {Number} times to repeat 32 | # :tasks - The {Tasks} tasks to do 33 | bound: (something, something2, opts, opts2) => 34 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_shortdesc.coffee: -------------------------------------------------------------------------------- 1 | class ShortDesc 2 | 3 | # Public: 4 | helper: -> 5 | 6 | bound: => 7 | 8 | # Internal: Should not show up! 9 | internalToClassClosure: -> -------------------------------------------------------------------------------- /spec/parser_templates/methods/method_shortdesc.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/method_shortdesc.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "ShortDesc", 12 | "name": "ShortDesc", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": "Public: ", 22 | "summary": "", 23 | "status": "Public" 24 | }, 25 | "type": "instance", 26 | "signature": "::helper()", 27 | "name": "helper", 28 | "bound": false, 29 | "parameters": [], 30 | "location": { 31 | "line": 4 32 | } 33 | }, 34 | { 35 | "doc": { 36 | "comment": "~Private~", 37 | "summary": "", 38 | "status": "Private", 39 | "generated": true 40 | }, 41 | "type": "instance", 42 | "signature": "::bound()", 43 | "name": "bound", 44 | "bound": true, 45 | "parameters": [], 46 | "location": { 47 | "line": 6 48 | } 49 | } 50 | ], 51 | "variables": [], 52 | "properties": [] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/optional_arguments.coffee: -------------------------------------------------------------------------------- 1 | class OptionalArguments 2 | 3 | # Public: Does something. 4 | # 5 | # obj - An object with the following defaults: 6 | # :option1 - Does some stuff 7 | # :option2 - Does some {Integer} stuff 8 | method1: ({option1, option2}) -> 9 | console.log "wut" 10 | 11 | # Public: Does something else. 12 | # 13 | # obj - An object with the following defaults: 14 | # :option1 - Does some stuff 15 | # :option2 - Does some {Integer} stuff 16 | method2: ({option1, option2}={}) -> 17 | 18 | console.log "Yeah" 19 | 20 | # Public: Does something else. 21 | # 22 | # obj - An object with the following defaults: 23 | # :option1 - Does some stuff 24 | # :option2 - Does some {Integer} stuff 25 | method3: ({option1, option2}={3, 4}) -> 26 | 27 | console.log "Yeah" -------------------------------------------------------------------------------- /spec/parser_templates/methods/optional_arguments.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/optional_arguments.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "OptionalArguments", 12 | "name": "OptionalArguments", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": " Public: Does something.\n\nobj - An object with the following defaults:\n :option1 - Does some stuff\n :option2 - Does some {Integer} stuff ", 22 | "summary": "Does something.", 23 | "status": "Public", 24 | "params": [ 25 | { 26 | "name": "obj", 27 | "desc": "An object with the following defaults:", 28 | "type": "", 29 | "options": [ 30 | { 31 | "name": "option1", 32 | "desc": "Does some stuff", 33 | "type": "" 34 | }, 35 | { 36 | "name": "option2", 37 | "desc": "Does some {Integer} stuff", 38 | "type": "Integer" 39 | } 40 | ] 41 | } 42 | ] 43 | }, 44 | "type": "instance", 45 | "signature": "::method1({option1, option2})", 46 | "name": "method1", 47 | "bound": false, 48 | "parameters": [ 49 | { 50 | "name": "option1", 51 | "splat": false, 52 | "optionized": true 53 | }, 54 | { 55 | "name": "option2", 56 | "splat": false, 57 | "optionized": true 58 | } 59 | ], 60 | "location": { 61 | "line": 8 62 | } 63 | }, 64 | { 65 | "doc": { 66 | "comment": " Public: Does something else.\n\nobj - An object with the following defaults:\n :option1 - Does some stuff\n :option2 - Does some {Integer} stuff ", 67 | "summary": "Does something else.", 68 | "status": "Public", 69 | "params": [ 70 | { 71 | "name": "obj", 72 | "desc": "An object with the following defaults:", 73 | "type": "", 74 | "options": [ 75 | { 76 | "name": "option1", 77 | "desc": "Does some stuff", 78 | "type": "" 79 | }, 80 | { 81 | "name": "option2", 82 | "desc": "Does some {Integer} stuff", 83 | "type": "Integer" 84 | } 85 | ] 86 | } 87 | ] 88 | }, 89 | "type": "instance", 90 | "signature": "::method2({option1, option2}={})", 91 | "name": "method2", 92 | "bound": false, 93 | "parameters": [ 94 | { 95 | "name": "option1", 96 | "splat": false, 97 | "optionized": true 98 | }, 99 | { 100 | "name": "option2", 101 | "splat": false, 102 | "optionized": true 103 | } 104 | ], 105 | "location": { 106 | "line": 16 107 | } 108 | }, 109 | { 110 | "doc": { 111 | "comment": " Public: Does something else.\n\nobj - An object with the following defaults:\n :option1 - Does some stuff\n :option2 - Does some {Integer} stuff ", 112 | "summary": "Does something else.", 113 | "status": "Public", 114 | "params": [ 115 | { 116 | "name": "obj", 117 | "desc": "An object with the following defaults:", 118 | "type": "", 119 | "options": [ 120 | { 121 | "name": "option1", 122 | "desc": "Does some stuff", 123 | "type": "" 124 | }, 125 | { 126 | "name": "option2", 127 | "desc": "Does some {Integer} stuff", 128 | "type": "Integer" 129 | } 130 | ] 131 | } 132 | ] 133 | }, 134 | "type": "instance", 135 | "signature": "::method3({option1, option2}={3,4})", 136 | "name": "method3", 137 | "bound": false, 138 | "parameters": [ 139 | { 140 | "name": "option1", 141 | "default": "3", 142 | "splat": false, 143 | "optionized": true 144 | }, 145 | { 146 | "name": "option2", 147 | "default": "4", 148 | "splat": false, 149 | "optionized": true 150 | } 151 | ], 152 | "location": { 153 | "line": 25 154 | } 155 | } 156 | ], 157 | "variables": [], 158 | "properties": [] 159 | } 160 | ] 161 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/paragraph_desc.coffee: -------------------------------------------------------------------------------- 1 | class TestParagraphs 2 | 3 | # Public: This should be one paragraph. 4 | # 5 | # If soft tabs are enabled, this is a space (`" "`) times the `{::getTabLength}` value. 6 | # Otherwise, it's a tab (`\t`). 7 | spacing: -> 8 | 9 | # Public: This is a paragraph with a br. 10 | # 11 | # Equality is based on some condition. 12 | # Oh look, a BR! 13 | br: -> 14 | 15 | # Public: This is two seperate paragraphs. 16 | # 17 | # Equality is based on some condition. 18 | # 19 | # Here I am, still yapping. 20 | # 21 | # And I'm done. 22 | twoParagraphs: -> 23 | 24 | # Public: Compares two objects to determine equality. 25 | # 26 | # Equality is based on the condition that: 27 | # 28 | # * the two `{Buffer}`s are the same 29 | # * the two `scrollTop` and `scrollLeft` property are the same 30 | # * the two `{Cursor}` screen positions are the same 31 | # 32 | # 33 | ulList: -> 34 | 35 | # Public: Compares two objects to determine equality. 36 | # 37 | # Equality is based on the condition that: 38 | # 39 | # 1. the two `{Buffer}`s are the same 40 | # 2. the two `scrollTop` and `scrollLeft` property are the same 41 | # 3. the two `{Cursor}` screen positions are the same 42 | # 43 | # 44 | olList: -> 45 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/paragraph_desc.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/paragraph_desc.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "TestParagraphs", 12 | "name": "TestParagraphs", 13 | "namespace": "" 14 | }, 15 | "location": { 16 | "line": 1 17 | }, 18 | "methods": [ 19 | { 20 | "doc": { 21 | "comment": " Public: This should be one paragraph.\n\nIf soft tabs are enabled, this is a space (`\" \"`) times the `{::getTabLength}` value.\nOtherwise, it's a tab (`\\t`). ", 22 | "summary": "This should be one paragraph.", 23 | "status": "Public" 24 | }, 25 | "type": "instance", 26 | "signature": "::spacing()", 27 | "name": "spacing", 28 | "bound": false, 29 | "parameters": [], 30 | "location": { 31 | "line": 7 32 | } 33 | }, 34 | { 35 | "doc": { 36 | "comment": " Public: This is a paragraph with a br.\n\nEquality is based on some condition. \nOh look, a BR! ", 37 | "summary": "This is a paragraph with a br.", 38 | "status": "Public" 39 | }, 40 | "type": "instance", 41 | "signature": "::br()", 42 | "name": "br", 43 | "bound": false, 44 | "parameters": [], 45 | "location": { 46 | "line": 13 47 | } 48 | }, 49 | { 50 | "doc": { 51 | "comment": " Public: This is two seperate paragraphs.\n\nEquality is based on some condition.\n\nHere I am, still yapping.\n\nAnd I'm done. ", 52 | "summary": "This is two seperate paragraphs.", 53 | "status": "Public" 54 | }, 55 | "type": "instance", 56 | "signature": "::twoParagraphs()", 57 | "name": "twoParagraphs", 58 | "bound": false, 59 | "parameters": [], 60 | "location": { 61 | "line": 22 62 | } 63 | }, 64 | { 65 | "doc": { 66 | "comment": " Public: Compares two objects to determine equality.\n\nEquality is based on the condition that:\n\n* the two `{Buffer}`s are the same\n* the two `scrollTop` and `scrollLeft` property are the same\n* the two `{Cursor}` screen positions are the same\n\n\n ", 67 | "summary": "Compares two objects to determine equality.", 68 | "status": "Public" 69 | }, 70 | "type": "instance", 71 | "signature": "::ulList()", 72 | "name": "ulList", 73 | "bound": false, 74 | "parameters": [], 75 | "location": { 76 | "line": 33 77 | } 78 | }, 79 | { 80 | "doc": { 81 | "comment": " Public: Compares two objects to determine equality.\n\nEquality is based on the condition that:\n\n1. the two `{Buffer}`s are the same\n2. the two `scrollTop` and `scrollLeft` property are the same\n3. the two `{Cursor}` screen positions are the same\n\n\n ", 82 | "summary": "Compares two objects to determine equality.", 83 | "status": "Public" 84 | }, 85 | "type": "instance", 86 | "signature": "::olList()", 87 | "name": "olList", 88 | "bound": false, 89 | "parameters": [], 90 | "location": { 91 | "line": 44 92 | } 93 | } 94 | ], 95 | "variables": [], 96 | "properties": [] 97 | } 98 | ] 99 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/preprocessor_flagging.coffee: -------------------------------------------------------------------------------- 1 | # Testing block statuses. 2 | class TestBlockStatus 3 | 4 | # Public: Blah blah! 5 | help: (@me) -> 6 | 7 | # Public: Blah blah test! 8 | test: -> 9 | 10 | ### Internal ### 11 | 12 | # Testing with words 13 | internal1: -> 14 | 15 | # Public: Tricksy words! 16 | internal2: -> 17 | 18 | # Internal: WORDS. 19 | internal3: -> 20 | 21 | # WORDS 4. 22 | internal4: -> 23 | 24 | internal5: -> 25 | 26 | @internal6: -> 27 | 28 | ### Public ### 29 | 30 | # I'm really documented. 31 | public1: -> 32 | 33 | # Internal: WORDS 6! 34 | internal7: -> 35 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/preprocessor_flagging.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/preprocessor_flagging.coffee", 4 | "doc": { 5 | "comment": "Private: Testing block statuses. ", 6 | "summary": "Testing block statuses.", 7 | "status": "Private" 8 | }, 9 | "class": { 10 | "className": "TestBlockStatus", 11 | "name": "TestBlockStatus", 12 | "namespace": "" 13 | }, 14 | "location": { 15 | "line": 2 16 | }, 17 | "methods": [ 18 | { 19 | "doc": { 20 | "comment": "Public: Blah blah! ", 21 | "summary": "Blah blah!", 22 | "status": "Public" 23 | }, 24 | "type": "instance", 25 | "signature": "::help(me)", 26 | "name": "help", 27 | "bound": false, 28 | "parameters": [ 29 | { 30 | "name": "me", 31 | "splat": false 32 | } 33 | ], 34 | "location": { 35 | "line": 5 36 | } 37 | }, 38 | { 39 | "doc": { 40 | "comment": "Public: Blah blah test! ", 41 | "summary": "Blah blah test!", 42 | "status": "Public" 43 | }, 44 | "type": "instance", 45 | "signature": "::test()", 46 | "name": "test", 47 | "bound": false, 48 | "parameters": [], 49 | "location": { 50 | "line": 8 51 | } 52 | }, 53 | { 54 | "doc": { 55 | "comment": "Public: Tricksy words! ", 56 | "summary": "Tricksy words!", 57 | "status": "Public" 58 | }, 59 | "type": "instance", 60 | "signature": "::internal2()", 61 | "name": "internal2", 62 | "bound": false, 63 | "parameters": [], 64 | "location": { 65 | "line": 16 66 | } 67 | }, 68 | { 69 | "doc": { 70 | "comment": "Public: I'm really documented. ", 71 | "summary": "I'm really documented.", 72 | "status": "Public" 73 | }, 74 | "type": "instance", 75 | "signature": "::public1()", 76 | "name": "public1", 77 | "bound": false, 78 | "parameters": [], 79 | "location": { 80 | "line": 31 81 | } 82 | } 83 | ], 84 | "variables": [], 85 | "properties": [] 86 | } 87 | ] 88 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/prototypical_methods.coffee: -------------------------------------------------------------------------------- 1 | # Public: Here's a class. 2 | class Foo 3 | # Here's a method, baz. 4 | baz: () -> 'baz' 5 | 6 | # Public: Here is a method on Foo, called bar. 7 | Foo::bar = () -> 'bar' 8 | 9 | # Public: Show that other prototypes are safe 10 | Bing::bang = () -> 'koof' 11 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/prototypical_methods.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "prototypical_methods.coffee", 4 | "path": "spec/parser_templates/methods", 5 | "methods": [ 6 | { 7 | "doc": { 8 | "comment": "Public: Show that other prototypes are safe ", 9 | "summary": "Show that other prototypes are safe", 10 | "status": "Public" 11 | }, 12 | "type": "file", 13 | "signature": "? Bing.prototype.bang()", 14 | "name": "Bing.prototype.bang", 15 | "bound": false, 16 | "parameters": [], 17 | "location": { 18 | "line": 10 19 | } 20 | } 21 | ], 22 | "variables": [] 23 | }, 24 | { 25 | "file": "spec/parser_templates/methods/prototypical_methods.coffee", 26 | "doc": { 27 | "comment": "Public: Here's a class. ", 28 | "summary": "Here's a class.", 29 | "status": "Public" 30 | }, 31 | "class": { 32 | "className": "Foo", 33 | "name": "Foo", 34 | "namespace": "" 35 | }, 36 | "location": { 37 | "line": 2 38 | }, 39 | "methods": [ 40 | { 41 | "doc": { 42 | "comment": "Private: Here's a method, baz. ", 43 | "summary": "Here's a method, baz.", 44 | "status": "Private" 45 | }, 46 | "type": "instance", 47 | "signature": "::baz()", 48 | "name": "baz", 49 | "bound": false, 50 | "parameters": [], 51 | "location": { 52 | "line": 4 53 | } 54 | }, 55 | { 56 | "doc": { 57 | "comment": "Public: Here is a method on Foo, called bar. ", 58 | "summary": "Here is a method on Foo, called bar.", 59 | "status": "Public" 60 | }, 61 | "type": "instance", 62 | "signature": "::bar()", 63 | "name": "bar", 64 | "bound": false, 65 | "parameters": [], 66 | "location": { 67 | "line": 7 68 | }, 69 | "original_filename": "spec/parser_templates/methods/prototypical_methods.coffee" 70 | } 71 | ], 72 | "variables": [], 73 | "properties": [] 74 | } 75 | ] 76 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/return_values.coffee: -------------------------------------------------------------------------------- 1 | class App.ReturnValsDocumentation extends App.Doc 2 | 3 | # Private: Do it! 4 | # 5 | # See #undo for more information. 6 | # 7 | # Returns {Boolean} when it works. 8 | # 9 | returnSingleType: -> 10 | 11 | 12 | # Public: Blahblah. 13 | # 14 | # Returns no type. 15 | # 16 | returnNoType: -> 17 | 18 | # Public: Blahblah. 19 | # 20 | # Returns a {String}. 21 | # Returns also a {Number}. 22 | returnTwoReturns: -> -------------------------------------------------------------------------------- /spec/parser_templates/methods/return_values.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/return_values.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "App.ReturnValsDocumentation", 12 | "name": "ReturnValsDocumentation", 13 | "namespace": "App", 14 | "parent": "App.Doc" 15 | }, 16 | "location": { 17 | "line": 1 18 | }, 19 | "methods": [ 20 | { 21 | "doc": { 22 | "comment": " Private: Do it!\n\nSee #undo for more information.\n\nReturns {Boolean} when it works.\n\n ", 23 | "summary": "Do it! See #undo for more information.", 24 | "status": "Private", 25 | "returnValue": [ 26 | { 27 | "type": "Boolean", 28 | "desc": "Returns {Boolean} when it works." 29 | } 30 | ] 31 | }, 32 | "type": "instance", 33 | "signature": "Boolean ::returnSingleType()", 34 | "name": "returnSingleType", 35 | "bound": false, 36 | "parameters": [], 37 | "location": { 38 | "line": 9 39 | } 40 | }, 41 | { 42 | "doc": { 43 | "comment": " Public: Blahblah.\n\nReturns no type.\n\n ", 44 | "summary": "Blahblah.", 45 | "status": "Public", 46 | "returnValue": [ 47 | { 48 | "type": "", 49 | "desc": "Returns no type." 50 | } 51 | ] 52 | }, 53 | "type": "instance", 54 | "signature": "::returnNoType()", 55 | "name": "returnNoType", 56 | "bound": false, 57 | "parameters": [], 58 | "location": { 59 | "line": 16 60 | } 61 | }, 62 | { 63 | "doc": { 64 | "comment": " Public: Blahblah.\n\nReturns a {String}.\nReturns also a {Number}. ", 65 | "summary": "Blahblah.", 66 | "status": "Public", 67 | "returnValue": [ 68 | { 69 | "type": "String", 70 | "desc": "Returns a {String}." 71 | }, 72 | { 73 | "type": "Number", 74 | "desc": "Returns also a {Number}." 75 | } 76 | ] 77 | }, 78 | "type": "instance", 79 | "signature": "String|Number ::returnTwoReturns()", 80 | "name": "returnTwoReturns", 81 | "bound": false, 82 | "parameters": [], 83 | "location": { 84 | "line": 22 85 | } 86 | } 87 | ], 88 | "variables": [], 89 | "properties": [] 90 | } 91 | ] 92 | -------------------------------------------------------------------------------- /spec/parser_templates/methods/return_values_long.coffee: -------------------------------------------------------------------------------- 1 | class App.ReturnValuesLongDocumentation extends App.Doc 2 | 3 | # Public: Compares two `Point`s. 4 | # 5 | # other - The {Point} to compare against 6 | # 7 | # Returns a {Number} matching the following rules: 8 | # * If the first `row` is greater than `other.row`, returns `1`. 9 | # * If the first `row` is less than `other.row`, returns `-1`. 10 | # * If the first `column` is greater than `other.column`, returns `1`. 11 | # * If the first `column` is less than `other.column`, returns `-1`. 12 | # 13 | # Otherwise, returns `0`. 14 | compare: (other) -> -------------------------------------------------------------------------------- /spec/parser_templates/methods/return_values_long.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "spec/parser_templates/methods/return_values_long.coffee", 4 | "doc": { 5 | "comment": "~Private~", 6 | "summary": "", 7 | "status": "Private", 8 | "generated": true 9 | }, 10 | "class": { 11 | "className": "App.ReturnValuesLongDocumentation", 12 | "name": "ReturnValuesLongDocumentation", 13 | "namespace": "App", 14 | "parent": "App.Doc" 15 | }, 16 | "location": { 17 | "line": 1 18 | }, 19 | "methods": [ 20 | { 21 | "doc": { 22 | "comment": " Public: Compares two `Point`s.\n\nother - The {Point} to compare against\n\nReturns a {Number} matching the following rules:\n* If the first `row` is greater than `other.row`, returns `1`.\n* If the first `row` is less than `other.row`, returns `-1`.\n* If the first `column` is greater than `other.column`, returns `1`.\n* If the first `column` is less than `other.column`, returns `-1`.\n\nOtherwise, returns `0`. ", 23 | "summary": "Compares two Points.", 24 | "status": "Public", 25 | "params": [ 26 | { 27 | "name": "other", 28 | "desc": "The {Point} to compare against", 29 | "type": "Point" 30 | } 31 | ], 32 | "returnValue": [ 33 | { 34 | "type": "Number", 35 | "desc": "Returns a {Number} matching the following rules:\n* If the first `row` is greater than `other.row`, returns `1`.\n* If the first `row` is less than `other.row`, returns `-1`.\n* If the first `column` is greater than `other.column`, returns `1`.\n* If the first `column` is less than `other.column`, returns `-1`." 36 | } 37 | ] 38 | }, 39 | "type": "instance", 40 | "signature": "Number ::compare(other)", 41 | "name": "compare", 42 | "bound": false, 43 | "parameters": [ 44 | { 45 | "name": "other", 46 | "splat": false 47 | } 48 | ], 49 | "location": { 50 | "line": 14 51 | } 52 | } 53 | ], 54 | "variables": [], 55 | "properties": [] 56 | } 57 | ] 58 | -------------------------------------------------------------------------------- /src/nodes/file.coffee: -------------------------------------------------------------------------------- 1 | Path = require 'path' 2 | Class = require './class' 3 | Method = require './method' 4 | Variable = require './variable' 5 | Doc = require './doc' 6 | 7 | # Public: The file class is a `fake` class that wraps the 8 | # file body to capture top-level assigned methods. 9 | # 10 | module.exports = class File extends Class 11 | 12 | # Public: Construct a `File` object. 13 | # 14 | # node - The class node (a {Object}) 15 | # filename - A {String} representing the current filename 16 | # lineMapping - An object mapping the actual position of a member to its Biscotto one 17 | # options - Any additional parser options 18 | constructor: (@node, @fileName, @lineMapping, @options) -> 19 | try 20 | @methods = [] 21 | @variables = [] 22 | 23 | previousExp = null 24 | 25 | for exp in @node.expressions 26 | switch exp.constructor.name 27 | 28 | when 'Assign' 29 | doc = previousExp if previousExp?.constructor.name is 'Comment' 30 | 31 | switch exp.value?.constructor.name 32 | when 'Code' 33 | @methods.push(new Method(@, exp, @lineMapping, @options, doc)) 34 | when 'Value' 35 | if exp.value.base.value 36 | @variables.push new Variable(@, exp, @lineMapping, @options, true, doc) 37 | 38 | doc = null 39 | 40 | when 'Value' 41 | previousProp = null 42 | 43 | for prop in exp.base.properties 44 | doc = previousProp if previousProp?.constructor.name is 'Comment' 45 | 46 | if prop.value?.constructor.name is 'Code' 47 | @methods.push new Method(@, prop, @lineMapping, @options, doc) 48 | 49 | doc = null 50 | previousProp = prop 51 | previousExp = exp 52 | 53 | catch error 54 | console.warn('File class error:', @node, error) if @options.verbose 55 | 56 | 57 | # Public: Get the full file name with path 58 | # 59 | # Returns the file name with path as a {String}. 60 | getFullName: -> 61 | fullName = @fileName 62 | 63 | for input in @options.inputs 64 | input = input.replace(///^\.[\/]///, '') # Clean leading `./` 65 | input = input + Path.sep unless ///#{ Path.sep }$///.test input # Append trailing `/` 66 | input = input.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") # Escape String 67 | fullName = fullName.replace(new RegExp(input), '') 68 | 69 | fullName.replace(Path.sep, '/') 70 | 71 | # Public: Returns the file class name. 72 | # 73 | # Returns the file name without path as a {String}. 74 | getFileName: -> 75 | Path.basename @getFullName() 76 | 77 | # Public: Get the file path 78 | # 79 | # Returns the file path as a {String}. 80 | getPath: -> 81 | path = Path.dirname @getFullName() 82 | path = '' if path is '.' 83 | path 84 | 85 | # Public: Test if the file doesn't contain any top-level public methods. 86 | # 87 | # Returns `true` if empty. 88 | isEmpty: -> 89 | @getMethods().every (method) -> not /^public$/i.test(method.doc.status) 90 | 91 | # Public: Get a JSON representation of the object 92 | # 93 | # Returns the JSON object (a {Object}). 94 | toJSON: -> 95 | json = 96 | file: @getFileName() 97 | path: @getPath() 98 | methods: [] 99 | variables: [] 100 | 101 | for method in @getMethods() 102 | json.methods.push method.toJSON() 103 | 104 | for variable in @getVariables() 105 | json.variables.push variable.toJSON() 106 | 107 | json 108 | -------------------------------------------------------------------------------- /src/nodes/mixin.coffee: -------------------------------------------------------------------------------- 1 | Node = require './node' 2 | Method = require './method' 3 | Variable = require './variable' 4 | Doc = require './doc' 5 | 6 | # Public: The Node representation of a CoffeeScript mixins 7 | # 8 | module.exports = class Mixin extends Node 9 | 10 | # Public: Construct a mixin 11 | # 12 | # node - The mixin node (a {Object}) 13 | # fileName - The filename (a {String}) 14 | # options - The parser options (a {Object}) 15 | # comment - The comment node (a {Object}) 16 | constructor: (@node, @fileName, @options, comment) -> 17 | try 18 | @methods = [] 19 | @variables = [] 20 | 21 | @doc = new Doc(comment, @options) 22 | 23 | previousExp = null 24 | 25 | for exp in @node.value.base.properties 26 | 27 | # Recognize assigned code on the mixin 28 | if exp.constructor.name is 'Assign' 29 | doc = previousExp if previousExp?.constructor.name is 'Comment' 30 | 31 | if exp.value?.constructor.name is 'Code' 32 | @methods.push new Method(@, exp, @options, doc) 33 | 34 | # Recognize concerns as inner mixins 35 | if exp.value?.constructor.name is 'Value' 36 | switch exp.variable.base.value 37 | when 'ClassMethods' 38 | @classMixin = new Mixin(exp, @filename, @options, doc) 39 | 40 | when 'InstanceMethods' 41 | @instanceMixin = new Mixin(exp, @filename, options, doc) 42 | 43 | doc = null 44 | previousExp = exp 45 | 46 | if @classMixin? && @instanceMixin? 47 | @concern = true 48 | 49 | for method in @classMixin.getMethods() 50 | method.type = 'class' 51 | @methods.push method 52 | 53 | for method in @instanceMixin.getMethods() 54 | method.type = 'instance' 55 | @methods.push method 56 | else 57 | @concern = false 58 | 59 | catch error 60 | console.warn('Create mixin error:', @node, error) if @options.verbose 61 | 62 | # Public: Get the source file name. 63 | # 64 | # Returns the filename of the mixin (a {String}). 65 | getFileName: -> @fileName 66 | 67 | # Public: Get the mixin doc 68 | # 69 | # Returns the mixin doc (a [Doc]) 70 | getDoc: -> @doc 71 | 72 | # Public: Get the full mixin name 73 | # 74 | # Returns full mixin name (a {String}). 75 | getMixinName: -> 76 | try 77 | unless @mixinName 78 | name = [] 79 | name = [@node.variable.base.value] unless @node.variable.base.value == 'this' 80 | name.push p.name.value for p in @node.variable.properties 81 | @mixinName = name.join('.') 82 | 83 | @mixinName 84 | 85 | catch error 86 | console.warn('Get mixin full name error:', @node, error) if @options.verbose 87 | 88 | # Public: Alias for {::getMixinName} 89 | getFullName: -> 90 | @getMixinName() 91 | 92 | # Public: Gets the mixin name 93 | # 94 | # Returns the name (a {String}). 95 | getName: -> 96 | try 97 | unless @name 98 | @name = @getMixinName().split('.').pop() 99 | 100 | @name 101 | 102 | catch error 103 | console.warn('Get mixin name error:', @node, error) if @options.verbose 104 | 105 | # Public: Get the mixin namespace 106 | # 107 | # Returns the namespace (a {String}). 108 | getNamespace: -> 109 | try 110 | unless @namespace 111 | @namespace = @getMixinName().split('.') 112 | @namespace.pop() 113 | 114 | @namespace = @namespace.join('.') 115 | 116 | @namespace 117 | 118 | catch error 119 | console.warn('Get mixin namespace error:', @node, error) if @options.verbose 120 | 121 | # Public: Get all methods. 122 | # 123 | # Returns an {Array} of all the {Method}s. 124 | getMethods: -> @methods 125 | 126 | # Get all variables. 127 | # 128 | # Returns an {Array} of all the {Variable}s. 129 | getVariables: -> @variables 130 | 131 | # Public: Get a JSON representation of the object 132 | # 133 | # Returns the JSON object (a {Object}). 134 | toJSON: -> 135 | json = 136 | file: @getFileName() 137 | doc: @getDoc().toJSON() 138 | mixin: 139 | mixinName: @getMixinName() 140 | name: @getName() 141 | namespace: @getNamespace() 142 | concern: @concern 143 | methods: [] 144 | variables: [] 145 | 146 | for method in @getMethods() 147 | json.methods.push method.toJSON() 148 | 149 | for variable in @getVariables() 150 | json.variables.push variable.toJSON() 151 | 152 | json 153 | -------------------------------------------------------------------------------- /src/nodes/node.coffee: -------------------------------------------------------------------------------- 1 | # Public: The base class for all nodes. 2 | # 3 | module.exports = class Node 4 | 5 | # Public: Find an ancestor node by type. 6 | # 7 | # type - The type name (a {String}) 8 | # node - The CoffeeScript node to search on (a {Base}) 9 | findAncestor: (type, node = @node) -> 10 | if node.ancestor 11 | if node.ancestor.constructor.name is type 12 | node.ancestor 13 | else 14 | @findAncestor type, node.ancestor 15 | 16 | else 17 | undefined 18 | -------------------------------------------------------------------------------- /src/nodes/parameter.coffee: -------------------------------------------------------------------------------- 1 | Node = require './node' 2 | 3 | _ = require 'underscore' 4 | _.str = require 'underscore.string' 5 | 6 | # Public: The Node representation of a CoffeeScript method parameter. 7 | module.exports = class Parameter extends Node 8 | 9 | # Public: Construct a parameter node. 10 | # 11 | # node - The node (a {Object}) 12 | # options - The parser options (a {Object}) 13 | # optionized - A {Boolean} indicating if the parameter is a set of options 14 | constructor: (@node, @options, @optionized) -> 15 | 16 | # Public: Get the full parameter signature. 17 | # 18 | # Returns the signature (a {String}). 19 | getSignature: -> 20 | try 21 | unless @signature 22 | @signature = @getName() 23 | 24 | if @isSplat() 25 | @signature += '...' 26 | 27 | value = @getDefault() 28 | @signature += " = #{ value.replace(/\n\s*/g, ' ') }" if value 29 | 30 | @signature 31 | 32 | catch error 33 | console.warn('Get parameter signature error:', @node, error) if @options.verbose 34 | 35 | # Public: Get the parameter name 36 | # 37 | # Returns the name (a {String}). 38 | getName: (i = -1) -> 39 | try 40 | # params like `method: ({option1, option2}) ->` 41 | if @optionized && i >= 0 42 | @name = @node.name.properties[i].base.value 43 | 44 | unless @name 45 | 46 | # Normal attribute `do: (it) ->` 47 | @name = @node.name.value 48 | 49 | unless @name 50 | if @node.name.properties 51 | # Assigned attributes `do: (@it) ->` 52 | @name = @node.name.properties[0]?.name?.value 53 | 54 | @name 55 | 56 | catch error 57 | console.warn('Get parameter name error:', @node, error) if @options.verbose 58 | 59 | # Public: Get the parameter default value 60 | # 61 | # Returns the default (a {String}). 62 | getDefault: (i = -1) -> 63 | try 64 | # for optionized arguments 65 | if @optionized && i >= 0 66 | _.str.strip(@node.value?.compile({ indent: '' })[1..-2].split(",")[i]).split(": ")[1] 67 | else 68 | @node.value?.compile({ indent: '' }) 69 | 70 | catch error 71 | if @node?.value?.base?.value is 'this' 72 | "@#{ @node.value.properties[0]?.name.compile({ indent: '' }) }" 73 | else 74 | console.warn('Get parameter default error:', @node, error) if @options.verbose 75 | 76 | # Public: Gets the defaults of the optionized parameters. 77 | # 78 | # Returns the defaults as a {String}. 79 | getOptionizedDefaults: -> 80 | return '' unless @node.value? 81 | 82 | defaults = [] 83 | for k in @node.value.compile({ indent: '' }).split("\n")[1..-2] 84 | defaults.push _.str.strip(k.split(":")[0]) 85 | 86 | return "{" + defaults.join(",") + "}" 87 | 88 | # Public: Checks if the parameters is a splat 89 | # 90 | # Returns `true` if a splat (a {Boolean}). 91 | isSplat: -> 92 | try 93 | @node.splat is true 94 | 95 | catch error 96 | console.warn('Get parameter splat type error:', @node, error) if @options.verbose 97 | 98 | # Public: Get a JSON representation of the object 99 | # 100 | # Returns the JSON object (a {Object}). 101 | toJSON: (i = -1) -> 102 | json = 103 | name: @getName(i) 104 | default: @getDefault(i) 105 | splat: @isSplat() 106 | optionized: @optionized 107 | 108 | json 109 | -------------------------------------------------------------------------------- /src/nodes/property.coffee: -------------------------------------------------------------------------------- 1 | Node = require './node' 2 | Doc = require './doc' 3 | 4 | _ = require 'underscore' 5 | _.str = require 'underscore.string' 6 | 7 | # Public: A class property that is defined by custom property set/get methods. 8 | # 9 | # Examples 10 | # 11 | # class Test 12 | # 13 | # get = (props) => @::__defineGetter__ name, getter for name, getter of props 14 | # set = (props) => @::__defineSetter__ name, setter for name, setter of props 15 | # 16 | # get name: -> @name 17 | # set name: (@name) -> 18 | # 19 | module.exports = class Property extends Node 20 | 21 | # Public: Construct a new property node. 22 | # 23 | # entity - The property's {Class} 24 | # node - The property node (a {Object}) 25 | # lineMapping - An object mapping the actual position of a member to its Biscotto one 26 | # options - The parser options (a {Object}) 27 | # name - The filename (a {String}) 28 | # comment - The comment node (a {Object}) 29 | constructor: (@entity, @node, @lineMapping, @options, @name, comment) -> 30 | @doc = new Doc(comment, @options) 31 | 32 | @setter = false 33 | @getter = false 34 | 35 | # Public: Get the source line number 36 | # 37 | # Returns a {Number}. 38 | getLocation: -> 39 | try 40 | unless @location 41 | {locationData} = @node.variable 42 | firstLine = locationData.first_line 43 | @location = { line: firstLine - @lineMapping[firstLine] + 1 } 44 | 45 | @location 46 | 47 | catch error 48 | console.warn("Get location error at #{@fileName}:", @node, error) if @options.verbose 49 | 50 | # Public: Get the property signature. 51 | # 52 | # Returns the signature (a {String}) 53 | getSignature: -> 54 | try 55 | unless @signature 56 | @signature = '' 57 | 58 | if @doc 59 | @signature += if @doc.property then "(#{ _.str.escapeHTML @doc.property }) " else "(?) " 60 | 61 | @signature += "#{ @name }" 62 | 63 | @signature 64 | 65 | catch error 66 | console.warn('Get property signature error:', @node, error) if @options.verbose 67 | 68 | # Public: Get a JSON representation of the object 69 | # 70 | # Returns the JSON object (a {Object}) 71 | toJSON: -> 72 | { 73 | name: @name 74 | signature: @getSignature() 75 | location: @getLocation() 76 | setter: @setter 77 | getter: @getter 78 | doc: @doc 79 | } 80 | -------------------------------------------------------------------------------- /src/nodes/variable.coffee: -------------------------------------------------------------------------------- 1 | Node = require './node' 2 | Doc = require './doc' 3 | 4 | # Public: The Node representation of a CoffeeScript variable. 5 | module.exports = class Variable extends Node 6 | 7 | # Public: Construct a variable node. 8 | # 9 | # entity - The variable's {Class} 10 | # node - The variable node (a {Object}) 11 | # lineMapping - An object mapping the actual position of a member to its Biscotto one 12 | # options - The parser options (a {Object}) 13 | # classType - A {Boolean} indicating if the class is a `class` or an `instance` 14 | # comment - The comment node (a {Object}) 15 | constructor: (@entity, @node, @lineMapping, @options, @classType = false, comment = null) -> 16 | try 17 | @doc = new Doc(comment, @options) 18 | @getName() 19 | 20 | catch error 21 | console.warn('Create variable error:', @node, error) if @options.verbose 22 | 23 | # Public: Get the variable type, either `class` or `constant` 24 | # 25 | # Returns the variable type (a {String}). 26 | getType: -> 27 | unless @type 28 | @type = if @classType then 'class' else 'instance' 29 | 30 | @type 31 | 32 | # Public: Test if the given value should be treated ad constant. 33 | # 34 | # Returns true if a constant (a {Boolean}) 35 | # 36 | isConstant: -> 37 | unless @constant 38 | @constant = /^[A-Z_-]*$/.test @getName() 39 | 40 | @constant 41 | 42 | # Public: Get the class doc 43 | # 44 | # Returns the class doc (a [Doc]). 45 | getDoc: -> @doc 46 | 47 | # Public: Get the variable name 48 | # 49 | # Returns the variable name (a {String}). 50 | getName: -> 51 | try 52 | unless @name 53 | @name = @node.variable.base.value 54 | 55 | for prop in @node.variable.properties 56 | @name += ".#{ prop.name.value }" 57 | 58 | if /^this\./.test @name 59 | @name = @name.substring(5) 60 | @type = 'class' 61 | 62 | @name 63 | 64 | catch error 65 | console.warn('Get method name error:', @node, error) if @options.verbose 66 | 67 | 68 | # Public: Get the source line number 69 | # 70 | # Returns a {Number}. 71 | getLocation: -> 72 | try 73 | unless @location 74 | {locationData} = @node.variable 75 | firstLine = locationData.first_line + 1 76 | if !@lineMapping[firstLine]? 77 | @lineMapping[firstLine] = @lineMapping[firstLine - 1] 78 | 79 | @location = { line: @lineMapping[firstLine] } 80 | 81 | @location 82 | 83 | catch error 84 | console.warn("Get location error at #{@fileName}:", @node, error) if @options.verbose 85 | 86 | # Public: Get the variable value. 87 | # 88 | # Returns the value (a {String}). 89 | getValue: -> 90 | try 91 | unless @value 92 | @value = @node.value.base.compile({ indent: '' }) 93 | 94 | @value 95 | 96 | catch error 97 | console.warn('Get method value error:', @node, error) if @options.verbose 98 | 99 | # Public: Get a JSON representation of the object 100 | # 101 | # Returns the JSON object (a {Object}). 102 | toJSON: -> 103 | json = 104 | doc: @doc 105 | type: @getType() 106 | constant: @isConstant() 107 | name: @getName() 108 | value: @getValue() 109 | location: @getLocation() 110 | 111 | json 112 | -------------------------------------------------------------------------------- /src/nodes/virtual_method.coffee: -------------------------------------------------------------------------------- 1 | Node = require './node' 2 | Parameter = require './parameter' 3 | Doc = require './doc' 4 | 5 | _ = require 'underscore' 6 | _.str = require 'underscore.string' 7 | 8 | # Public: The Node representation of a CoffeeScript virtual method that has 9 | # been declared by the `@method` tag. 10 | module.exports = class VirtualMethod extends Node 11 | 12 | # Public: Construct a virtual method node. 13 | # 14 | # entity - The method's {Class} 15 | # doc - The property node (a {Object}) 16 | # options - The parser options (a {Object}) 17 | constructor: (@entity, @doc, @options) -> 18 | 19 | # Public: Get the method type, either `class`, `instance` or `mixin`. 20 | # 21 | # Returns the method type (a {String}). 22 | getType: -> 23 | unless @type 24 | if @doc.signature.substring(0, 1) is '.' 25 | @type = 'instance' 26 | else if @doc.signature.substring(0, 1) is '@' 27 | @type = 'class' 28 | else 29 | @type = 'mixin' 30 | 31 | @type 32 | 33 | # Public: Get the class doc 34 | # 35 | # Returns the class doc (a {Doc}). 36 | getDoc: -> @doc 37 | 38 | # Public: Get the full method signature. 39 | # 40 | # Returns the signature (a {String}). 41 | getSignature: -> 42 | try 43 | unless @signature 44 | @signature = switch @getType() 45 | when 'class' 46 | '+ ' 47 | when 'instance' 48 | '- ' 49 | else 50 | '? ' 51 | 52 | if @getDoc() 53 | @signature += if @getDoc().returnValue then "(#{ _.str.escapeHTML @getDoc().returnValue.type }) " else "(void) " 54 | 55 | @signature += "#{ @getName() }" 56 | @signature += '(' 57 | 58 | params = [] 59 | 60 | for param in @getParameters() 61 | params.push param.name 62 | 63 | @signature += params.join(', ') 64 | @signature += ')' 65 | 66 | @signature 67 | 68 | catch error 69 | console.warn('Get method signature error:', @node, error) if @options.verbose 70 | 71 | # Public: Get the short method signature. 72 | # 73 | # Returns the short signature (a {String}). 74 | getShortSignature: -> 75 | try 76 | unless @shortSignature 77 | @shortSignature = switch @getType() 78 | when 'class' 79 | '@' 80 | when 'instance' 81 | '.' 82 | else 83 | '' 84 | @shortSignature += @getName() 85 | 86 | @shortSignature 87 | 88 | catch error 89 | console.warn('Get method short signature error:', @node, error) if @options.verbose 90 | 91 | # Public: Get the method name 92 | # 93 | # Returns the method name (a {String}). 94 | getName: -> 95 | try 96 | unless @name 97 | if name = /[.#]?([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)/i.exec @doc.signature 98 | @name = name[1] 99 | else 100 | @name = 'unknown' 101 | 102 | @name 103 | 104 | catch error 105 | console.warn('Get method name error:', @node, error) if @options.verbose 106 | 107 | # Public: Get the method parameters 108 | # 109 | # params - The method parameters 110 | getParameters: -> @doc.params or [] 111 | 112 | # Public: Get the method source in CoffeeScript 113 | # 114 | # Returns the CoffeeScript source (a {String}). 115 | getCoffeeScriptSource: -> 116 | 117 | # Public: Get the method source in JavaScript 118 | # 119 | # Returns the JavaScript source (a {String}). 120 | getJavaScriptSource: -> 121 | 122 | # Public: Get a JSON representation of the object 123 | # 124 | # Returns the JSON object (a {Object}). 125 | toJSON: -> 126 | json = 127 | doc: @doc 128 | type: @getType() 129 | signature: @getSignature() 130 | name: @getName() 131 | bound: false 132 | parameters: [] 133 | 134 | json 135 | -------------------------------------------------------------------------------- /src/util/markdown.coffee: -------------------------------------------------------------------------------- 1 | marked = require 'marked' 2 | 3 | # Internal: A class to post-process the best available output from the marked 4 | # library to conform to GHM. In addition the allowed tags can be limited. 5 | module.exports = class Markdown 6 | 7 | # Tags to keep when parsing is limited 8 | @limitedTags: 'a,abbr,acronym,b,big,cite,code,del,em,i,ins,sub,sup,span,small,strike,strong,q,tt,u' 9 | 10 | # Convert markdown to Html. If the param `limit` 11 | # is true, then all unwanted elements are stripped from the 12 | # result and also all existing newlines. 13 | # 14 | # markdown - the markdown markup (a {String}) 15 | # limit - if elements should be limited (a {Boolean}) 16 | # 17 | @convert: (markdown, limit = false, allowed = Markdown.limitedTags) -> 18 | return if markdown is undefined 19 | 20 | html = marked(markdown) 21 | 22 | if limit 23 | html = html.replace(/\n/, '') 24 | html = Markdown.limit(html, allowed) 25 | 26 | # Remove newlines around open and closing paragraph tags 27 | html = html.replace /(?:\n+)?<(\/?p)>(?:\n+)?/mg, '<$1>' 28 | 29 | html 30 | 31 | # Strips all unwanted tag from the html 32 | # 33 | # html - the Html to clean (a {String}) 34 | # allowed - the comma separated list of allowed tags (a {String}) 35 | # Returns the cleaned Html (a {String}) 36 | # 37 | @limit: (html, allowed) -> 38 | allowed = allowed.split ',' 39 | 40 | html.replace /<([a-z]+)>(.+?)<\/\1>/, (match, tag, text) -> 41 | if allowed.indexOf(tag) is -1 then text else match 42 | -------------------------------------------------------------------------------- /src/util/standardObjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "Array" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", 3 | "Boolean" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", 4 | "Date" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", 5 | "Error" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", 6 | "EvalError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", 7 | "RangeError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", 8 | "ReferenceError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", 9 | "SyntaxError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", 10 | "TypeError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", 11 | "URIError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", 12 | "Function" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", 13 | "Infinity" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", 14 | "JSON" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON", 15 | "Math" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", 16 | "NaN" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", 17 | "Number" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", 18 | "Object" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", 19 | "RegExp" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", 20 | "String" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", 21 | "Base": "http://coffeescript.org/documentation/docs/nodes.html#section-7" 22 | } -------------------------------------------------------------------------------- /src/util/templater.coffee: -------------------------------------------------------------------------------- 1 | fs = require 'fs' 2 | path = require 'path' 3 | mkdirp = require 'mkdirp' 4 | _ = require 'underscore' 5 | _.str = require 'underscore.string' 6 | walkdir = require 'walkdir' 7 | hamlc = require 'haml-coffee' 8 | 9 | # Public: Haml Coffee template compiler. 10 | # 11 | module.exports = class Templater 12 | 13 | # Public: Construct the templater. Reads all templates and constructs 14 | # the global template context. 15 | # 16 | # options - The options (a {Object}) 17 | # referencer - The link type referencer (a {Referencer}) 18 | # parser - The biscotto parser (a {Parser}) 19 | constructor: (@options, @referencer, @parser) -> 20 | @JST = [] 21 | 22 | @globalContext = 23 | biscottoVersion: 'v' + JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf-8'))['version'] 24 | generationDate: new Date().toString() 25 | JST: @JST 26 | underscore: _ 27 | str: _.str 28 | referencer: @referencer 29 | fileCount: @parser.files.length 30 | classCount: @parser.classes.length 31 | mixinCount: @parser.mixins.length 32 | methodCount: @parser.getAllMethods().length 33 | extraCount: _.union([@options.readme], @options.extras).length 34 | isVisible: @isVisible 35 | parserClasses: @parser.classes 36 | repo: "#{@options.origin}/blob/#{@options.tag}" 37 | 38 | _.each @options, (value, property) => 39 | @globalContext[property] = value 40 | 41 | for filename in walkdir.sync path.join(__dirname, '..', '..', 'theme', 'default', 'templates') 42 | if match = /theme[/\\]default[/\\]templates[/\\](.+).hamlc$/.exec filename 43 | varname = match[1].replace(/\\/g, "/") 44 | @JST[varname] = hamlc.compile(fs.readFileSync(filename, 'utf-8')) 45 | 46 | # Public: Redirect template generation to a callback. 47 | # 48 | # file - The file callback {Function} 49 | redirect: (file) -> @file = file 50 | 51 | # Public: Render the given template with the context and the 52 | # global context object merged as template data. Writes 53 | # the file as the output filename. 54 | # 55 | # template - The template name (a {String}) 56 | # context - The context object (a {Object}) 57 | # filename - The output file name (a {String}) 58 | render: (template, context = {}, filename = '') -> 59 | html = @JST[template](_.extend(@globalContext, context)) 60 | 61 | unless _.isEmpty filename 62 | 63 | # Callback generated content 64 | if @file 65 | @file(filename, html) 66 | 67 | # Write to file system 68 | else 69 | unless @options.noOutput 70 | file = path.join @options.output, filename 71 | dir = path.dirname(file) 72 | mkdirp dir, (err) => 73 | if err 74 | console.error "[ERROR] Cannot create directory #{ dir }: #{ err }" 75 | else 76 | fs.writeFile file, html 77 | 78 | html 79 | 80 | # Verifies that, given the visibility settings, whether something is rendered 81 | isVisible: (status) => 82 | (status == "Public") || (status == "Private" && @options.private) || (status == "Internal" && @options.internal) 83 | -------------------------------------------------------------------------------- /src/util/text.coffee: -------------------------------------------------------------------------------- 1 | # Public: Global text helpers. 2 | # 3 | module.exports = 4 | 5 | # Public: Whitespace helper function 6 | # 7 | # n - The number of spaces to create (a {Number}) 8 | # 9 | # Returns the space string (a {String}). 10 | whitespace: (n) -> 11 | a = [] 12 | while a.length < n 13 | a.push ' ' 14 | a.join '' 15 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/fuzzy.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var makePattern, surroundMatch; 3 | 4 | window.fuzzy = function(pattern, items, options) { 5 | var addMatch, after, appendMatch, before, doHighlight, flags, hasTextBeforeSeparator, ignorecase, ignorespace, inner, isMatch, item, len, limit, matches, parts, post, postPart, postSep, postSepRegex, pre, prePart, preParts, preSep, preSepRegex, prependMatch, separate, separator, _i, _len; 6 | if (options == null) { 7 | options = {}; 8 | } 9 | pre = options.pre, post = options.post, limit = options.limit, separator = options.separator, ignorecase = options.ignorecase, ignorespace = options.ignorespace, separate = options.separate; 10 | if (ignorecase == null) { 11 | ignorecase = true; 12 | } 13 | if (ignorespace == null) { 14 | ignorespace = true; 15 | } 16 | if (separate == null) { 17 | separate = false; 18 | } 19 | if (separate && !separator) { 20 | throw new Error("You must pass a separator when options.separate is true."); 21 | } 22 | if (ignorespace) { 23 | pattern = pattern.replace(/\s/g, ""); 24 | } 25 | matches = []; 26 | flags = (ignorecase && "i") || ""; 27 | doHighlight = pre && post; 28 | addMatch = function(before, after, method) { 29 | if (separate) { 30 | return matches[method]([before, after]); 31 | } else { 32 | if (before) { 33 | return matches[method](before + separator + after); 34 | } else { 35 | return matches[method](after); 36 | } 37 | } 38 | }; 39 | appendMatch = function(before, after) { 40 | return addMatch(before, after, "push"); 41 | }; 42 | prependMatch = function(before, after) { 43 | return addMatch(before, after, "unshift"); 44 | }; 45 | if (separator) { 46 | preParts = pattern.split(separator); 47 | postPart = preParts.pop(); 48 | prePart = preParts.join(separator); 49 | inner = _.map(preParts, (function(p) { 50 | return makePattern(p); 51 | })); 52 | inner = inner.join(".*?" + separator + ".*?"); 53 | preSepRegex = new RegExp("^.*?" + inner + ".*?$", flags); 54 | } else { 55 | preParts = false; 56 | postPart = pattern; 57 | preSepRegex = false; 58 | } 59 | postSepRegex = new RegExp("^.*?" + (makePattern(postPart)) + ".*$", flags); 60 | for (_i = 0, _len = items.length; _i < _len; _i++) { 61 | item = items[_i]; 62 | if (matches.length === limit) { 63 | break; 64 | } 65 | hasTextBeforeSeparator = separator && !!~item.indexOf(separator); 66 | if (!hasTextBeforeSeparator && item.indexOf(pattern) === 0) { 67 | if (doHighlight) { 68 | len = pattern.length; 69 | prependMatch("", pre + item.slice(0, len) + post + item.slice(len)); 70 | } else { 71 | prependMatch("", item); 72 | } 73 | continue; 74 | } 75 | if (hasTextBeforeSeparator) { 76 | parts = item.split(separator); 77 | preSep = parts.slice(0, -1).join(separator); 78 | postSep = _.last(parts); 79 | } else { 80 | preSep = ""; 81 | postSep = item; 82 | } 83 | isMatch = !preSepRegex || preSepRegex.test(preSep); 84 | isMatch && (isMatch = !postSepRegex || postSepRegex.test(postSep)); 85 | if (!isMatch) { 86 | continue; 87 | } 88 | if (doHighlight) { 89 | after = surroundMatch(postSep, postPart, pre, post, ignorecase); 90 | if (hasTextBeforeSeparator) { 91 | before = surroundMatch(preSep, prePart, pre, post, ignorecase); 92 | appendMatch(before, after); 93 | } else { 94 | appendMatch("", after); 95 | } 96 | } else { 97 | appendMatch(preSep, postSep); 98 | } 99 | } 100 | return matches; 101 | }; 102 | 103 | makePattern = function(pattern) { 104 | var c, chars, regex, _i, _len; 105 | chars = pattern.split(""); 106 | regex = []; 107 | for (_i = 0, _len = chars.length; _i < _len; _i++) { 108 | c = chars[_i]; 109 | c = c === "\\" ? "\\\\" : c; 110 | regex.push("([" + c + "])"); 111 | } 112 | return regex.join("[^/]*?"); 113 | }; 114 | 115 | surroundMatch = function(string, pattern, pre, post, ignorecase) { 116 | var c, done, nextChar, sameChar, _i, _len, _ref; 117 | done = ""; 118 | pattern = pattern.split(""); 119 | nextChar = pattern.shift(); 120 | _ref = string.split(""); 121 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 122 | c = _ref[_i]; 123 | if (nextChar) { 124 | sameChar = false; 125 | if (ignorecase && c.toLowerCase() === nextChar.toLowerCase()) { 126 | sameChar = true; 127 | } else if (!ignorecase && c === nextChar) { 128 | sameChar = true; 129 | } 130 | if (sameChar) { 131 | done += "" + pre + c + post; 132 | nextChar = pattern.shift(); 133 | continue; 134 | } 135 | } 136 | done += c; 137 | } 138 | return done; 139 | }; 140 | 141 | }).call(this); 142 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/bash.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Bash 3 | Author: vah 4 | */ 5 | 6 | hljs.LANGUAGES.bash = function(){ 7 | var BASH_LITERAL = {'true' : 1, 'false' : 1}; 8 | var VAR1 = { 9 | className: 'variable', 10 | begin: '\\$([a-zA-Z0-9_]+)\\b' 11 | }; 12 | var VAR2 = { 13 | className: 'variable', 14 | begin: '\\$\\{(([^}])|(\\\\}))+\\}', 15 | contains: [hljs.C_NUMBER_MODE] 16 | }; 17 | var QUOTE_STRING = { 18 | className: 'string', 19 | begin: '"', end: '"', 20 | illegal: '\\n', 21 | contains: [hljs.BACKSLASH_ESCAPE, VAR1, VAR2], 22 | relevance: 0 23 | }; 24 | var APOS_STRING = { 25 | className: 'string', 26 | begin: '\'', end: '\'', 27 | relevance: 0 28 | }; 29 | var TEST_CONDITION = { 30 | className: 'test_condition', 31 | begin: '', end: '', 32 | contains: [QUOTE_STRING, APOS_STRING, VAR1, VAR2, hljs.C_NUMBER_MODE], 33 | keywords: { 34 | 'literal': BASH_LITERAL 35 | }, 36 | relevance: 0 37 | }; 38 | 39 | return { 40 | defaultMode: { 41 | keywords: { 42 | 'keyword': { 43 | 'if' : 1, 'then' : 1, 'else' : 1, 'fi' : 1, 'for' : 1, 'break' : 1, 'continue' : 1, 'while' : 1, 'in' : 1, 44 | 'do' : 1, 'done' : 1, 'echo' : 1, 'exit' : 1, 'return' : 1, 'set' : 1, 'declare' : 1 45 | }, 46 | 'literal': BASH_LITERAL 47 | }, 48 | contains: [ 49 | { 50 | className: 'shebang', 51 | begin: '(#!\\/bin\\/bash)|(#!\\/bin\\/sh)', 52 | relevance: 10 53 | }, 54 | VAR1, 55 | VAR2, 56 | hljs.HASH_COMMENT_MODE, 57 | hljs.C_NUMBER_MODE, 58 | QUOTE_STRING, 59 | APOS_STRING, 60 | hljs.inherit(TEST_CONDITION, {begin: '\\[ ', end: ' \\]', relevance: 0}), 61 | hljs.inherit(TEST_CONDITION, {begin: '\\[\\[ ', end: ' \\]\\]'}) 62 | ] 63 | } 64 | }; 65 | }(); 66 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/coffeescript.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: CoffeeScript 3 | Author: Dmytrii Nagirniak 4 | Contributors: Oleg Efimov 5 | Description: CoffeeScript is a programming language that transcompiles to JavaScript. For info about language see http://coffeescript.org/ 6 | */ 7 | 8 | hljs.LANGUAGES.coffeescript = function() { 9 | var keywords = { 10 | 'keyword': { 11 | // JS keywords 12 | 'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 13 | 'new': 1, 'do': 1, 'return': 1, 'else': 1, 14 | 'break': 1, 'catch': 1, 'instanceof': 1, 'throw': 1, 15 | 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 16 | 'delete': 1, 'debugger': 1, 17 | 'class': 1, 'extends': 1, 'super': 1, 18 | // Coffee keywords 19 | 'then': 1, 'unless': 1, 'until': 1, 'loop': 2, 'of': 2, 'by': 1, 'when': 2, 20 | 'and': 1, 'or': 1, 'is': 1, 'isnt': 2, 'not': 1 21 | }, 22 | 'literal': { 23 | // JS literals 24 | 'true': 1, 'false': 1, 'null': 1, 'undefined': 1, 25 | // Coffee literals 26 | 'yes': 1, 'no': 1, 'on': 1, 'off': 1 27 | }, 28 | 'reserved': { 29 | 'case': 1, 'default': 1, 'function': 1, 'var': 1, 'void': 1, 'with': 1, 30 | 'const': 1, 'let': 1, 'enum': 1, 'export': 1, 'import': 1, 'native': 1, 31 | '__hasProp': 1 , '__extends': 1 , '__slice': 1 , '__bind': 1 , '__indexOf': 1 32 | } 33 | }; 34 | 35 | var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; 36 | 37 | var COFFEE_QUOTE_STRING_SUBST_MODE = { 38 | className: 'subst', 39 | begin: '#\\{', end: '}', 40 | keywords: keywords, 41 | contains: [hljs.C_NUMBER_MODE, hljs.BINARY_NUMBER_MODE] 42 | }; 43 | 44 | var COFFEE_QUOTE_STRING_MODE = { 45 | className: 'string', 46 | begin: '"', end: '"', 47 | relevance: 0, 48 | contains: [hljs.BACKSLASH_ESCAPE, COFFEE_QUOTE_STRING_SUBST_MODE] 49 | }; 50 | 51 | var COFFEE_HEREDOC_MODE = { 52 | className: 'string', 53 | begin: '"""', end: '"""', 54 | contains: [hljs.BACKSLASH_ESCAPE, COFFEE_QUOTE_STRING_SUBST_MODE] 55 | }; 56 | 57 | var COFFEE_HERECOMMENT_MODE = { 58 | className: 'comment', 59 | begin: '###', end: '###' 60 | }; 61 | 62 | var COFFEE_HEREGEX_MODE = { 63 | className: 'regexp', 64 | begin: '///', end: '///', 65 | contains: [hljs.HASH_COMMENT_MODE] 66 | }; 67 | 68 | var COFFEE_FUNCTION_DECLARATION_MODE = { 69 | className: 'function', 70 | begin: JS_IDENT_RE + '\\s*=\\s*(\\(.+\\))?\\s*[-=]>', 71 | returnBegin: true, 72 | contains: [ 73 | { 74 | className: 'title', 75 | begin: JS_IDENT_RE 76 | }, 77 | { 78 | className: 'params', 79 | begin: '\\(', end: '\\)' 80 | } 81 | ] 82 | }; 83 | 84 | var COFFEE_EMBEDDED_JAVASCRIPT = { 85 | className: 'javascript', 86 | begin: '`', end: '`', 87 | excludeBegin: true, excludeEnd: true, 88 | subLanguage: 'javascript' 89 | }; 90 | 91 | return { 92 | defaultMode: { 93 | keywords: keywords, 94 | contains: [ 95 | // Numbers 96 | hljs.C_NUMBER_MODE, 97 | hljs.BINARY_NUMBER_MODE, 98 | // Strings 99 | hljs.APOS_STRING_MODE, 100 | COFFEE_HEREDOC_MODE, // Should be before COFFEE_QUOTE_STRING_MODE for greater priority 101 | COFFEE_QUOTE_STRING_MODE, 102 | // Comments 103 | COFFEE_HERECOMMENT_MODE, // Should be before hljs.HASH_COMMENT_MODE for greater priority 104 | hljs.HASH_COMMENT_MODE, 105 | // CoffeeScript specific modes 106 | COFFEE_HEREGEX_MODE, 107 | COFFEE_EMBEDDED_JAVASCRIPT, 108 | COFFEE_FUNCTION_DECLARATION_MODE 109 | ] 110 | } 111 | }; 112 | }(); 113 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/css.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: CSS 3 | */ 4 | 5 | hljs.LANGUAGES.css = function() { 6 | var FUNCTION = { 7 | className: 'function', 8 | begin: hljs.IDENT_RE + '\\(', end: '\\)', 9 | contains: [{ 10 | endsWithParent: true, excludeEnd: true, 11 | contains: [hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] 12 | }] 13 | }; 14 | return { 15 | case_insensitive: true, 16 | defaultMode: { 17 | illegal: '[=/|\']', 18 | contains: [ 19 | hljs.C_BLOCK_COMMENT_MODE, 20 | { 21 | className: 'id', begin: '\\#[A-Za-z0-9_-]+' 22 | }, 23 | { 24 | className: 'class', begin: '\\.[A-Za-z0-9_-]+', 25 | relevance: 0 26 | }, 27 | { 28 | className: 'attr_selector', 29 | begin: '\\[', end: '\\]', 30 | illegal: '$' 31 | }, 32 | { 33 | className: 'pseudo', 34 | begin: ':(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\"\\\']+' 35 | }, 36 | { 37 | className: 'at_rule', 38 | begin: '@(font-face|page)', 39 | lexems: '[a-z-]+', 40 | keywords: {'font-face': 1, 'page': 1} 41 | }, 42 | { 43 | className: 'at_rule', 44 | begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing 45 | // because it doesn't let it to be parsed as 46 | // a rule set but instead drops parser into 47 | // the defaultMode which is how it should be. 48 | excludeEnd: true, 49 | keywords: {'import': 1, 'page': 1, 'media': 1, 'charset': 1}, 50 | contains: [ 51 | FUNCTION, 52 | hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, 53 | hljs.NUMBER_MODE 54 | ] 55 | }, 56 | { 57 | className: 'tag', begin: hljs.IDENT_RE, 58 | relevance: 0 59 | }, 60 | { 61 | className: 'rules', 62 | begin: '{', end: '}', 63 | illegal: '[^\\s]', 64 | relevance: 0, 65 | contains: [ 66 | hljs.C_BLOCK_COMMENT_MODE, 67 | { 68 | className: 'rule', 69 | begin: '[^\\s]', returnBegin: true, end: ';', endsWithParent: true, 70 | contains: [ 71 | { 72 | className: 'attribute', 73 | begin: '[A-Z\\_\\.\\-]+', end: ':', 74 | excludeEnd: true, 75 | illegal: '[^\\s]', 76 | starts: { 77 | className: 'value', 78 | endsWithParent: true, excludeEnd: true, 79 | contains: [ 80 | FUNCTION, 81 | hljs.NUMBER_MODE, 82 | hljs.QUOTE_STRING_MODE, 83 | hljs.APOS_STRING_MODE, 84 | hljs.C_BLOCK_COMMENT_MODE, 85 | { 86 | className: 'hexcolor', begin: '\\#[0-9A-F]+' 87 | }, 88 | { 89 | className: 'important', begin: '!important' 90 | } 91 | ] 92 | } 93 | } 94 | ] 95 | } 96 | ] 97 | } 98 | ] 99 | } 100 | }; 101 | }(); 102 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/diff.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Diff 3 | Description: Unified and context diff 4 | Author: Vasily Polovnyov 5 | */ 6 | 7 | hljs.LANGUAGES.diff = { 8 | case_insensitive: true, 9 | defaultMode: { 10 | contains: [ 11 | { 12 | className: 'chunk', 13 | begin: '^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$', 14 | relevance: 10 15 | }, 16 | { 17 | className: 'chunk', 18 | begin: '^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$', 19 | relevance: 10 20 | }, 21 | { 22 | className: 'chunk', 23 | begin: '^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$', 24 | relevance: 10 25 | }, 26 | { 27 | className: 'header', 28 | begin: 'Index: ', end: '$' 29 | }, 30 | { 31 | className: 'header', 32 | begin: '=====', end: '=====$' 33 | }, 34 | { 35 | className: 'header', 36 | begin: '^\\-\\-\\-', end: '$' 37 | }, 38 | { 39 | className: 'header', 40 | begin: '^\\*{3} ', end: '$' 41 | }, 42 | { 43 | className: 'header', 44 | begin: '^\\+\\+\\+', end: '$' 45 | }, 46 | { 47 | className: 'header', 48 | begin: '\\*{5}', end: '\\*{5}$' 49 | }, 50 | { 51 | className: 'addition', 52 | begin: '^\\+', end: '$' 53 | }, 54 | { 55 | className: 'deletion', 56 | begin: '^\\-', end: '$' 57 | }, 58 | { 59 | className: 'change', 60 | begin: '^\\!', end: '$' 61 | } 62 | ] 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/javascript.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: JavaScript 3 | */ 4 | 5 | hljs.LANGUAGES.javascript = { 6 | defaultMode: { 7 | keywords: { 8 | 'keyword': { 9 | 'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 10 | 'return': 1, 'void': 1, 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 11 | 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1 12 | }, 13 | 'literal': {'true': 1, 'false': 1, 'null': 1} 14 | }, 15 | contains: [ 16 | hljs.APOS_STRING_MODE, 17 | hljs.QUOTE_STRING_MODE, 18 | hljs.C_LINE_COMMENT_MODE, 19 | hljs.C_BLOCK_COMMENT_MODE, 20 | hljs.C_NUMBER_MODE, 21 | { // regexp container 22 | begin: '(' + hljs.RE_STARTERS_RE + '|case|return|throw)\\s*', 23 | keywords: {'return': 1, 'throw': 1, 'case': 1}, 24 | contains: [ 25 | hljs.C_LINE_COMMENT_MODE, 26 | hljs.C_BLOCK_COMMENT_MODE, 27 | { 28 | className: 'regexp', 29 | begin: '/', end: '/[gim]*', 30 | contains: [{begin: '\\\\/'}] 31 | } 32 | ], 33 | relevance: 0 34 | }, 35 | { 36 | className: 'function', 37 | begin: '\\bfunction\\b', end: '{', 38 | keywords: {'function': 1}, 39 | contains: [ 40 | { 41 | className: 'title', begin: '[A-Za-z$_][0-9A-Za-z$_]*' 42 | }, 43 | { 44 | className: 'params', 45 | begin: '\\(', end: '\\)', 46 | contains: [ 47 | hljs.APOS_STRING_MODE, 48 | hljs.QUOTE_STRING_MODE, 49 | hljs.C_LINE_COMMENT_MODE, 50 | hljs.C_BLOCK_COMMENT_MODE 51 | ] 52 | } 53 | ] 54 | } 55 | ] 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/sql.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: SQL 3 | */ 4 | 5 | hljs.LANGUAGES.sql = { 6 | case_insensitive: true, 7 | defaultMode: { 8 | illegal: '[^\\s]', 9 | contains: [ 10 | { 11 | className: 'operator', 12 | begin: '(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b', end: ';|$', 13 | keywords: { 14 | 'keyword': { 15 | 'all': 1, 'partial': 1, 'global': 1, 'month': 1, 16 | 'current_timestamp': 1, 'using': 1, 'go': 1, 'revoke': 1, 17 | 'smallint': 1, 'indicator': 1, 'end-exec': 1, 'disconnect': 1, 18 | 'zone': 1, 'with': 1, 'character': 1, 'assertion': 1, 'to': 1, 19 | 'add': 1, 'current_user': 1, 'usage': 1, 'input': 1, 'local': 1, 20 | 'alter': 1, 'match': 1, 'collate': 1, 'real': 1, 'then': 1, 21 | 'rollback': 1, 'get': 1, 'read': 1, 'timestamp': 1, 22 | 'session_user': 1, 'not': 1, 'integer': 1, 'bit': 1, 'unique': 1, 23 | 'day': 1, 'minute': 1, 'desc': 1, 'insert': 1, 'execute': 1, 24 | 'like': 1, 'ilike': 2, 'level': 1, 'decimal': 1, 'drop': 1, 25 | 'continue': 1, 'isolation': 1, 'found': 1, 'where': 1, 26 | 'constraints': 1, 'domain': 1, 'right': 1, 'national': 1, 'some': 1, 27 | 'module': 1, 'transaction': 1, 'relative': 1, 'second': 1, 28 | 'connect': 1, 'escape': 1, 'close': 1, 'system_user': 1, 'for': 1, 29 | 'deferred': 1, 'section': 1, 'cast': 1, 'current': 1, 'sqlstate': 1, 30 | 'allocate': 1, 'intersect': 1, 'deallocate': 1, 'numeric': 1, 31 | 'public': 1, 'preserve': 1, 'full': 1, 'goto': 1, 'initially': 1, 32 | 'asc': 1, 'no': 1, 'key': 1, 'output': 1, 'collation': 1, 'group': 1, 33 | 'by': 1, 'union': 1, 'session': 1, 'both': 1, 'last': 1, 34 | 'language': 1, 'constraint': 1, 'column': 1, 'of': 1, 'space': 1, 35 | 'foreign': 1, 'deferrable': 1, 'prior': 1, 'connection': 1, 36 | 'unknown': 1, 'action': 1, 'commit': 1, 'view': 1, 'or': 1, 37 | 'first': 1, 'into': 1, 'float': 1, 'year': 1, 'primary': 1, 38 | 'cascaded': 1, 'except': 1, 'restrict': 1, 'set': 1, 'references': 1, 39 | 'names': 1, 'table': 1, 'outer': 1, 'open': 1, 'select': 1, 40 | 'size': 1, 'are': 1, 'rows': 1, 'from': 1, 'prepare': 1, 41 | 'distinct': 1, 'leading': 1, 'create': 1, 'only': 1, 'next': 1, 42 | 'inner': 1, 'authorization': 1, 'schema': 1, 'corresponding': 1, 43 | 'option': 1, 'declare': 1, 'precision': 1, 'immediate': 1, 'else': 1, 44 | 'timezone_minute': 1, 'external': 1, 'varying': 1, 'translation': 1, 45 | 'true': 1, 'case': 1, 'exception': 1, 'join': 1, 'hour': 1, 46 | 'default': 1, 'double': 1, 'scroll': 1, 'value': 1, 'cursor': 1, 47 | 'descriptor': 1, 'values': 1, 'dec': 1, 'fetch': 1, 'procedure': 1, 48 | 'delete': 1, 'and': 1, 'false': 1, 'int': 1, 'is': 1, 'describe': 1, 49 | 'char': 1, 'as': 1, 'at': 1, 'in': 1, 'varchar': 1, 'null': 1, 50 | 'trailing': 1, 'any': 1, 'absolute': 1, 'current_time': 1, 'end': 1, 51 | 'grant': 1, 'privileges': 1, 'when': 1, 'cross': 1, 'check': 1, 52 | 'write': 1, 'current_date': 1, 'pad': 1, 'begin': 1, 'temporary': 1, 53 | 'exec': 1, 'time': 1, 'update': 1, 'catalog': 1, 'user': 1, 'sql': 1, 54 | 'date': 1, 'on': 1, 'identity': 1, 'timezone_hour': 1, 'natural': 1, 55 | 'whenever': 1, 'interval': 1, 'work': 1, 'order': 1, 'cascade': 1, 56 | 'diagnostics': 1, 'nchar': 1, 'having': 1, 'left': 1, 'call': 1, 57 | 'do': 1, 'handler': 1, 'load': 1, 'replace': 1, 'truncate': 1, 58 | 'start': 1, 'lock': 1, 'show': 1, 'pragma': 1}, 59 | 'aggregate': {'count': 1, 'sum': 1, 'min': 1, 'max': 1, 'avg': 1} 60 | }, 61 | contains: [ 62 | { 63 | className: 'string', 64 | begin: '\'', end: '\'', 65 | contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}], 66 | relevance: 0 67 | }, 68 | { 69 | className: 'string', 70 | begin: '"', end: '"', 71 | contains: [hljs.BACKSLASH_ESCAPE, {begin: '""'}], 72 | relevance: 0 73 | }, 74 | { 75 | className: 'string', 76 | begin: '`', end: '`', 77 | contains: [hljs.BACKSLASH_ESCAPE] 78 | }, 79 | hljs.C_NUMBER_MODE, 80 | {begin: '\\n'} 81 | ] 82 | }, 83 | hljs.C_BLOCK_COMMENT_MODE, 84 | { 85 | className: 'comment', 86 | begin: '--', end: '$' 87 | } 88 | ] 89 | } 90 | }; 91 | -------------------------------------------------------------------------------- /theme/default/lib/scripts/languages/xml.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: HTML, XML 3 | */ 4 | 5 | hljs.LANGUAGES.xml = function(){ 6 | var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; 7 | var TAG_INTERNALS = { 8 | endsWithParent: true, 9 | contains: [ 10 | { 11 | className: 'attribute', 12 | begin: XML_IDENT_RE, 13 | relevance: 0 14 | }, 15 | { 16 | begin: '="', returnBegin: true, end: '"', 17 | contains: [{ 18 | className: 'value', 19 | begin: '"', endsWithParent: true 20 | }] 21 | }, 22 | { 23 | begin: '=\'', returnBegin: true, end: '\'', 24 | contains: [{ 25 | className: 'value', 26 | begin: '\'', endsWithParent: true 27 | }] 28 | }, 29 | { 30 | begin: '=', 31 | contains: [{ 32 | className: 'value', 33 | begin: '[^\\s/>]+' 34 | }] 35 | } 36 | ] 37 | }; 38 | return { 39 | case_insensitive: true, 40 | defaultMode: { 41 | contains: [ 42 | { 43 | className: 'pi', 44 | begin: '<\\?', end: '\\?>', 45 | relevance: 10 46 | }, 47 | { 48 | className: 'doctype', 49 | begin: '', 50 | relevance: 10, 51 | contains: [{begin: '\\[', end: '\\]'}] 52 | }, 53 | { 54 | className: 'comment', 55 | begin: '', 56 | relevance: 10 57 | }, 58 | { 59 | className: 'cdata', 60 | begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', 61 | relevance: 10 62 | }, 63 | { 64 | className: 'tag', 65 | /* 66 | The lookahead pattern (?=...) ensures that 'begin' only matches 67 | '|$)', end: '>', 72 | keywords: {'title': {'style': 1}}, 73 | contains: [TAG_INTERNALS], 74 | starts: { 75 | className: 'css', 76 | end: '', returnEnd: true, 77 | subLanguage: 'css' 78 | } 79 | }, 80 | { 81 | className: 'tag', 82 | // See the comment in the