├── README.md
├── bin
├── smartdoc
└── smartdoc.cmd
├── demoBuilder.js
├── docConfig.js
├── input
├── code
│ ├── inherit
│ │ └── examplemodule.js
│ ├── json
│ │ ├── parse.js
│ │ └── stringify.js
│ ├── oop
│ │ └── oop.js
│ ├── st
│ │ └── deferred.js
│ └── ui
│ │ └── uicode.js
└── demo
│ ├── inherit
│ └── getTargets3.js
│ ├── st
│ └── deferred.js
│ ├── ui.html
│ └── ui2.html
├── jasmineLoader.js
├── package.json
├── smartDoc.js
├── test.js
└── theme-smart
├── assets
├── code.html
├── codemirror
│ ├── addon
│ │ ├── comment
│ │ │ ├── comment.js
│ │ │ └── continuecomment.js
│ │ ├── dialog
│ │ │ ├── dialog.css
│ │ │ └── dialog.js
│ │ ├── edit
│ │ │ ├── closebrackets.js
│ │ │ ├── closetag.js
│ │ │ ├── continuelist.js
│ │ │ ├── matchbrackets.js
│ │ │ ├── matchtags.js
│ │ │ └── trailingspace.js
│ │ ├── fold
│ │ │ ├── brace-fold.js
│ │ │ ├── comment-fold.js
│ │ │ ├── foldcode.js
│ │ │ ├── foldgutter.css
│ │ │ ├── foldgutter.js
│ │ │ ├── indent-fold.js
│ │ │ ├── markdown-fold.js
│ │ │ └── xml-fold.js
│ │ ├── hint
│ │ │ ├── anyword-hint.js
│ │ │ ├── css-hint.js
│ │ │ ├── html-hint.js
│ │ │ ├── javascript-hint.js
│ │ │ ├── python-hint.js
│ │ │ ├── show-hint.css
│ │ │ ├── show-hint.js
│ │ │ ├── sql-hint.js
│ │ │ └── xml-hint.js
│ │ ├── lint
│ │ │ ├── coffeescript-lint.js
│ │ │ ├── css-lint.js
│ │ │ ├── javascript-lint.js
│ │ │ ├── jshint.js
│ │ │ ├── json-lint.js
│ │ │ ├── lint.css
│ │ │ ├── lint.js
│ │ │ └── yaml-lint.js
│ │ ├── search
│ │ │ ├── match-highlighter.js
│ │ │ ├── search.js
│ │ │ └── searchcursor.js
│ │ └── wrap
│ │ │ └── hardwrap.js
│ ├── demo.html
│ ├── doc
│ │ ├── activebookmark.js
│ │ ├── compress.html
│ │ ├── docs.css
│ │ ├── internals.html
│ │ ├── logo.png
│ │ ├── logo.svg
│ │ ├── manual.html
│ │ ├── realworld.html
│ │ ├── releases.html
│ │ ├── reporting.html
│ │ ├── upgrade_v2.2.html
│ │ ├── upgrade_v3.html
│ │ └── upgrade_v4.html
│ ├── keymap
│ │ ├── emacs.js
│ │ ├── sublime.js
│ │ └── vim.js
│ ├── lib
│ │ ├── codemirror.css
│ │ └── codemirror.js
│ ├── mode
│ │ ├── css.js
│ │ ├── htmlmixed.js
│ │ ├── javascript.js
│ │ └── xml.js
│ └── theme
│ │ └── monokai.css
├── css
│ ├── codeDemo.css
│ ├── loading.gif
│ ├── logo.png
│ ├── main.css
│ └── showDemo.css
├── favicon.png
├── img
│ └── spinner.gif
├── index.html
├── js
│ ├── code.js
│ ├── demo.js
│ ├── doc.js
│ └── show.js
└── vendor
│ ├── bootstrap
│ ├── css
│ │ └── bootstrap.min.css
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ └── glyphicons-halflings-regular.woff
│ ├── img
│ │ ├── glyphicons-halflings-white.png
│ │ └── glyphicons-halflings.png
│ └── js
│ │ └── bootstrap.min.js
│ ├── jquery
│ └── jquery-1.8.2.min.js
│ └── prettify
│ ├── prettify-min.css
│ └── prettify-min.js
├── helpers
└── helpers.js
├── layouts
├── demo.handlebars
├── main.handlebars
└── xhr.handlebars
└── partials
├── attrs.handlebars
├── classes.handlebars
├── events.handlebars
├── files.handlebars
├── index.handlebars
├── method.handlebars
├── module.handlebars
├── options.handlebars
├── props.handlebars
└── sidebar.handlebars
/README.md:
--------------------------------------------------------------------------------
1 | SmartDoc
2 | ======================
3 |
4 | 基于YUIDoc构建的Javascipt文档生成器。
5 |
6 | 详细介绍见我的博客: [JS文档和Demo自动化生成工具 - SmartDoc](http://www.cnblogs.com/zhh8077/p/4010991.html)和[注释编写说明](http://www.cnblogs.com/zhh8077/p/4011769.html)
7 |
8 | [生成示例地址](http://zhh77.github.io/smartDoc/)
9 |
10 | license : BSD
11 |
12 | 0.1.1 特性
13 | --------------------
14 | * 加入@demo配置项,看可以动态抓取html和js的内容作为@example,同时支持扩展@demo读取
15 | * 支持jasmine测试js文件的单元代码抓取为@example
16 | * 实现多个example显示和tab切换
17 | * 加入@show配置项来控制直接显示example效果
18 | * 主题改版
19 | * 去除@attribute属性设置,统一使用@property
20 |
21 | 0.1.0 特性
22 | --------------------
23 | * 基于Bootstrp3构建,排版和样式美化
24 | * 支持html和js的Demo生成,与查看
25 | * 提供在线的demo编辑页面(类似于jsfiddler)
26 | * 同步jasmine的expect接口,使得单元测试与example的代码能够复用
27 | * 可以配置化增强 - 项目信息配置;Document页面导航配置;demo依赖库配置
28 | * 提供全局api查询和导航过滤功能,筛选更加便利
29 | * 提供grunt插件 - grunt-contrib-smartdoc
30 |
31 | 使用
32 | --------------------
33 | 在目录中加入docConfig.js文件
34 |
35 | npm install -g smartdoc
36 | smartdoc
37 |
38 |
39 | docConfig配置项说明
40 | ---------------------
41 |
42 | module.exports = {
43 | //扫描的文件路径
44 | paths: ['input/code/'],
45 |
46 | //demo读取路径
47 | demoDir:"input/demo/",
48 |
49 | //文档页面输出路径
50 | outdir: 'doc/',
51 |
52 | //项目信息配置
53 | project: {
54 |
55 | //项目名称
56 | name: 'SmartDoc',
57 |
58 | //项目描述,可以配置html,会生成到document主页
59 | description: '
SmartDoc Javascript Document builder base on YUIDoc.
',
60 |
61 | //版本信息
62 | version: '1.1.0',
63 |
64 | //地址信息
65 | url: 'https://github.com/zhh77/smartjs',
66 | //logo地址
67 | logo : 'https://github.com/zhh77/logo.png',
68 | //导航信息
69 | navs: [{
70 | name: "Home",
71 | url: "https://github.com/zhh77/smartjs"
72 | }, {
73 | name: "Document",
74 | url: ""
75 | }, {
76 | name: "About",
77 | url: "https://github.com/zhh77/smartjs"
78 | }]
79 | },
80 |
81 | //demo展示页面配置;需要加载的资源; 资源只能是css和js文件
82 | demo: {
83 |
84 | //外部资源链接
85 | link : ['http://code.jquery.com/jquery-1.11.0.min.js'],
86 |
87 | //文件复制路径; 将目下的资源复制到doc生成目录中,并在deom页面引用
88 | paths : ['input/code/ui/uicode.js','input/'],
89 |
90 | //是否开启在code编辑器中的自动完成功能(会将link和paths的引入加入);默认开启;
91 | autoComplete : true
92 | },
93 |
94 | //自定义主题路径
95 | themedir: 'theme/',
96 |
97 | //自定义helpers
98 | helpers: ["theme/helpers/helpers.js"]
99 | };
100 |
101 | 其他使用见 [YUIDoc](http://yui.github.com/yuidoc/)
102 |
103 |
104 |
105 | 例子使用说明
106 | ------------------
107 | 将代码下载后,运行
108 |
109 | npm install
110 | node test.js
111 |
112 |
113 | 程序会将input/目录下的js扫描,将Document生成到doc/目录下,运行doc/index.html,即可访问生成的文档。
114 |
115 |
116 | 注意:生成后的代码编辑页面需要发布到服务器才能正常运行;
117 |
118 | [使用SmartDoc生成的SmartJS API地址](http://zhh77.github.io/smartjs/)
119 |
--------------------------------------------------------------------------------
/bin/smartdoc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var path = require('path');
4 | var fs = require('fs');
5 | var dir = path.dirname(fs.realpathSync(__filename))+"/../";
6 | require(dir+'smartDoc.js').build();
7 |
--------------------------------------------------------------------------------
/bin/smartdoc.cmd:
--------------------------------------------------------------------------------
1 | node bin/smartDoc %1
--------------------------------------------------------------------------------
/demoBuilder.js:
--------------------------------------------------------------------------------
1 | var fs = require("fs");
2 |
3 | function getSetting(path,startFlag,endFlag){
4 | var start = path.indexOf(startFlag),end,setting;
5 | if (start > 0) {
6 | end = path.indexOf(endFlag);
7 | if(end > start){
8 | return [path.substr(0, index),]
9 | }
10 | unit = path.substring(index + 1, path.length - 1);
11 | path = path.substr(0, index);
12 | }
13 | }
14 |
15 | module.exports = {
16 | build : function (path,config, target) {
17 | var index = path.indexOf("{"),
18 | unit,title, code,loader;
19 |
20 | path = path.replace(/\{([\s\S]*?)}/g, function (s, matched) {
21 | title = matched;
22 | return '';
23 | }).replace(/\[([\s\S]*?)]/g, function (s, matched) {
24 | unit = matched;
25 | return '';
26 | });
27 |
28 | function getCode(demoPath) {
29 | var data;
30 | try {
31 | data = fs.readFileSync(config.demoDir + demoPath.trim(), 'utf-8');
32 | } catch (err) {
33 | console.error("demo 文件读取失败:" + err);
34 | }
35 | return data;
36 | }
37 |
38 | if(!title){
39 | title = path.substring(path.lastIndexOf('/') + 1,path.indexOf('.'));
40 | }
41 |
42 | if(unit){
43 | loader = require(config.codeLoader);
44 | code = loader.load(path, unit, getCode, this.formatCode);
45 | }
46 | else
47 | code = this.formatCode(getCode(path))
48 |
49 | return {
50 | code : code,
51 | title : title
52 | };
53 | },
54 | formatCode : function (code) {
55 | if (code)
56 | return "\t" + code.replace(/\n/g, '\n\t');
57 | }
58 | };
--------------------------------------------------------------------------------
/docConfig.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | //扫描的文件路径
3 | paths: ['input/code/'],
4 | demoDir:"input/demo/",
5 | //文档页面输出路径
6 | outdir: 'doc/',
7 | //内置主题
8 | // theme:'ui',
9 | //自定义主题目录
10 | //themedir: 'theme-smart-ui/',
11 | //项目信息配置
12 | project: {
13 |
14 | //项目名称
15 | name: 'SmartDoc',
16 |
17 | //项目描述,可以配置html,会生成到document主页
18 | // description: 'SmartDoc Javascript Document builder base on YUIDoc.
',
19 |
20 | //版本信息
21 | version: '1.1.0',
22 |
23 | //地址信息
24 | url: 'https://github.com/zhh77/smartdoc',
25 |
26 | //导航信息
27 | navs: [{
28 | name: "Home",
29 | url: "https://github.com/zhh77/smartdoc"
30 | }, {
31 | name: "Document",
32 | url: "/"
33 | }, {
34 | name: "About",
35 | url: "https://github.com/zhh77/smartdoc"
36 | }]
37 | },
38 | //demo页面需要加载的js库
39 | demo: {
40 | paths : ['input/code/ui/uicode.js'],
41 | link : ['http://code.jquery.com/jquery-1.11.0.min.js']
42 | }
43 | };
44 |
45 |
--------------------------------------------------------------------------------
/input/code/inherit/examplemodule.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This is my example module
3 | * @module ExampleModule
4 | * @example
5 | *
6 | * var bar;
7 | *
8 | */
9 |
10 | YUI.add('examplemodule', function (Y) {
11 | Y.namespace('mywidget');
12 |
13 | /**
14 | * Superclass description. This is a second line too.
15 | *
16 | * @constructor
17 | * @class SuperWidget
18 | * @extends Widget
19 | * @namespace mywidget
20 | * @example
21 | *
22 | * var bar;
23 | *
24 | */
25 | Y.mywidget.superwidget = Y.Base.create("mysuperwidget", Y.Widget, [], {
26 |
27 | /**
28 | * Supermethod description. This is a second line.
29 | *
30 | * @method myMethod
31 | * @async
32 | * @example
33 | *
34 | * var bar;
35 | *
36 | */
37 | myMethod: function () {}
38 |
39 | /**
40 | * Overwritten method see {{#crossLink "mywidget.SuperWidget"}}{{/crossLink}}
41 | * also see {{#crossLink "mywidget.SuperWidget/myMethod"}}{{/crossLink}}
42 | * This is also a test
43 | * @method getTargets2
44 | * @example
45 | *
46 | * var bar;
47 | *
48 | */
49 |
50 | /**
51 | * Overwritten method see {{#crossLink "mywidget.SuperWidget"}}{{/crossLink}}
52 | * also see {{#crossLink "mywidget.SuperWidget/myMethod"}}{{/crossLink}}
53 | * This is also a test
54 | *
55 | * ```javascript
56 | *
57 | * var test = "hello from a code block!";
58 | *
59 | * ```
60 | *
61 | * @method getTargets3
62 | * @demo inherit/getTargets3.js
63 | */
64 |
65 | /**
66 | * Override Attribute
67 | * @attribute focused2
68 | * @optional
69 | */
70 |
71 | /**
72 | * Override Attribute
73 | * @attribute focused3
74 | * @required
75 | * @example
76 | * {
77 | * a:1
78 | * }
79 | */
80 |
81 | /**
82 | * Override Property
83 | * @property name2
84 | * @type String
85 | */
86 |
87 | /**
88 | * Override Event
89 | * @event init2
90 | * @param {object} opt options
91 | * @example
92 | * var a = '';
93 | */
94 | init2 : function(opt){
95 |
96 | }
97 | }, {
98 |
99 | });
100 |
101 | /**
102 | * Subclass description.
103 | *
104 | * @constructor
105 | * @namespace mywidget
106 | * @class SubWidget
107 | * @extends mywidget.SuperWidget
108 | */
109 | Y.mywidget.superwidget = Y.Base.create("mysuperwidget", Y.mywidget.superwidget, [], {
110 |
111 | /**
112 | * Submethod description.
113 | *
114 | * @method myMethod
115 | * @param {boolean} d Foo
116 | */
117 | myMethod: function () {}
118 |
119 | }, {
120 |
121 | });
122 |
123 | /**
124 | * Subclass description.
125 | *
126 | * @constructor
127 | * @namespace mywidget
128 | * @class SubWidget2
129 | * @extends Accordion
130 | */
131 | });
132 |
--------------------------------------------------------------------------------
/input/code/st/deferred.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | /**
3 | Promise的实现对象,接口基本与Jquery相同,不依赖JQuery的时候使用;
4 |
5 | Update Note:
6 | + 2014.10 :Created
7 |
8 | @module Promise
9 | */
10 | stDefine('deferred', function(st) {
11 |
12 | var priorityList = st.priorityList,
13 | sliceArgs = st.sliceArgs;
14 |
15 | /**
16 | * Deferred对象
17 | * @class Deferred
18 | * @constructor
19 | * @demo st/deferred.js [resolve]
20 | */
21 | function Deferred() {
22 | var defer = this;
23 | defer.__state = 'pendding';
24 | defer.__resolvedCalls = priorityList();
25 | defer.__rejectedCalls = priorityList();
26 | defer.__alwaysCalls = priorityList();
27 | }
28 |
29 | function addCallbacks(defer, callbacks, state) {
30 | var status = defer.state(),
31 | list,
32 | len = callbacks.length,
33 | priority;
34 |
35 | if (len > 0) {
36 | callbacks = sliceArgs(callbacks);
37 |
38 | if (len > 1) {
39 | priority = callbacks[len - 1];
40 |
41 | if (priority === undefined || typeof priority === 'number')
42 | callbacks.pop();
43 | else
44 | priority = null;
45 | }
46 |
47 | if (status === state) {
48 | callbacks.forEach(function(callback) {
49 | callback && callback.apply(null, defer.__result);
50 | })
51 | } else {
52 | list = defer['__' + state + 'Calls'];
53 |
54 | callbacks.forEach(function(callback) {
55 | callback && list.add(callback, priority);
56 | })
57 | }
58 | }
59 |
60 | return defer;
61 | }
62 |
63 | function complete(defer, args, state) {
64 | defer.__state = state;
65 |
66 | var list = defer['__' + state + 'Calls'],
67 | fnCallback = function(callback) {
68 | callback.apply(defer, args);
69 | };
70 |
71 | list.each(fnCallback)
72 |
73 | defer.__alwaysCalls.each(fnCallback);
74 | }
75 |
76 | Deferred.prototype = {
77 | /**
78 | * 解决递延对象,并根据给定的参数调用任何完成的回调函数
79 | * @method resolve
80 | * @param {object} result 解决传递的结果
81 | * @demo st/deferred.js [multi resolve]
82 | */
83 | resolve: function(result) {
84 | complete(this, arguments, 'resolved');
85 | },
86 | /**
87 | * 拒绝延迟对象,并根据给定的参数调用任何失败的回调函数。
88 | * @method reject
89 | * @param {object} arg 拒绝传递的参数
90 | * @demo st/deferred.js [reject]
91 | */
92 | reject: function(arg) {
93 | complete(this, arguments, 'rejected');
94 | },
95 | /**
96 | * 返回契约
97 | * @method promise
98 | */
99 | promise: function() {
100 | return this.__state === 'pendding' ? this : this.__result;
101 | },
102 | /**
103 | * 返回契约状态;
104 | * 1. pending: 未完成状态。
105 | * 2. resolved: 解决状态。
106 | * 3. rejected: 拒绝的状态。
107 | * @method state
108 | */
109 | state: function() {
110 | return this.__state;
111 | },
112 | /**
113 | * 当延迟成功时调用一个函数或者数组函数。
114 | * @method done
115 | * @param {function|array} callback 回调函数或者数组函数
116 | */
117 | done: function(callback) {
118 | return addCallbacks(this, arguments, 'resolved');
119 | },
120 | /**
121 | * 当延迟失败时调用一个函数或者数组函数。
122 | * @method fail
123 | * @param {function|array} callback 回调函数或者数组函数
124 | */
125 | fail: function(callback) {
126 | return addCallbacks(this, arguments, 'rejected');
127 | },
128 | /**
129 | * 当递延对象是解决或拒绝时被调用添加处理程序;
130 | * @method always
131 | * @param {function|array} callback 回调函数或者数组函数
132 | */
133 | always: function() {
134 | return addCallbacks(this, arguments, 'always');
135 | },
136 | /**
137 | * 添加处理程序被调用时,递延对象得到解决或者拒绝;
138 | * @method then
139 | * @param {function} doneCallback 成功回调函数
140 | * @param {function} callback 失败回调函数或者数组函数
141 | * @param {number} priority 权重;优先级
142 | */
143 | then: function(doneCallback, failCallback, priority) {
144 | doneCallback && this.done(doneCallback, priority);
145 | failCallback && this.fail(failCallback, priority);
146 | return this;
147 | }
148 | }
149 |
150 | return {
151 | Deferred: function() {
152 | return new Deferred();
153 | },
154 | /**
155 | * 捕获promise的方法,使用st.when调用;
156 | * @method when
157 | * @param {object|args} result 单个判断对象或者一组(参数组)判断对象
158 | * @demo
159 | */
160 | when: function() {
161 | var deferList = sliceArgs(arguments),
162 | count = deferList.length,
163 | isResolve = true,
164 | num = 0,
165 | rets = new Array(count),
166 | isFinish,
167 | whenDefer = new Deferred();
168 |
169 | function process(i, result, state) {
170 | num++;
171 | if (isResolve && state === 'rejected')
172 | isResolve = false;
173 |
174 | rets[i] = result;
175 |
176 | if (num === count) {
177 | whenDefer[isResolve ? 'resolve' : 'reject'].apply(whenDefer, rets);
178 | isFinish = true;
179 | }
180 | }
181 |
182 | deferList.forEach(function(defer, i) {
183 | if (defer instanceof Deferred) {
184 | defer.always(function(result) {
185 | process(i, result, this.state());
186 | })
187 | } else
188 | process(i, defer);
189 | })
190 |
191 | if (isFinish) {
192 | whenDefer.__result = rets;
193 | }
194 | return whenDefer;
195 | }
196 | };
197 | })
198 |
--------------------------------------------------------------------------------
/input/code/ui/uicode.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | ui测试模块;
4 | * 提供了example的html与js实例;
5 | * example中引用了jquery的dns和本模块的uiCode.js文件
6 | @module uiModule
7 | */
8 | (function() {
9 |
10 | /**
11 | * ui测试类;
12 | * @class UI
13 | * @constructor
14 | * @content {string} type 内容
15 | * @demo ui.html
16 | * @demo ui2.html {ui测试2}
17 | * @show true
18 | */
19 | function UI(content){
20 | this.init(content);
21 | }
22 |
23 | UI.prototype = {
24 | /**
25 | * ui初始化方法
26 | * @method init
27 | * @param {string} content 内容
28 | */
29 | init : function(content){
30 | this.content = content;
31 | },
32 | /**
33 | * 渲染方法
34 | * @method render
35 | * @return {string} 渲染后的html
36 | */
37 | render : function(){
38 | return '' + this.content + '
';
39 | }
40 | }
41 |
42 | window["UI"] = UI;
43 | })();
--------------------------------------------------------------------------------
/input/demo/inherit/getTargets3.js:
--------------------------------------------------------------------------------
1 | var a = "222";
2 | var b = 2;
--------------------------------------------------------------------------------
/input/demo/st/deferred.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | describe('Deferred', function() {
4 | it("resolve",function(testDone){
5 | var defer = st.Deferred();
6 |
7 | function test(){
8 | setTimeout(function(){
9 | defer.resolve("test");
10 | })
11 | return defer.promise();
12 |
13 | }
14 |
15 | st.when(test()).done(function(result){
16 | expect(result).toBe('test');
17 | testDone();
18 | })
19 | })
20 |
21 | it("multi resolve",function(testDone){
22 | function test(){
23 | var defer = st.Deferred();
24 | setTimeout(function(){
25 | defer.resolve("test");
26 | })
27 | return defer.promise();
28 |
29 | }
30 |
31 | function test2(){
32 | var defer = st.Deferred();
33 | setTimeout(function(){
34 | defer.resolve("test2");
35 | })
36 | return defer.promise();
37 |
38 | }
39 |
40 | st.when(test(),test2()).done(function(result,result2){
41 | expect(result).toBe('test');
42 | expect(result2).toBe('test2');
43 | testDone();
44 | })
45 | })
46 |
47 | it("reject",function(testDone){
48 | var defer = st.Deferred();
49 |
50 | function test(){
51 | setTimeout(function(){
52 | defer.reject("test");
53 | })
54 | return defer.promise();
55 | }
56 |
57 | st.when(test()).fail(function(result){
58 | expect(result).toBe('test');
59 | testDone();
60 | })
61 | })
62 | });
63 | })();
--------------------------------------------------------------------------------
/input/demo/ui.html:
--------------------------------------------------------------------------------
1 |
2 |
14 | UI测试1
15 | html render
16 |
17 |
34 |
--------------------------------------------------------------------------------
/input/demo/ui2.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 | UI测试2
16 |
17 |
18 |
23 |
--------------------------------------------------------------------------------
/jasmineLoader.js:
--------------------------------------------------------------------------------
1 | var jasmineMethod = ["beforeEach", "afterEach"],
2 | jasmineArgs = [],
3 | jasmineModules = {},
4 | formatCode;
5 |
6 | function loop() {}
7 |
8 | function jasmine(path) {
9 | this.unit = jasmineModules[path] = {};
10 | }
11 |
12 | function describe(name, test) {
13 | test();
14 | }
15 |
16 | jasmineMethod.forEach(function() {
17 | jasmineArgs.push(loop);
18 | })
19 |
20 | function buildTestCode(test) {
21 | var strFn = test.toString(),
22 | code = strFn.substring(strFn.indexOf('{') + 1,strFn.lastIndexOf('}')),
23 | start, end, arg;
24 |
25 | if (test.length) {
26 | start = strFn.indexOf('(') + 1;
27 | end = strFn.indexOf(')');
28 | arg = strFn.substring(start,end) + '()';
29 | code = code.replace(arg+";","");
30 | code = code.replace(arg,"");
31 | }
32 | return formatCode(code);
33 | }
34 |
35 | function compile(mod, path, content) {
36 | var funArgs = ["describe", "it"].concat(jasmineMethod),
37 | fn;
38 |
39 | function it(name, fnUnit) {
40 | var code = fnUnit.toString();
41 | mod[name] = buildTestCode(code);
42 | }
43 |
44 | try {
45 | fn = new Function(funArgs, content);
46 | } catch (err) {
47 | console.log("jasmine demo解析失败:" + err);
48 | }
49 |
50 | fn.apply(null, [describe, it].concat(jasmineArgs));
51 | }
52 |
53 | exports.load = function(path, unit, fnGetFile, fnFormatCode) {
54 | var mod = jasmineModules[path];
55 | if (!mod) {
56 | formatCode = fnFormatCode;
57 | var content = fnGetFile(path);
58 | if (!content)
59 | return;
60 |
61 | mod = jasmineModules[path] = {};
62 | compile(mod, path, content);
63 | }
64 |
65 | return mod[unit];
66 | }
67 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smartdoc",
3 | "version": "0.1.1",
4 | "description": "Javascript Document & Demo builder (base on YUIDoc and bootstrap 3).",
5 | "homepage": "https://github.com/zhh77/smartDoc",
6 | "main": "smartDoc.js",
7 | "scripts": {
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": {
11 | "name": "Roy Zhang",
12 | "email": "zhh77_1999@163.com"
13 | },
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/zhh77/smartDoc.git"
17 | },
18 | "bugs": {
19 | "url": "https://github.com/zhh77/smartDoc/issues"
20 | },
21 | "license": "BSD",
22 | "dependencies": {
23 | "yuidocjs": "0.3.45",
24 | "express": "~3.1.2"
25 | },
26 | "devDependencies": {
27 | "jshint": "2.4.x"
28 | },
29 | "bin" : {
30 | "smartDoc": "./bin/smartDoc"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test.js:
--------------------------------------------------------------------------------
1 | var smartDoc = require('./smartDoc.js');
2 |
3 | smartDoc.build();
4 |
--------------------------------------------------------------------------------
/theme-smart/assets/code.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SmartJS - Demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
69 |
70 |
71 | Run
72 | Reset
73 | View In New Window
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | 编辑器操作模式同sublime;同时键入“Ctr + J”是智能感知;
94 | 使用expect方法可以将测试预期结果输出(使用接口大体与jasmine相同);例如:expect(result,'结果')
95 | 使用log可以打印结果;例如:log(result');
96 |
97 |
98 |
Result
99 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/comment/continuecomment.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | var modes = ["clike", "css", "javascript"];
13 |
14 | for (var i = 0; i < modes.length; ++i)
15 | CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
16 |
17 | function continueComment(cm) {
18 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
19 | var ranges = cm.listSelections(), mode, inserts = [];
20 | for (var i = 0; i < ranges.length; i++) {
21 | var pos = ranges[i].head, token = cm.getTokenAt(pos);
22 | if (token.type != "comment") return CodeMirror.Pass;
23 | var modeHere = CodeMirror.innerMode(cm.getMode(), token.state).mode;
24 | if (!mode) mode = modeHere;
25 | else if (mode != modeHere) return CodeMirror.Pass;
26 |
27 | var insert = null;
28 | if (mode.blockCommentStart && mode.blockCommentContinue) {
29 | var end = token.string.indexOf(mode.blockCommentEnd);
30 | var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
31 | if (end != -1 && end == token.string.length - mode.blockCommentEnd.length && pos.ch >= end) {
32 | // Comment ended, don't continue it
33 | } else if (token.string.indexOf(mode.blockCommentStart) == 0) {
34 | insert = full.slice(0, token.start);
35 | if (!/^\s*$/.test(insert)) {
36 | insert = "";
37 | for (var j = 0; j < token.start; ++j) insert += " ";
38 | }
39 | } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
40 | found + mode.blockCommentContinue.length > token.start &&
41 | /^\s*$/.test(full.slice(0, found))) {
42 | insert = full.slice(0, found);
43 | }
44 | if (insert != null) insert += mode.blockCommentContinue;
45 | }
46 | if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
47 | var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
48 | if (found > -1) {
49 | insert = line.slice(0, found);
50 | if (/\S/.test(insert)) insert = null;
51 | else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
52 | }
53 | }
54 | if (insert == null) return CodeMirror.Pass;
55 | inserts[i] = "\n" + insert;
56 | }
57 |
58 | cm.operation(function() {
59 | for (var i = ranges.length - 1; i >= 0; i--)
60 | cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
61 | });
62 | }
63 |
64 | function continueLineCommentEnabled(cm) {
65 | var opt = cm.getOption("continueComments");
66 | if (opt && typeof opt == "object")
67 | return opt.continueLineComment !== false;
68 | return true;
69 | }
70 |
71 | CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
72 | if (prev && prev != CodeMirror.Init)
73 | cm.removeKeyMap("continueComment");
74 | if (val) {
75 | var key = "Enter";
76 | if (typeof val == "string")
77 | key = val;
78 | else if (typeof val == "object" && val.key)
79 | key = val.key;
80 | var map = {name: "continueComment"};
81 | map[key] = continueComment;
82 | cm.addKeyMap(map);
83 | }
84 | });
85 | });
86 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/dialog/dialog.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-dialog {
2 | position: absolute;
3 | left: 0; right: 0;
4 | background: white;
5 | z-index: 15;
6 | padding: .1em .8em;
7 | overflow: hidden;
8 | color: #333;
9 | }
10 |
11 | .CodeMirror-dialog-top {
12 | border-bottom: 1px solid #eee;
13 | top: 0;
14 | }
15 |
16 | .CodeMirror-dialog-bottom {
17 | border-top: 1px solid #eee;
18 | bottom: 0;
19 | }
20 |
21 | .CodeMirror-dialog input {
22 | border: none;
23 | outline: none;
24 | background: transparent;
25 | width: 20em;
26 | color: inherit;
27 | font-family: monospace;
28 | }
29 |
30 | .CodeMirror-dialog button {
31 | font-size: 70%;
32 | }
33 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/dialog/dialog.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Open simple dialogs on top of an editor. Relies on dialog.css.
5 |
6 | (function(mod) {
7 | if (typeof exports == "object" && typeof module == "object") // CommonJS
8 | mod(require("../../lib/codemirror"));
9 | else if (typeof define == "function" && define.amd) // AMD
10 | define(["../../lib/codemirror"], mod);
11 | else // Plain browser env
12 | mod(CodeMirror);
13 | })(function(CodeMirror) {
14 | function dialogDiv(cm, template, bottom) {
15 | var wrap = cm.getWrapperElement();
16 | var dialog;
17 | dialog = wrap.appendChild(document.createElement("div"));
18 | if (bottom)
19 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
20 | else
21 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
22 |
23 | if (typeof template == "string") {
24 | dialog.innerHTML = template;
25 | } else { // Assuming it's a detached DOM element.
26 | dialog.appendChild(template);
27 | }
28 | return dialog;
29 | }
30 |
31 | function closeNotification(cm, newVal) {
32 | if (cm.state.currentNotificationClose)
33 | cm.state.currentNotificationClose();
34 | cm.state.currentNotificationClose = newVal;
35 | }
36 |
37 | CodeMirror.defineExtension("openDialog", function(template, callback, options) {
38 | if (!options) options = {};
39 |
40 | closeNotification(this, null);
41 |
42 | var dialog = dialogDiv(this, template, options.bottom);
43 | var closed = false, me = this;
44 | function close(newVal) {
45 | if (typeof newVal == 'string') {
46 | inp.value = newVal;
47 | } else {
48 | if (closed) return;
49 | closed = true;
50 | dialog.parentNode.removeChild(dialog);
51 | me.focus();
52 |
53 | if (options.onClose) options.onClose(dialog);
54 | }
55 | }
56 |
57 | var inp = dialog.getElementsByTagName("input")[0], button;
58 | if (inp) {
59 | if (options.value) inp.value = options.value;
60 |
61 | if (options.onInput)
62 | CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
63 | if (options.onKeyUp)
64 | CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
65 |
66 | CodeMirror.on(inp, "keydown", function(e) {
67 | if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
68 | if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
69 | inp.blur();
70 | CodeMirror.e_stop(e);
71 | close();
72 | }
73 | if (e.keyCode == 13) callback(inp.value);
74 | });
75 |
76 | if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);
77 |
78 | inp.focus();
79 | } else if (button = dialog.getElementsByTagName("button")[0]) {
80 | CodeMirror.on(button, "click", function() {
81 | close();
82 | me.focus();
83 | });
84 |
85 | if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);
86 |
87 | button.focus();
88 | }
89 | return close;
90 | });
91 |
92 | CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
93 | closeNotification(this, null);
94 | var dialog = dialogDiv(this, template, options && options.bottom);
95 | var buttons = dialog.getElementsByTagName("button");
96 | var closed = false, me = this, blurring = 1;
97 | function close() {
98 | if (closed) return;
99 | closed = true;
100 | dialog.parentNode.removeChild(dialog);
101 | me.focus();
102 | }
103 | buttons[0].focus();
104 | for (var i = 0; i < buttons.length; ++i) {
105 | var b = buttons[i];
106 | (function(callback) {
107 | CodeMirror.on(b, "click", function(e) {
108 | CodeMirror.e_preventDefault(e);
109 | close();
110 | if (callback) callback(me);
111 | });
112 | })(callbacks[i]);
113 | CodeMirror.on(b, "blur", function() {
114 | --blurring;
115 | setTimeout(function() { if (blurring <= 0) close(); }, 200);
116 | });
117 | CodeMirror.on(b, "focus", function() { ++blurring; });
118 | }
119 | });
120 |
121 | /*
122 | * openNotification
123 | * Opens a notification, that can be closed with an optional timer
124 | * (default 5000ms timer) and always closes on click.
125 | *
126 | * If a notification is opened while another is opened, it will close the
127 | * currently opened one and open the new one immediately.
128 | */
129 | CodeMirror.defineExtension("openNotification", function(template, options) {
130 | closeNotification(this, close);
131 | var dialog = dialogDiv(this, template, options && options.bottom);
132 | var duration = options && (options.duration === undefined ? 5000 : options.duration);
133 | var closed = false, doneTimer;
134 |
135 | function close() {
136 | if (closed) return;
137 | closed = true;
138 | clearTimeout(doneTimer);
139 | dialog.parentNode.removeChild(dialog);
140 | }
141 |
142 | CodeMirror.on(dialog, 'click', function(e) {
143 | CodeMirror.e_preventDefault(e);
144 | close();
145 | });
146 | if (duration)
147 | doneTimer = setTimeout(close, options.duration);
148 | });
149 | });
150 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/closebrackets.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | var DEFAULT_BRACKETS = "()[]{}''\"\"";
13 | var DEFAULT_EXPLODE_ON_ENTER = "[]{}";
14 | var SPACE_CHAR_REGEX = /\s/;
15 |
16 | var Pos = CodeMirror.Pos;
17 |
18 | CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
19 | if (old != CodeMirror.Init && old)
20 | cm.removeKeyMap("autoCloseBrackets");
21 | if (!val) return;
22 | var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER;
23 | if (typeof val == "string") pairs = val;
24 | else if (typeof val == "object") {
25 | if (val.pairs != null) pairs = val.pairs;
26 | if (val.explode != null) explode = val.explode;
27 | }
28 | var map = buildKeymap(pairs);
29 | if (explode) map.Enter = buildExplodeHandler(explode);
30 | cm.addKeyMap(map);
31 | });
32 |
33 | function charsAround(cm, pos) {
34 | var str = cm.getRange(Pos(pos.line, pos.ch - 1),
35 | Pos(pos.line, pos.ch + 1));
36 | return str.length == 2 ? str : null;
37 | }
38 |
39 | // Project the token type that will exists after the given char is
40 | // typed, and use it to determine whether it would cause the start
41 | // of a string token.
42 | function enteringString(cm, pos, ch) {
43 | var line = cm.getLine(pos.line);
44 | var token = cm.getTokenAt(pos);
45 | if (/\bstring2?\b/.test(token.type)) return false;
46 | var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
47 | stream.pos = stream.start = token.start;
48 | for (;;) {
49 | var type1 = cm.getMode().token(stream, token.state);
50 | if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
51 | stream.start = stream.pos;
52 | }
53 | }
54 |
55 | function buildKeymap(pairs) {
56 | var map = {
57 | name : "autoCloseBrackets",
58 | Backspace: function(cm) {
59 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
60 | var ranges = cm.listSelections();
61 | for (var i = 0; i < ranges.length; i++) {
62 | if (!ranges[i].empty()) return CodeMirror.Pass;
63 | var around = charsAround(cm, ranges[i].head);
64 | if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
65 | }
66 | for (var i = ranges.length - 1; i >= 0; i--) {
67 | var cur = ranges[i].head;
68 | cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
69 | }
70 | }
71 | };
72 | var closingBrackets = "";
73 | for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
74 | if (left != right) closingBrackets += right;
75 | map["'" + left + "'"] = function(cm) {
76 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
77 | var ranges = cm.listSelections(), type, next;
78 | for (var i = 0; i < ranges.length; i++) {
79 | var range = ranges[i], cur = range.head, curType;
80 | var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
81 | if (!range.empty())
82 | curType = "surround";
83 | else if (left == right && next == right) {
84 | if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left)
85 | curType = "skipThree";
86 | else
87 | curType = "skip";
88 | } else if (left == right && cur.ch > 1 &&
89 | cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left &&
90 | (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left))
91 | curType = "addFour";
92 | else if (left == '"' || left == "'") {
93 | if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both";
94 | else return CodeMirror.Pass;
95 | } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next))
96 | curType = "both";
97 | else
98 | return CodeMirror.Pass;
99 | if (!type) type = curType;
100 | else if (type != curType) return CodeMirror.Pass;
101 | }
102 |
103 | cm.operation(function() {
104 | if (type == "skip") {
105 | cm.execCommand("goCharRight");
106 | } else if (type == "skipThree") {
107 | for (var i = 0; i < 3; i++)
108 | cm.execCommand("goCharRight");
109 | } else if (type == "surround") {
110 | var sels = cm.getSelections();
111 | for (var i = 0; i < sels.length; i++)
112 | sels[i] = left + sels[i] + right;
113 | cm.replaceSelections(sels, "around");
114 | } else if (type == "both") {
115 | cm.replaceSelection(left + right, null);
116 | cm.execCommand("goCharLeft");
117 | } else if (type == "addFour") {
118 | cm.replaceSelection(left + left + left + left, "before");
119 | cm.execCommand("goCharRight");
120 | }
121 | });
122 | };
123 | if (left != right) map["'" + right + "'"] = function(cm) {
124 | var ranges = cm.listSelections();
125 | for (var i = 0; i < ranges.length; i++) {
126 | var range = ranges[i];
127 | if (!range.empty() ||
128 | cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right)
129 | return CodeMirror.Pass;
130 | }
131 | cm.execCommand("goCharRight");
132 | };
133 | })(pairs.charAt(i), pairs.charAt(i + 1));
134 | return map;
135 | }
136 |
137 | function buildExplodeHandler(pairs) {
138 | return function(cm) {
139 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
140 | var ranges = cm.listSelections();
141 | for (var i = 0; i < ranges.length; i++) {
142 | if (!ranges[i].empty()) return CodeMirror.Pass;
143 | var around = charsAround(cm, ranges[i].head);
144 | if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
145 | }
146 | cm.operation(function() {
147 | cm.replaceSelection("\n\n", null);
148 | cm.execCommand("goCharLeft");
149 | ranges = cm.listSelections();
150 | for (var i = 0; i < ranges.length; i++) {
151 | var line = ranges[i].head.line;
152 | cm.indentLine(line, null, true);
153 | cm.indentLine(line + 1, null, true);
154 | }
155 | });
156 | };
157 | }
158 | });
159 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/closetag.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | /**
5 | * Tag-closer extension for CodeMirror.
6 | *
7 | * This extension adds an "autoCloseTags" option that can be set to
8 | * either true to get the default behavior, or an object to further
9 | * configure its behavior.
10 | *
11 | * These are supported options:
12 | *
13 | * `whenClosing` (default true)
14 | * Whether to autoclose when the '/' of a closing tag is typed.
15 | * `whenOpening` (default true)
16 | * Whether to autoclose the tag when the final '>' of an opening
17 | * tag is typed.
18 | * `dontCloseTags` (default is empty tags for HTML, none for XML)
19 | * An array of tag names that should not be autoclosed.
20 | * `indentTags` (default is block tags for HTML, none for XML)
21 | * An array of tag names that should, when opened, cause a
22 | * blank line to be added inside the tag, and the blank line and
23 | * closing line to be indented.
24 | *
25 | * See demos/closetag.html for a usage example.
26 | */
27 |
28 | (function(mod) {
29 | if (typeof exports == "object" && typeof module == "object") // CommonJS
30 | mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
31 | else if (typeof define == "function" && define.amd) // AMD
32 | define(["../../lib/codemirror", "../fold/xml-fold"], mod);
33 | else // Plain browser env
34 | mod(CodeMirror);
35 | })(function(CodeMirror) {
36 | CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
37 | if (old != CodeMirror.Init && old)
38 | cm.removeKeyMap("autoCloseTags");
39 | if (!val) return;
40 | var map = {name: "autoCloseTags"};
41 | if (typeof val != "object" || val.whenClosing)
42 | map["'/'"] = function(cm) { return autoCloseSlash(cm); };
43 | if (typeof val != "object" || val.whenOpening)
44 | map["'>'"] = function(cm) { return autoCloseGT(cm); };
45 | cm.addKeyMap(map);
46 | });
47 |
48 | var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
49 | "source", "track", "wbr"];
50 | var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
51 | "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
52 |
53 | function autoCloseGT(cm) {
54 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
55 | var ranges = cm.listSelections(), replacements = [];
56 | for (var i = 0; i < ranges.length; i++) {
57 | if (!ranges[i].empty()) return CodeMirror.Pass;
58 | var pos = ranges[i].head, tok = cm.getTokenAt(pos);
59 | var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
60 | if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;
61 |
62 | var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
63 | var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
64 | var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
65 |
66 | var tagName = state.tagName;
67 | if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
68 | var lowerTagName = tagName.toLowerCase();
69 | // Don't process the '>' at the end of an end-tag or self-closing tag
70 | if (!tagName ||
71 | tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
72 | tok.type == "tag" && state.type == "closeTag" ||
73 | tok.string.indexOf("/") == (tok.string.length - 1) || // match something like
74 | dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
75 | closingTagExists(cm, tagName, pos, state, true))
76 | return CodeMirror.Pass;
77 |
78 | var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
79 | replacements[i] = {indent: indent,
80 | text: ">" + (indent ? "\n\n" : "") + "" + tagName + ">",
81 | newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
82 | }
83 |
84 | for (var i = ranges.length - 1; i >= 0; i--) {
85 | var info = replacements[i];
86 | cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
87 | var sel = cm.listSelections().slice(0);
88 | sel[i] = {head: info.newPos, anchor: info.newPos};
89 | cm.setSelections(sel);
90 | if (info.indent) {
91 | cm.indentLine(info.newPos.line, null, true);
92 | cm.indentLine(info.newPos.line + 1, null, true);
93 | }
94 | }
95 | }
96 |
97 | function autoCloseSlash(cm) {
98 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
99 | var ranges = cm.listSelections(), replacements = [];
100 | for (var i = 0; i < ranges.length; i++) {
101 | if (!ranges[i].empty()) return CodeMirror.Pass;
102 | var pos = ranges[i].head, tok = cm.getTokenAt(pos);
103 | var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
104 | if (tok.type == "string" || tok.string.charAt(0) != "<" ||
105 | tok.start != pos.ch - 1 || inner.mode.name != "xml" ||
106 | !state.context || !state.context.tagName ||
107 | closingTagExists(cm, state.context.tagName, pos, state))
108 | return CodeMirror.Pass;
109 | replacements[i] = "/" + state.context.tagName + ">";
110 | }
111 | cm.replaceSelections(replacements);
112 | ranges = cm.listSelections();
113 | for (var i = 0; i < ranges.length; i++)
114 | if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
115 | cm.indentLine(ranges[i].head.line);
116 | }
117 |
118 | function indexOf(collection, elt) {
119 | if (collection.indexOf) return collection.indexOf(elt);
120 | for (var i = 0, e = collection.length; i < e; ++i)
121 | if (collection[i] == elt) return i;
122 | return -1;
123 | }
124 |
125 | // If xml-fold is loaded, we use its functionality to try and verify
126 | // whether a given tag is actually unclosed.
127 | function closingTagExists(cm, tagName, pos, state, newTag) {
128 | if (!CodeMirror.scanForClosingTag) return false;
129 | var end = Math.min(cm.lastLine() + 1, pos.line + 500);
130 | var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
131 | if (!nextClose || nextClose.tag != tagName) return false;
132 | var cx = state.context;
133 | // If the immediate wrapping context contains onCx instances of
134 | // the same tag, a closing tag only exists if there are at least
135 | // that many closing tags of that type following.
136 | for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;
137 | pos = nextClose.to;
138 | for (var i = 1; i < onCx; i++) {
139 | var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
140 | if (!next || next.tag != tagName) return false;
141 | pos = next.to;
142 | }
143 | return true;
144 | }
145 | });
146 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/continuelist.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var listRE = /^(\s*)([*+-]|(\d+)\.)(\s+)/,
15 | unorderedBullets = "*+-";
16 |
17 | CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
18 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
19 | var ranges = cm.listSelections(), replacements = [];
20 | for (var i = 0; i < ranges.length; i++) {
21 | var pos = ranges[i].head, match;
22 | var inList = cm.getStateAfter(pos.line).list !== false;
23 |
24 | if (!ranges[i].empty() || !inList || !(match = cm.getLine(pos.line).match(listRE))) {
25 | cm.execCommand("newlineAndIndent");
26 | return;
27 | }
28 | var indent = match[1], after = match[4];
29 | var bullet = unorderedBullets.indexOf(match[2]) >= 0
30 | ? match[2]
31 | : (parseInt(match[3], 10) + 1) + ".";
32 |
33 | replacements[i] = "\n" + indent + bullet + after;
34 | }
35 |
36 | cm.replaceSelections(replacements);
37 | };
38 | });
39 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/matchbrackets.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
13 | (document.documentMode == null || document.documentMode < 8);
14 |
15 | var Pos = CodeMirror.Pos;
16 |
17 | var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
18 |
19 | function findMatchingBracket(cm, where, strict, config) {
20 | var line = cm.getLineHandle(where.line), pos = where.ch - 1;
21 | var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
22 | if (!match) return null;
23 | var dir = match.charAt(1) == ">" ? 1 : -1;
24 | if (strict && (dir > 0) != (pos == where.ch)) return null;
25 | var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
26 |
27 | var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
28 | if (found == null) return null;
29 | return {from: Pos(where.line, pos), to: found && found.pos,
30 | match: found && found.ch == match.charAt(0), forward: dir > 0};
31 | }
32 |
33 | // bracketRegex is used to specify which type of bracket to scan
34 | // should be a regexp, e.g. /[[\]]/
35 | //
36 | // Note: If "where" is on an open bracket, then this bracket is ignored.
37 | //
38 | // Returns false when no bracket was found, null when it reached
39 | // maxScanLines and gave up
40 | function scanForBracket(cm, where, dir, style, config) {
41 | var maxScanLen = (config && config.maxScanLineLength) || 10000;
42 | var maxScanLines = (config && config.maxScanLines) || 1000;
43 |
44 | var stack = [];
45 | var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
46 | var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
47 | : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
48 | for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
49 | var line = cm.getLine(lineNo);
50 | if (!line) continue;
51 | var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
52 | if (line.length > maxScanLen) continue;
53 | if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
54 | for (; pos != end; pos += dir) {
55 | var ch = line.charAt(pos);
56 | if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
57 | var match = matching[ch];
58 | if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
59 | else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
60 | else stack.pop();
61 | }
62 | }
63 | }
64 | return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
65 | }
66 |
67 | function matchBrackets(cm, autoclear, config) {
68 | // Disable brace matching in long lines, since it'll cause hugely slow updates
69 | var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
70 | var marks = [], ranges = cm.listSelections();
71 | for (var i = 0; i < ranges.length; i++) {
72 | var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config);
73 | if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
74 | var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
75 | marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
76 | if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
77 | marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
78 | }
79 | }
80 |
81 | if (marks.length) {
82 | // Kludge to work around the IE bug from issue #1193, where text
83 | // input stops going to the textare whever this fires.
84 | if (ie_lt8 && cm.state.focused) cm.display.input.focus();
85 |
86 | var clear = function() {
87 | cm.operation(function() {
88 | for (var i = 0; i < marks.length; i++) marks[i].clear();
89 | });
90 | };
91 | if (autoclear) setTimeout(clear, 800);
92 | else return clear;
93 | }
94 | }
95 |
96 | var currentlyHighlighted = null;
97 | function doMatchBrackets(cm) {
98 | cm.operation(function() {
99 | if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
100 | currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
101 | });
102 | }
103 |
104 | CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
105 | if (old && old != CodeMirror.Init)
106 | cm.off("cursorActivity", doMatchBrackets);
107 | if (val) {
108 | cm.state.matchBrackets = typeof val == "object" ? val : {};
109 | cm.on("cursorActivity", doMatchBrackets);
110 | }
111 | });
112 |
113 | CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
114 | CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){
115 | return findMatchingBracket(this, pos, strict, config);
116 | });
117 | CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
118 | return scanForBracket(this, pos, dir, style, config);
119 | });
120 | });
121 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/matchtags.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../fold/xml-fold"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
15 | if (old && old != CodeMirror.Init) {
16 | cm.off("cursorActivity", doMatchTags);
17 | cm.off("viewportChange", maybeUpdateMatch);
18 | clear(cm);
19 | }
20 | if (val) {
21 | cm.state.matchBothTags = typeof val == "object" && val.bothTags;
22 | cm.on("cursorActivity", doMatchTags);
23 | cm.on("viewportChange", maybeUpdateMatch);
24 | doMatchTags(cm);
25 | }
26 | });
27 |
28 | function clear(cm) {
29 | if (cm.state.tagHit) cm.state.tagHit.clear();
30 | if (cm.state.tagOther) cm.state.tagOther.clear();
31 | cm.state.tagHit = cm.state.tagOther = null;
32 | }
33 |
34 | function doMatchTags(cm) {
35 | cm.state.failedTagMatch = false;
36 | cm.operation(function() {
37 | clear(cm);
38 | if (cm.somethingSelected()) return;
39 | var cur = cm.getCursor(), range = cm.getViewport();
40 | range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
41 | var match = CodeMirror.findMatchingTag(cm, cur, range);
42 | if (!match) return;
43 | if (cm.state.matchBothTags) {
44 | var hit = match.at == "open" ? match.open : match.close;
45 | if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
46 | }
47 | var other = match.at == "close" ? match.open : match.close;
48 | if (other)
49 | cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
50 | else
51 | cm.state.failedTagMatch = true;
52 | });
53 | }
54 |
55 | function maybeUpdateMatch(cm) {
56 | if (cm.state.failedTagMatch) doMatchTags(cm);
57 | }
58 |
59 | CodeMirror.commands.toMatchingTag = function(cm) {
60 | var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
61 | if (found) {
62 | var other = found.at == "close" ? found.open : found.close;
63 | if (other) cm.extendSelection(other.to, other.from);
64 | }
65 | };
66 | });
67 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/edit/trailingspace.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
13 | if (prev == CodeMirror.Init) prev = false;
14 | if (prev && !val)
15 | cm.removeOverlay("trailingspace");
16 | else if (!prev && val)
17 | cm.addOverlay({
18 | token: function(stream) {
19 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
20 | if (i > stream.pos) { stream.pos = i; return null; }
21 | stream.pos = l;
22 | return "trailingspace";
23 | },
24 | name: "trailingspace"
25 | });
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/brace-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerHelper("fold", "brace", function(cm, start) {
15 | var line = start.line, lineText = cm.getLine(line);
16 | var startCh, tokenType;
17 |
18 | function findOpening(openCh) {
19 | for (var at = start.ch, pass = 0;;) {
20 | var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
21 | if (found == -1) {
22 | if (pass == 1) break;
23 | pass = 1;
24 | at = lineText.length;
25 | continue;
26 | }
27 | if (pass == 1 && found < start.ch) break;
28 | tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
29 | if (!/^(comment|string)/.test(tokenType)) return found + 1;
30 | at = found - 1;
31 | }
32 | }
33 |
34 | var startToken = "{", endToken = "}", startCh = findOpening("{");
35 | if (startCh == null) {
36 | startToken = "[", endToken = "]";
37 | startCh = findOpening("[");
38 | }
39 |
40 | if (startCh == null) return;
41 | var count = 1, lastLine = cm.lastLine(), end, endCh;
42 | outer: for (var i = line; i <= lastLine; ++i) {
43 | var text = cm.getLine(i), pos = i == line ? startCh : 0;
44 | for (;;) {
45 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
46 | if (nextOpen < 0) nextOpen = text.length;
47 | if (nextClose < 0) nextClose = text.length;
48 | pos = Math.min(nextOpen, nextClose);
49 | if (pos == text.length) break;
50 | if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) {
51 | if (pos == nextOpen) ++count;
52 | else if (!--count) { end = i; endCh = pos; break outer; }
53 | }
54 | ++pos;
55 | }
56 | }
57 | if (end == null || line == end && endCh == startCh) return;
58 | return {from: CodeMirror.Pos(line, startCh),
59 | to: CodeMirror.Pos(end, endCh)};
60 | });
61 |
62 | CodeMirror.registerHelper("fold", "import", function(cm, start) {
63 | function hasImport(line) {
64 | if (line < cm.firstLine() || line > cm.lastLine()) return null;
65 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
66 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
67 | if (start.type != "keyword" || start.string != "import") return null;
68 | // Now find closing semicolon, return its position
69 | for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
70 | var text = cm.getLine(i), semi = text.indexOf(";");
71 | if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
72 | }
73 | }
74 |
75 | var start = start.line, has = hasImport(start), prev;
76 | if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1))
77 | return null;
78 | for (var end = has.end;;) {
79 | var next = hasImport(end.line + 1);
80 | if (next == null) break;
81 | end = next.end;
82 | }
83 | return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end};
84 | });
85 |
86 | CodeMirror.registerHelper("fold", "include", function(cm, start) {
87 | function hasInclude(line) {
88 | if (line < cm.firstLine() || line > cm.lastLine()) return null;
89 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
90 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
91 | if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
92 | }
93 |
94 | var start = start.line, has = hasInclude(start);
95 | if (has == null || hasInclude(start - 1) != null) return null;
96 | for (var end = start;;) {
97 | var next = hasInclude(end + 1);
98 | if (next == null) break;
99 | ++end;
100 | }
101 | return {from: CodeMirror.Pos(start, has + 1),
102 | to: cm.clipPos(CodeMirror.Pos(end))};
103 | });
104 |
105 | });
106 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/comment-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
15 | return mode.blockCommentStart && mode.blockCommentEnd;
16 | }, function(cm, start) {
17 | var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
18 | if (!startToken || !endToken) return;
19 | var line = start.line, lineText = cm.getLine(line);
20 |
21 | var startCh;
22 | for (var at = start.ch, pass = 0;;) {
23 | var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
24 | if (found == -1) {
25 | if (pass == 1) return;
26 | pass = 1;
27 | at = lineText.length;
28 | continue;
29 | }
30 | if (pass == 1 && found < start.ch) return;
31 | if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {
32 | startCh = found + startToken.length;
33 | break;
34 | }
35 | at = found - 1;
36 | }
37 |
38 | var depth = 1, lastLine = cm.lastLine(), end, endCh;
39 | outer: for (var i = line; i <= lastLine; ++i) {
40 | var text = cm.getLine(i), pos = i == line ? startCh : 0;
41 | for (;;) {
42 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
43 | if (nextOpen < 0) nextOpen = text.length;
44 | if (nextClose < 0) nextClose = text.length;
45 | pos = Math.min(nextOpen, nextClose);
46 | if (pos == text.length) break;
47 | if (pos == nextOpen) ++depth;
48 | else if (!--depth) { end = i; endCh = pos; break outer; }
49 | ++pos;
50 | }
51 | }
52 | if (end == null || line == end && endCh == startCh) return;
53 | return {from: CodeMirror.Pos(line, startCh),
54 | to: CodeMirror.Pos(end, endCh)};
55 | });
56 |
57 | });
58 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/foldcode.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | function doFold(cm, pos, options, force) {
15 | if (options && options.call) {
16 | var finder = options;
17 | options = null;
18 | } else {
19 | var finder = getOption(cm, options, "rangeFinder");
20 | }
21 | if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
22 | var minSize = getOption(cm, options, "minFoldSize");
23 |
24 | function getRange(allowFolded) {
25 | var range = finder(cm, pos);
26 | if (!range || range.to.line - range.from.line < minSize) return null;
27 | var marks = cm.findMarksAt(range.from);
28 | for (var i = 0; i < marks.length; ++i) {
29 | if (marks[i].__isFold && force !== "fold") {
30 | if (!allowFolded) return null;
31 | range.cleared = true;
32 | marks[i].clear();
33 | }
34 | }
35 | return range;
36 | }
37 |
38 | var range = getRange(true);
39 | if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
40 | pos = CodeMirror.Pos(pos.line - 1, 0);
41 | range = getRange(false);
42 | }
43 | if (!range || range.cleared || force === "unfold") return;
44 |
45 | var myWidget = makeWidget(cm, options);
46 | CodeMirror.on(myWidget, "mousedown", function(e) {
47 | myRange.clear();
48 | CodeMirror.e_preventDefault(e);
49 | });
50 | var myRange = cm.markText(range.from, range.to, {
51 | replacedWith: myWidget,
52 | clearOnEnter: true,
53 | __isFold: true
54 | });
55 | myRange.on("clear", function(from, to) {
56 | CodeMirror.signal(cm, "unfold", cm, from, to);
57 | });
58 | CodeMirror.signal(cm, "fold", cm, range.from, range.to);
59 | }
60 |
61 | function makeWidget(cm, options) {
62 | var widget = getOption(cm, options, "widget");
63 | if (typeof widget == "string") {
64 | var text = document.createTextNode(widget);
65 | widget = document.createElement("span");
66 | widget.appendChild(text);
67 | widget.className = "CodeMirror-foldmarker";
68 | }
69 | return widget;
70 | }
71 |
72 | // Clumsy backwards-compatible interface
73 | CodeMirror.newFoldFunction = function(rangeFinder, widget) {
74 | return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
75 | };
76 |
77 | // New-style interface
78 | CodeMirror.defineExtension("foldCode", function(pos, options, force) {
79 | doFold(this, pos, options, force);
80 | });
81 |
82 | CodeMirror.defineExtension("isFolded", function(pos) {
83 | var marks = this.findMarksAt(pos);
84 | for (var i = 0; i < marks.length; ++i)
85 | if (marks[i].__isFold) return true;
86 | });
87 |
88 | CodeMirror.commands.toggleFold = function(cm) {
89 | cm.foldCode(cm.getCursor());
90 | };
91 | CodeMirror.commands.fold = function(cm) {
92 | cm.foldCode(cm.getCursor(), null, "fold");
93 | };
94 | CodeMirror.commands.unfold = function(cm) {
95 | cm.foldCode(cm.getCursor(), null, "unfold");
96 | };
97 | CodeMirror.commands.foldAll = function(cm) {
98 | cm.operation(function() {
99 | for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
100 | cm.foldCode(CodeMirror.Pos(i, 0), null, "fold");
101 | });
102 | };
103 | CodeMirror.commands.unfoldAll = function(cm) {
104 | cm.operation(function() {
105 | for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
106 | cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold");
107 | });
108 | };
109 |
110 | CodeMirror.registerHelper("fold", "combine", function() {
111 | var funcs = Array.prototype.slice.call(arguments, 0);
112 | return function(cm, start) {
113 | for (var i = 0; i < funcs.length; ++i) {
114 | var found = funcs[i](cm, start);
115 | if (found) return found;
116 | }
117 | };
118 | });
119 |
120 | CodeMirror.registerHelper("fold", "auto", function(cm, start) {
121 | var helpers = cm.getHelpers(start, "fold");
122 | for (var i = 0; i < helpers.length; i++) {
123 | var cur = helpers[i](cm, start);
124 | if (cur) return cur;
125 | }
126 | });
127 |
128 | var defaultOptions = {
129 | rangeFinder: CodeMirror.fold.auto,
130 | widget: "\u2194",
131 | minFoldSize: 0,
132 | scanUp: false
133 | };
134 |
135 | CodeMirror.defineOption("foldOptions", null);
136 |
137 | function getOption(cm, options, name) {
138 | if (options && options[name] !== undefined)
139 | return options[name];
140 | var editorOptions = cm.options.foldOptions;
141 | if (editorOptions && editorOptions[name] !== undefined)
142 | return editorOptions[name];
143 | return defaultOptions[name];
144 | }
145 | });
146 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/foldgutter.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-foldmarker {
2 | color: blue;
3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
4 | font-family: arial;
5 | line-height: .3;
6 | cursor: pointer;
7 | }
8 | .CodeMirror-foldgutter {
9 | width: .7em;
10 | }
11 | .CodeMirror-foldgutter-open,
12 | .CodeMirror-foldgutter-folded {
13 | cursor: pointer;
14 | }
15 | .CodeMirror-foldgutter-open:after {
16 | content: "\25BE";
17 | }
18 | .CodeMirror-foldgutter-folded:after {
19 | content: "\25B8";
20 | }
21 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/foldgutter.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("./foldcode"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "./foldcode"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
15 | if (old && old != CodeMirror.Init) {
16 | cm.clearGutter(cm.state.foldGutter.options.gutter);
17 | cm.state.foldGutter = null;
18 | cm.off("gutterClick", onGutterClick);
19 | cm.off("change", onChange);
20 | cm.off("viewportChange", onViewportChange);
21 | cm.off("fold", onFold);
22 | cm.off("unfold", onFold);
23 | cm.off("swapDoc", updateInViewport);
24 | }
25 | if (val) {
26 | cm.state.foldGutter = new State(parseOptions(val));
27 | updateInViewport(cm);
28 | cm.on("gutterClick", onGutterClick);
29 | cm.on("change", onChange);
30 | cm.on("viewportChange", onViewportChange);
31 | cm.on("fold", onFold);
32 | cm.on("unfold", onFold);
33 | cm.on("swapDoc", updateInViewport);
34 | }
35 | });
36 |
37 | var Pos = CodeMirror.Pos;
38 |
39 | function State(options) {
40 | this.options = options;
41 | this.from = this.to = 0;
42 | }
43 |
44 | function parseOptions(opts) {
45 | if (opts === true) opts = {};
46 | if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
47 | if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
48 | if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
49 | return opts;
50 | }
51 |
52 | function isFolded(cm, line) {
53 | var marks = cm.findMarksAt(Pos(line));
54 | for (var i = 0; i < marks.length; ++i)
55 | if (marks[i].__isFold && marks[i].find().from.line == line) return true;
56 | }
57 |
58 | function marker(spec) {
59 | if (typeof spec == "string") {
60 | var elt = document.createElement("div");
61 | elt.className = spec + " CodeMirror-guttermarker-subtle";
62 | return elt;
63 | } else {
64 | return spec.cloneNode(true);
65 | }
66 | }
67 |
68 | function updateFoldInfo(cm, from, to) {
69 | var opts = cm.state.foldGutter.options, cur = from;
70 | cm.eachLine(from, to, function(line) {
71 | var mark = null;
72 | if (isFolded(cm, cur)) {
73 | mark = marker(opts.indicatorFolded);
74 | } else {
75 | var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto;
76 | var range = func && func(cm, pos);
77 | if (range && range.from.line + 1 < range.to.line)
78 | mark = marker(opts.indicatorOpen);
79 | }
80 | cm.setGutterMarker(line, opts.gutter, mark);
81 | ++cur;
82 | });
83 | }
84 |
85 | function updateInViewport(cm) {
86 | var vp = cm.getViewport(), state = cm.state.foldGutter;
87 | if (!state) return;
88 | cm.operation(function() {
89 | updateFoldInfo(cm, vp.from, vp.to);
90 | });
91 | state.from = vp.from; state.to = vp.to;
92 | }
93 |
94 | function onGutterClick(cm, line, gutter) {
95 | var opts = cm.state.foldGutter.options;
96 | if (gutter != opts.gutter) return;
97 | cm.foldCode(Pos(line, 0), opts.rangeFinder);
98 | }
99 |
100 | function onChange(cm) {
101 | var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;
102 | state.from = state.to = 0;
103 | clearTimeout(state.changeUpdate);
104 | state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
105 | }
106 |
107 | function onViewportChange(cm) {
108 | var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;
109 | clearTimeout(state.changeUpdate);
110 | state.changeUpdate = setTimeout(function() {
111 | var vp = cm.getViewport();
112 | if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
113 | updateInViewport(cm);
114 | } else {
115 | cm.operation(function() {
116 | if (vp.from < state.from) {
117 | updateFoldInfo(cm, vp.from, state.from);
118 | state.from = vp.from;
119 | }
120 | if (vp.to > state.to) {
121 | updateFoldInfo(cm, state.to, vp.to);
122 | state.to = vp.to;
123 | }
124 | });
125 | }
126 | }, opts.updateViewportTimeSpan || 400);
127 | }
128 |
129 | function onFold(cm, from) {
130 | var state = cm.state.foldGutter, line = from.line;
131 | if (line >= state.from && line < state.to)
132 | updateFoldInfo(cm, line, line + 1);
133 | }
134 | });
135 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/indent-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerHelper("fold", "indent", function(cm, start) {
15 | var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
16 | if (!/\S/.test(firstLine)) return;
17 | var getIndent = function(line) {
18 | return CodeMirror.countColumn(line, null, tabSize);
19 | };
20 | var myIndent = getIndent(firstLine);
21 | var lastLineInFold = null;
22 | // Go through lines until we find a line that definitely doesn't belong in
23 | // the block we're folding, or to the end.
24 | for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
25 | var curLine = cm.getLine(i);
26 | var curIndent = getIndent(curLine);
27 | if (curIndent > myIndent) {
28 | // Lines with a greater indent are considered part of the block.
29 | lastLineInFold = i;
30 | } else if (!/\S/.test(curLine)) {
31 | // Empty lines might be breaks within the block we're trying to fold.
32 | } else {
33 | // A non-empty line at an indent equal to or less than ours marks the
34 | // start of another block.
35 | break;
36 | }
37 | }
38 | if (lastLineInFold) return {
39 | from: CodeMirror.Pos(start.line, firstLine.length),
40 | to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
41 | };
42 | });
43 |
44 | });
45 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/markdown-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerHelper("fold", "markdown", function(cm, start) {
15 | var maxDepth = 100;
16 |
17 | function isHeader(lineNo) {
18 | var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
19 | return tokentype && /\bheader\b/.test(tokentype);
20 | }
21 |
22 | function headerLevel(lineNo, line, nextLine) {
23 | var match = line && line.match(/^#+/);
24 | if (match && isHeader(lineNo)) return match[0].length;
25 | match = nextLine && nextLine.match(/^[=\-]+\s*$/);
26 | if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
27 | return maxDepth;
28 | }
29 |
30 | var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
31 | var level = headerLevel(start.line, firstLine, nextLine);
32 | if (level === maxDepth) return undefined;
33 |
34 | var lastLineNo = cm.lastLine();
35 | var end = start.line, nextNextLine = cm.getLine(end + 2);
36 | while (end < lastLineNo) {
37 | if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
38 | ++end;
39 | nextLine = nextNextLine;
40 | nextNextLine = cm.getLine(end + 2);
41 | }
42 |
43 | return {
44 | from: CodeMirror.Pos(start.line, firstLine.length),
45 | to: CodeMirror.Pos(end, cm.getLine(end).length)
46 | };
47 | });
48 |
49 | });
50 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/fold/xml-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var Pos = CodeMirror.Pos;
15 | function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }
16 |
17 | var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
18 | var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
19 | var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
20 |
21 | function Iter(cm, line, ch, range) {
22 | this.line = line; this.ch = ch;
23 | this.cm = cm; this.text = cm.getLine(line);
24 | this.min = range ? range.from : cm.firstLine();
25 | this.max = range ? range.to - 1 : cm.lastLine();
26 | }
27 |
28 | function tagAt(iter, ch) {
29 | var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));
30 | return type && /\btag\b/.test(type);
31 | }
32 |
33 | function nextLine(iter) {
34 | if (iter.line >= iter.max) return;
35 | iter.ch = 0;
36 | iter.text = iter.cm.getLine(++iter.line);
37 | return true;
38 | }
39 | function prevLine(iter) {
40 | if (iter.line <= iter.min) return;
41 | iter.text = iter.cm.getLine(--iter.line);
42 | iter.ch = iter.text.length;
43 | return true;
44 | }
45 |
46 | function toTagEnd(iter) {
47 | for (;;) {
48 | var gt = iter.text.indexOf(">", iter.ch);
49 | if (gt == -1) { if (nextLine(iter)) continue; else return; }
50 | if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }
51 | var lastSlash = iter.text.lastIndexOf("/", gt);
52 | var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
53 | iter.ch = gt + 1;
54 | return selfClose ? "selfClose" : "regular";
55 | }
56 | }
57 | function toTagStart(iter) {
58 | for (;;) {
59 | var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1;
60 | if (lt == -1) { if (prevLine(iter)) continue; else return; }
61 | if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }
62 | xmlTagStart.lastIndex = lt;
63 | iter.ch = lt;
64 | var match = xmlTagStart.exec(iter.text);
65 | if (match && match.index == lt) return match;
66 | }
67 | }
68 |
69 | function toNextTag(iter) {
70 | for (;;) {
71 | xmlTagStart.lastIndex = iter.ch;
72 | var found = xmlTagStart.exec(iter.text);
73 | if (!found) { if (nextLine(iter)) continue; else return; }
74 | if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }
75 | iter.ch = found.index + found[0].length;
76 | return found;
77 | }
78 | }
79 | function toPrevTag(iter) {
80 | for (;;) {
81 | var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1;
82 | if (gt == -1) { if (prevLine(iter)) continue; else return; }
83 | if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }
84 | var lastSlash = iter.text.lastIndexOf("/", gt);
85 | var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
86 | iter.ch = gt + 1;
87 | return selfClose ? "selfClose" : "regular";
88 | }
89 | }
90 |
91 | function findMatchingClose(iter, tag) {
92 | var stack = [];
93 | for (;;) {
94 | var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);
95 | if (!next || !(end = toTagEnd(iter))) return;
96 | if (end == "selfClose") continue;
97 | if (next[1]) { // closing tag
98 | for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
99 | stack.length = i;
100 | break;
101 | }
102 | if (i < 0 && (!tag || tag == next[2])) return {
103 | tag: next[2],
104 | from: Pos(startLine, startCh),
105 | to: Pos(iter.line, iter.ch)
106 | };
107 | } else { // opening tag
108 | stack.push(next[2]);
109 | }
110 | }
111 | }
112 | function findMatchingOpen(iter, tag) {
113 | var stack = [];
114 | for (;;) {
115 | var prev = toPrevTag(iter);
116 | if (!prev) return;
117 | if (prev == "selfClose") { toTagStart(iter); continue; }
118 | var endLine = iter.line, endCh = iter.ch;
119 | var start = toTagStart(iter);
120 | if (!start) return;
121 | if (start[1]) { // closing tag
122 | stack.push(start[2]);
123 | } else { // opening tag
124 | for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {
125 | stack.length = i;
126 | break;
127 | }
128 | if (i < 0 && (!tag || tag == start[2])) return {
129 | tag: start[2],
130 | from: Pos(iter.line, iter.ch),
131 | to: Pos(endLine, endCh)
132 | };
133 | }
134 | }
135 | }
136 |
137 | CodeMirror.registerHelper("fold", "xml", function(cm, start) {
138 | var iter = new Iter(cm, start.line, 0);
139 | for (;;) {
140 | var openTag = toNextTag(iter), end;
141 | if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return;
142 | if (!openTag[1] && end != "selfClose") {
143 | var start = Pos(iter.line, iter.ch);
144 | var close = findMatchingClose(iter, openTag[2]);
145 | return close && {from: start, to: close.from};
146 | }
147 | }
148 | });
149 | CodeMirror.findMatchingTag = function(cm, pos, range) {
150 | var iter = new Iter(cm, pos.line, pos.ch, range);
151 | if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return;
152 | var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);
153 | var start = end && toTagStart(iter);
154 | if (!end || !start || cmp(iter, pos) > 0) return;
155 | var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};
156 | if (end == "selfClose") return {open: here, close: null, at: "open"};
157 |
158 | if (start[1]) { // closing tag
159 | return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"};
160 | } else { // opening tag
161 | iter = new Iter(cm, to.line, to.ch, range);
162 | return {open: here, close: findMatchingClose(iter, start[2]), at: "open"};
163 | }
164 | };
165 |
166 | CodeMirror.findEnclosingTag = function(cm, pos, range) {
167 | var iter = new Iter(cm, pos.line, pos.ch, range);
168 | for (;;) {
169 | var open = findMatchingOpen(iter);
170 | if (!open) break;
171 | var forward = new Iter(cm, pos.line, pos.ch, range);
172 | var close = findMatchingClose(forward, open.tag);
173 | if (close) return {open: open, close: close};
174 | }
175 | };
176 |
177 | // Used by addon/edit/closetag.js
178 | CodeMirror.scanForClosingTag = function(cm, pos, name, end) {
179 | var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);
180 | return findMatchingClose(iter, name);
181 | };
182 | });
183 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/anyword-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var WORD = /[\w$]+/, RANGE = 500;
15 |
16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
17 | var word = options && options.word || WORD;
18 | var range = options && options.range || RANGE;
19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
20 | var start = cur.ch, end = start;
21 | while (end < curLine.length && word.test(curLine.charAt(end))) ++end;
22 | while (start && word.test(curLine.charAt(start - 1))) --start;
23 | var curWord = start != end && curLine.slice(start, end);
24 |
25 | var list = [], seen = {};
26 | var re = new RegExp(word.source, "g");
27 | for (var dir = -1; dir <= 1; dir += 2) {
28 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
29 | for (; line != endLine; line += dir) {
30 | var text = editor.getLine(line), m;
31 | while (m = re.exec(text)) {
32 | if (line == cur.line && m[0] === curWord) continue;
33 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
34 | seen[m[0]] = true;
35 | list.push(m[0]);
36 | }
37 | }
38 | }
39 | }
40 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/css-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../../mode/css/css"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../../mode/css/css"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1,
15 | "first-letter": 1, "first-line": 1, "first-child": 1,
16 | before: 1, after: 1, lang: 1};
17 |
18 | CodeMirror.registerHelper("hint", "css", function(cm) {
19 | var cur = cm.getCursor(), token = cm.getTokenAt(cur);
20 | var inner = CodeMirror.innerMode(cm.getMode(), token.state);
21 | if (inner.mode.name != "css") return;
22 |
23 | var word = token.string, start = token.start, end = token.end;
24 | if (/[^\w$_-]/.test(word)) {
25 | word = ""; start = end = cur.ch;
26 | }
27 |
28 | var spec = CodeMirror.resolveMode("text/css");
29 |
30 | var result = [];
31 | function add(keywords) {
32 | for (var name in keywords)
33 | if (!word || name.lastIndexOf(word, 0) == 0)
34 | result.push(name);
35 | }
36 |
37 | var st = inner.state.state;
38 | if (st == "pseudo" || token.type == "variable-3") {
39 | add(pseudoClasses);
40 | } else if (st == "block" || st == "maybeprop") {
41 | add(spec.propertyKeywords);
42 | } else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
43 | add(spec.valueKeywords);
44 | add(spec.colorKeywords);
45 | } else if (st == "media" || st == "media_parens") {
46 | add(spec.mediaTypes);
47 | add(spec.mediaFeatures);
48 | }
49 |
50 | if (result.length) return {
51 | list: result,
52 | from: CodeMirror.Pos(cur.line, start),
53 | to: CodeMirror.Pos(cur.line, end)
54 | };
55 | });
56 | });
57 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/javascript-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | var Pos = CodeMirror.Pos;
13 |
14 | function forEach(arr, f) {
15 | for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
16 | }
17 |
18 | function arrayContains(arr, item) {
19 | if (!Array.prototype.indexOf) {
20 | var i = arr.length;
21 | while (i--) {
22 | if (arr[i] === item) {
23 | return true;
24 | }
25 | }
26 | return false;
27 | }
28 | return arr.indexOf(item) != -1;
29 | }
30 |
31 | function scriptHint(editor, keywords, getToken, options) {
32 | // Find the token at the cursor
33 | var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
34 | if (/\b(?:string|comment)\b/.test(token.type)) return;
35 | token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
36 |
37 | // If it's not a 'word-style' token, ignore the token.
38 | if (!/^[\w$_]*$/.test(token.string)) {
39 | token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
40 | type: token.string == "." ? "property" : null};
41 | }
42 | // If it is a property, find out what it is a property of.
43 | while (tprop.type == "property") {
44 | tprop = getToken(editor, Pos(cur.line, tprop.start));
45 | if (tprop.string != ".") return;
46 | tprop = getToken(editor, Pos(cur.line, tprop.start));
47 | if (!context) var context = [];
48 | context.push(tprop);
49 | }
50 | return {list: getCompletions(token, context, keywords, options),
51 | from: Pos(cur.line, token.start),
52 | to: Pos(cur.line, token.end)};
53 | }
54 |
55 | function javascriptHint(editor, options) {
56 | return scriptHint(editor, javascriptKeywords,
57 | function (e, cur) {return e.getTokenAt(cur);},
58 | options);
59 | };
60 | CodeMirror.registerHelper("hint", "javascript", javascriptHint);
61 |
62 | function getCoffeeScriptToken(editor, cur) {
63 | // This getToken, it is for coffeescript, imitates the behavior of
64 | // getTokenAt method in javascript.js, that is, returning "property"
65 | // type and treat "." as indepenent token.
66 | var token = editor.getTokenAt(cur);
67 | if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
68 | token.end = token.start;
69 | token.string = '.';
70 | token.type = "property";
71 | }
72 | else if (/^\.[\w$_]*$/.test(token.string)) {
73 | token.type = "property";
74 | token.start++;
75 | token.string = token.string.replace(/\./, '');
76 | }
77 | return token;
78 | }
79 |
80 | function coffeescriptHint(editor, options) {
81 | return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
82 | }
83 | CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
84 |
85 | var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
86 | "toUpperCase toLowerCase split concat match replace search").split(" ");
87 | var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
88 | "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
89 | var funcProps = "prototype apply call bind".split(" ");
90 | var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
91 | "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
92 | var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
93 | "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
94 |
95 | function getCompletions(token, context, keywords, options) {
96 | var found = [], start = token.string;
97 | function maybeAdd(str) {
98 | if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
99 | }
100 | function gatherCompletions(obj) {
101 | if (typeof obj == "string") forEach(stringProps, maybeAdd);
102 | else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
103 | else if (obj instanceof Function) forEach(funcProps, maybeAdd);
104 | for (var name in obj) maybeAdd(name);
105 | }
106 |
107 | if (context && context.length) {
108 | // If this is a property, see if it belongs to some object we can
109 | // find in the current environment.
110 | var obj = context.pop(), base;
111 | if (obj.type && obj.type.indexOf("variable") === 0) {
112 | if (options && options.additionalContext)
113 | base = options.additionalContext[obj.string];
114 | if (!options || options.useGlobalScope !== false)
115 | base = base || window[obj.string];
116 | } else if (obj.type == "string") {
117 | base = "";
118 | } else if (obj.type == "atom") {
119 | base = 1;
120 | } else if (obj.type == "function") {
121 | if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
122 | (typeof window.jQuery == 'function'))
123 | base = window.jQuery();
124 | else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
125 | base = window._();
126 | }
127 | while (base != null && context.length)
128 | base = base[context.pop().string];
129 | if (base != null) gatherCompletions(base);
130 | } else {
131 | // If not, just look in the window object and any local scope
132 | // (reading into JS mode internals to get at the local and global variables)
133 | for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
134 | for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
135 | if (!options || options.useGlobalScope !== false)
136 | gatherCompletions(window);
137 | forEach(keywords, maybeAdd);
138 | }
139 | return found;
140 | }
141 | });
142 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/python-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | function forEach(arr, f) {
15 | for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
16 | }
17 |
18 | function arrayContains(arr, item) {
19 | if (!Array.prototype.indexOf) {
20 | var i = arr.length;
21 | while (i--) {
22 | if (arr[i] === item) {
23 | return true;
24 | }
25 | }
26 | return false;
27 | }
28 | return arr.indexOf(item) != -1;
29 | }
30 |
31 | function scriptHint(editor, _keywords, getToken) {
32 | // Find the token at the cursor
33 | var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
34 | // If it's not a 'word-style' token, ignore the token.
35 |
36 | if (!/^[\w$_]*$/.test(token.string)) {
37 | token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
38 | className: token.string == ":" ? "python-type" : null};
39 | }
40 |
41 | if (!context) var context = [];
42 | context.push(tprop);
43 |
44 | var completionList = getCompletions(token, context);
45 | completionList = completionList.sort();
46 |
47 | return {list: completionList,
48 | from: CodeMirror.Pos(cur.line, token.start),
49 | to: CodeMirror.Pos(cur.line, token.end)};
50 | }
51 |
52 | function pythonHint(editor) {
53 | return scriptHint(editor, pythonKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
54 | }
55 | CodeMirror.registerHelper("hint", "python", pythonHint);
56 |
57 | var pythonKeywords = "and del from not while as elif global or with assert else if pass yield"
58 | + "break except import print class exec in raise continue finally is return def for lambda try";
59 | var pythonKeywordsL = pythonKeywords.split(" ");
60 | var pythonKeywordsU = pythonKeywords.toUpperCase().split(" ");
61 |
62 | var pythonBuiltins = "abs divmod input open staticmethod all enumerate int ord str "
63 | + "any eval isinstance pow sum basestring execfile issubclass print super"
64 | + "bin file iter property tuple bool filter len range type"
65 | + "bytearray float list raw_input unichr callable format locals reduce unicode"
66 | + "chr frozenset long reload vars classmethod getattr map repr xrange"
67 | + "cmp globals max reversed zip compile hasattr memoryview round __import__"
68 | + "complex hash min set apply delattr help next setattr buffer"
69 | + "dict hex object slice coerce dir id oct sorted intern ";
70 | var pythonBuiltinsL = pythonBuiltins.split(" ").join("() ").split(" ");
71 | var pythonBuiltinsU = pythonBuiltins.toUpperCase().split(" ").join("() ").split(" ");
72 |
73 | function getCompletions(token, context) {
74 | var found = [], start = token.string;
75 | function maybeAdd(str) {
76 | if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
77 | }
78 |
79 | function gatherCompletions(_obj) {
80 | forEach(pythonBuiltinsL, maybeAdd);
81 | forEach(pythonBuiltinsU, maybeAdd);
82 | forEach(pythonKeywordsL, maybeAdd);
83 | forEach(pythonKeywordsU, maybeAdd);
84 | }
85 |
86 | if (context) {
87 | // If this is a property, see if it belongs to some object we can
88 | // find in the current environment.
89 | var obj = context.pop(), base;
90 |
91 | if (obj.type == "variable")
92 | base = obj.string;
93 | else if(obj.type == "variable-3")
94 | base = ":" + obj.string;
95 |
96 | while (base != null && context.length)
97 | base = base[context.pop().string];
98 | if (base != null) gatherCompletions(base);
99 | }
100 | return found;
101 | }
102 | });
103 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/show-hint.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-hints {
2 | position: absolute;
3 | z-index: 10;
4 | overflow: hidden;
5 | list-style: none;
6 |
7 | margin: 0;
8 | padding: 2px;
9 |
10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13 | border-radius: 3px;
14 | border: 1px solid silver;
15 |
16 | background: white;
17 | font-size: 90%;
18 | font-family: monospace;
19 |
20 | max-height: 20em;
21 | overflow-y: auto;
22 | }
23 |
24 | .CodeMirror-hint {
25 | margin: 0;
26 | padding: 0 4px;
27 | border-radius: 2px;
28 | max-width: 19em;
29 | overflow: hidden;
30 | white-space: pre;
31 | color: black;
32 | cursor: pointer;
33 | }
34 |
35 | .CodeMirror-hint-active {
36 | background: #08f;
37 | color: white;
38 | }
39 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/sql-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../../mode/sql/sql"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../../mode/sql/sql"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var tables;
15 | var keywords;
16 | var CONS = {
17 | QUERY_DIV: ";",
18 | ALIAS_KEYWORD: "AS"
19 | };
20 | var Pos = CodeMirror.Pos;
21 |
22 | function getKeywords(editor) {
23 | var mode = editor.doc.modeOption;
24 | if (mode === "sql") mode = "text/x-sql";
25 | return CodeMirror.resolveMode(mode).keywords;
26 | }
27 |
28 | function match(string, word) {
29 | var len = string.length;
30 | var sub = word.substr(0, len);
31 | return string.toUpperCase() === sub.toUpperCase();
32 | }
33 |
34 | function addMatches(result, search, wordlist, formatter) {
35 | for (var word in wordlist) {
36 | if (!wordlist.hasOwnProperty(word)) continue;
37 | if (Array.isArray(wordlist)) {
38 | word = wordlist[word];
39 | }
40 | if (match(search, word)) {
41 | result.push(formatter(word));
42 | }
43 | }
44 | }
45 |
46 | function columnCompletion(result, editor) {
47 | var cur = editor.getCursor();
48 | var token = editor.getTokenAt(cur);
49 | var string = token.string.substr(1);
50 | var prevCur = Pos(cur.line, token.start);
51 | var table = editor.getTokenAt(prevCur).string;
52 | if (!tables.hasOwnProperty(table))
53 | table = findTableByAlias(table, editor);
54 | var columns = tables[table];
55 | if (!columns) return;
56 |
57 | addMatches(result, string, columns, function(w) {return "." + w;});
58 | }
59 |
60 | function eachWord(lineText, f) {
61 | if (!lineText) return;
62 | var excepted = /[,;]/g;
63 | var words = lineText.split(" ");
64 | for (var i = 0; i < words.length; i++) {
65 | f(words[i]?words[i].replace(excepted, '') : '');
66 | }
67 | }
68 |
69 | function convertCurToNumber(cur) {
70 | // max characters of a line is 999,999.
71 | return cur.line + cur.ch / Math.pow(10, 6);
72 | }
73 |
74 | function convertNumberToCur(num) {
75 | return Pos(Math.floor(num), +num.toString().split('.').pop());
76 | }
77 |
78 | function findTableByAlias(alias, editor) {
79 | var doc = editor.doc;
80 | var fullQuery = doc.getValue();
81 | var aliasUpperCase = alias.toUpperCase();
82 | var previousWord = "";
83 | var table = "";
84 | var separator = [];
85 | var validRange = {
86 | start: Pos(0, 0),
87 | end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length)
88 | };
89 |
90 | //add separator
91 | var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV);
92 | while(indexOfSeparator != -1) {
93 | separator.push(doc.posFromIndex(indexOfSeparator));
94 | indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1);
95 | }
96 | separator.unshift(Pos(0, 0));
97 | separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
98 |
99 | //find valid range
100 | var prevItem = 0;
101 | var current = convertCurToNumber(editor.getCursor());
102 | for (var i=0; i< separator.length; i++) {
103 | var _v = convertCurToNumber(separator[i]);
104 | if (current > prevItem && current <= _v) {
105 | validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };
106 | break;
107 | }
108 | prevItem = _v;
109 | }
110 |
111 | var query = doc.getRange(validRange.start, validRange.end, false);
112 |
113 | for (var i = 0; i < query.length; i++) {
114 | var lineText = query[i];
115 | eachWord(lineText, function(word) {
116 | var wordUpperCase = word.toUpperCase();
117 | if (wordUpperCase === aliasUpperCase && tables.hasOwnProperty(previousWord)) {
118 | table = previousWord;
119 | }
120 | if (wordUpperCase !== CONS.ALIAS_KEYWORD) {
121 | previousWord = word;
122 | }
123 | });
124 | if (table) break;
125 | }
126 | return table;
127 | }
128 |
129 | CodeMirror.registerHelper("hint", "sql", function(editor, options) {
130 | tables = (options && options.tables) || {};
131 | keywords = keywords || getKeywords(editor);
132 | var cur = editor.getCursor();
133 | var result = [];
134 | var token = editor.getTokenAt(cur), start, end, search;
135 | if (token.string.match(/^[.\w@]\w*$/)) {
136 | search = token.string;
137 | start = token.start;
138 | end = token.end;
139 | } else {
140 | start = end = cur.ch;
141 | search = "";
142 | }
143 | if (search.charAt(0) == ".") {
144 | columnCompletion(result, editor);
145 | if (!result.length) {
146 | while (start && search.charAt(0) == ".") {
147 | token = editor.getTokenAt(Pos(cur.line, token.start - 1));
148 | start = token.start;
149 | search = token.string + search;
150 | }
151 | addMatches(result, search, tables, function(w) {return w;});
152 | }
153 | } else {
154 | addMatches(result, search, tables, function(w) {return w;});
155 | addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
156 | }
157 |
158 | return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
159 | });
160 | });
161 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/hint/xml-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var Pos = CodeMirror.Pos;
15 |
16 | function getHints(cm, options) {
17 | var tags = options && options.schemaInfo;
18 | var quote = (options && options.quoteChar) || '"';
19 | if (!tags) return;
20 | var cur = cm.getCursor(), token = cm.getTokenAt(cur);
21 | var inner = CodeMirror.innerMode(cm.getMode(), token.state);
22 | if (inner.mode.name != "xml") return;
23 | var result = [], replaceToken = false, prefix;
24 | var tag = /\btag\b/.test(token.type), tagName = tag && /^\w/.test(token.string), tagStart;
25 | if (tagName) {
26 | var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
27 | var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
28 | if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
29 | } else if (tag && token.string == "<") {
30 | tagType = "open";
31 | } else if (tag && token.string == "") {
32 | tagType = "close";
33 | }
34 | if (!tag && !inner.state.tagName || tagType) {
35 | if (tagName)
36 | prefix = token.string;
37 | replaceToken = tagType;
38 | var cx = inner.state.context, curTag = cx && tags[cx.tagName];
39 | var childList = cx ? curTag && curTag.children : tags["!top"];
40 | if (childList && tagType != "close") {
41 | for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
42 | result.push("<" + childList[i]);
43 | } else if (tagType != "close") {
44 | for (var name in tags)
45 | if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
46 | result.push("<" + name);
47 | }
48 | if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
49 | result.push("" + cx.tagName + ">");
50 | } else {
51 | // Attribute completion
52 | var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs;
53 | var globalAttrs = tags["!attrs"];
54 | if (!attrs && !globalAttrs) return;
55 | if (!attrs) {
56 | attrs = globalAttrs;
57 | } else if (globalAttrs) { // Combine tag-local and global attributes
58 | var set = {};
59 | for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
60 | for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
61 | attrs = set;
62 | }
63 | if (token.type == "string" || token.string == "=") { // A value
64 | var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
65 | Pos(cur.line, token.type == "string" ? token.start : token.end));
66 | var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
67 | if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
68 | if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
69 | if (token.type == "string") {
70 | prefix = token.string;
71 | var n = 0;
72 | if (/['"]/.test(token.string.charAt(0))) {
73 | quote = token.string.charAt(0);
74 | prefix = token.string.slice(1);
75 | n++;
76 | }
77 | var len = token.string.length;
78 | if (/['"]/.test(token.string.charAt(len - 1))) {
79 | quote = token.string.charAt(len - 1);
80 | prefix = token.string.substr(n, len - 2);
81 | }
82 | replaceToken = true;
83 | }
84 | for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
85 | result.push(quote + atValues[i] + quote);
86 | } else { // An attribute name
87 | if (token.type == "attribute") {
88 | prefix = token.string;
89 | replaceToken = true;
90 | }
91 | for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
92 | result.push(attr);
93 | }
94 | }
95 | return {
96 | list: result,
97 | from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
98 | to: replaceToken ? Pos(cur.line, token.end) : cur
99 | };
100 | }
101 |
102 | CodeMirror.registerHelper("hint", "xml", getHints);
103 | });
104 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/coffeescript-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
5 |
6 | // declare global: coffeelint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | CodeMirror.registerHelper("lint", "coffeescript", function(text) {
19 | var found = [];
20 | var parseError = function(err) {
21 | var loc = err.lineNumber;
22 | found.push({from: CodeMirror.Pos(loc-1, 0),
23 | to: CodeMirror.Pos(loc, 0),
24 | severity: err.level,
25 | message: err.message});
26 | };
27 | try {
28 | var res = coffeelint.lint(text);
29 | for(var i = 0; i < res.length; i++) {
30 | parseError(res[i]);
31 | }
32 | } catch(e) {
33 | found.push({from: CodeMirror.Pos(e.location.first_line, 0),
34 | to: CodeMirror.Pos(e.location.last_line, e.location.last_column),
35 | severity: 'error',
36 | message: e.message});
37 | }
38 | return found;
39 | });
40 |
41 | });
42 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/css-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on csslint.js from https://github.com/stubbornella/csslint
5 |
6 | // declare global: CSSLint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | CodeMirror.registerHelper("lint", "css", function(text) {
19 | var found = [];
20 | if (!window.CSSLint) return found;
21 | var results = CSSLint.verify(text), messages = results.messages, message = null;
22 | for ( var i = 0; i < messages.length; i++) {
23 | message = messages[i];
24 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
25 | found.push({
26 | from: CodeMirror.Pos(startLine, startCol),
27 | to: CodeMirror.Pos(endLine, endCol),
28 | message: message.message,
29 | severity : message.type
30 | });
31 | }
32 | return found;
33 | });
34 |
35 | });
36 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/javascript-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 | // declare global: JSHINT
14 |
15 | var bogus = [ "Dangerous comment" ];
16 |
17 | var warnings = [ [ "Expected '{'",
18 | "Statement body should be inside '{ }' braces." ] ];
19 |
20 | var errors = [ "Missing semicolon", "Extra comma", "Missing property name",
21 | "Unmatched ", " and instead saw", " is not defined",
22 | "Unclosed string", "Stopping, unable to continue" ];
23 |
24 | function validator(text, options) {
25 | if (!window.JSHINT) return [];
26 | JSHINT(text, options);
27 | var errors = JSHINT.data().errors, result = [];
28 | if (errors) parseErrors(errors, result);
29 | return result;
30 | }
31 |
32 | CodeMirror.registerHelper("lint", "javascript", validator);
33 |
34 | function cleanup(error) {
35 | // All problems are warnings by default
36 | fixWith(error, warnings, "warning", true);
37 | fixWith(error, errors, "error");
38 |
39 | return isBogus(error) ? null : error;
40 | }
41 |
42 | function fixWith(error, fixes, severity, force) {
43 | var description, fix, find, replace, found;
44 |
45 | description = error.description;
46 |
47 | for ( var i = 0; i < fixes.length; i++) {
48 | fix = fixes[i];
49 | find = (typeof fix === "string" ? fix : fix[0]);
50 | replace = (typeof fix === "string" ? null : fix[1]);
51 | found = description.indexOf(find) !== -1;
52 |
53 | if (force || found) {
54 | error.severity = severity;
55 | }
56 | if (found && replace) {
57 | error.description = replace;
58 | }
59 | }
60 | }
61 |
62 | function isBogus(error) {
63 | var description = error.description;
64 | for ( var i = 0; i < bogus.length; i++) {
65 | if (description.indexOf(bogus[i]) !== -1) {
66 | return true;
67 | }
68 | }
69 | return false;
70 | }
71 |
72 | function parseErrors(errors, output) {
73 | for ( var i = 0; i < errors.length; i++) {
74 | var error = errors[i];
75 | if (error) {
76 | var linetabpositions, index;
77 |
78 | linetabpositions = [];
79 |
80 | // This next block is to fix a problem in jshint. Jshint
81 | // replaces
82 | // all tabs with spaces then performs some checks. The error
83 | // positions (character/space) are then reported incorrectly,
84 | // not taking the replacement step into account. Here we look
85 | // at the evidence line and try to adjust the character position
86 | // to the correct value.
87 | if (error.evidence) {
88 | // Tab positions are computed once per line and cached
89 | var tabpositions = linetabpositions[error.line];
90 | if (!tabpositions) {
91 | var evidence = error.evidence;
92 | tabpositions = [];
93 | // ugggh phantomjs does not like this
94 | // forEachChar(evidence, function(item, index) {
95 | Array.prototype.forEach.call(evidence, function(item,
96 | index) {
97 | if (item === '\t') {
98 | // First col is 1 (not 0) to match error
99 | // positions
100 | tabpositions.push(index + 1);
101 | }
102 | });
103 | linetabpositions[error.line] = tabpositions;
104 | }
105 | if (tabpositions.length > 0) {
106 | var pos = error.character;
107 | tabpositions.forEach(function(tabposition) {
108 | if (pos > tabposition) pos -= 1;
109 | });
110 | error.character = pos;
111 | }
112 | }
113 |
114 | var start = error.character - 1, end = start + 1;
115 | if (error.evidence) {
116 | index = error.evidence.substring(start).search(/.\b/);
117 | if (index > -1) {
118 | end += index;
119 | }
120 | }
121 |
122 | // Convert to format expected by validation service
123 | error.description = error.reason;// + "(jshint)";
124 | error.start = error.character;
125 | error.end = end;
126 | error = cleanup(error);
127 |
128 | if (error)
129 | output.push({message: error.description,
130 | severity: error.severity,
131 | from: CodeMirror.Pos(error.line - 1, start),
132 | to: CodeMirror.Pos(error.line - 1, end)});
133 | }
134 | }
135 | }
136 | });
137 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/json-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint
5 |
6 | // declare global: jsonlint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | CodeMirror.registerHelper("lint", "json", function(text) {
19 | var found = [];
20 | jsonlint.parseError = function(str, hash) {
21 | var loc = hash.loc;
22 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
23 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
24 | message: str});
25 | };
26 | try { jsonlint.parse(text); }
27 | catch(e) {}
28 | return found;
29 | });
30 |
31 | });
32 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/lint.css:
--------------------------------------------------------------------------------
1 | /* The lint marker gutter */
2 | .CodeMirror-lint-markers {
3 | width: 16px;
4 | }
5 |
6 | .CodeMirror-lint-tooltip {
7 | background-color: infobackground;
8 | border: 1px solid black;
9 | border-radius: 4px 4px 4px 4px;
10 | color: infotext;
11 | font-family: monospace;
12 | font-size: 10pt;
13 | overflow: hidden;
14 | padding: 2px 5px;
15 | position: fixed;
16 | white-space: pre;
17 | white-space: pre-wrap;
18 | z-index: 100;
19 | max-width: 600px;
20 | opacity: 0;
21 | transition: opacity .4s;
22 | -moz-transition: opacity .4s;
23 | -webkit-transition: opacity .4s;
24 | -o-transition: opacity .4s;
25 | -ms-transition: opacity .4s;
26 | }
27 |
28 | .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
29 | background-position: left bottom;
30 | background-repeat: repeat-x;
31 | }
32 |
33 | .CodeMirror-lint-mark-error {
34 | background-image:
35 | url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
36 | ;
37 | }
38 |
39 | .CodeMirror-lint-mark-warning {
40 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
41 | }
42 |
43 | .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
44 | background-position: center center;
45 | background-repeat: no-repeat;
46 | cursor: pointer;
47 | display: inline-block;
48 | height: 16px;
49 | width: 16px;
50 | vertical-align: middle;
51 | position: relative;
52 | }
53 |
54 | .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
55 | padding-left: 18px;
56 | background-position: top left;
57 | background-repeat: no-repeat;
58 | }
59 |
60 | .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
61 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
62 | }
63 |
64 | .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
65 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
66 | }
67 |
68 | .CodeMirror-lint-marker-multiple {
69 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
70 | background-repeat: no-repeat;
71 | background-position: right bottom;
72 | width: 100%; height: 100%;
73 | }
74 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/lint/yaml-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | // Depends on js-yaml.js from https://github.com/nodeca/js-yaml
15 |
16 | // declare global: jsyaml
17 |
18 | CodeMirror.registerHelper("lint", "yaml", function(text) {
19 | var found = [];
20 | try { jsyaml.load(text); }
21 | catch(e) {
22 | var loc = e.mark;
23 | found.push({ from: CodeMirror.Pos(loc.line, loc.column), to: CodeMirror.Pos(loc.line, loc.column), message: e.message });
24 | }
25 | return found;
26 | });
27 |
28 | });
29 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/search/match-highlighter.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Highlighting text that matches the selection
5 | //
6 | // Defines an option highlightSelectionMatches, which, when enabled,
7 | // will style strings that match the selection throughout the
8 | // document.
9 | //
10 | // The option can be set to true to simply enable it, or to a
11 | // {minChars, style, showToken} object to explicitly configure it.
12 | // minChars is the minimum amount of characters that should be
13 | // selected for the behavior to occur, and style is the token style to
14 | // apply to the matches. This will be prefixed by "cm-" to create an
15 | // actual CSS class name. showToken, when enabled, will cause the
16 | // current token to be highlighted when nothing is selected.
17 |
18 | (function(mod) {
19 | if (typeof exports == "object" && typeof module == "object") // CommonJS
20 | mod(require("../../lib/codemirror"));
21 | else if (typeof define == "function" && define.amd) // AMD
22 | define(["../../lib/codemirror"], mod);
23 | else // Plain browser env
24 | mod(CodeMirror);
25 | })(function(CodeMirror) {
26 | "use strict";
27 |
28 | var DEFAULT_MIN_CHARS = 2;
29 | var DEFAULT_TOKEN_STYLE = "matchhighlight";
30 | var DEFAULT_DELAY = 100;
31 |
32 | function State(options) {
33 | if (typeof options == "object") {
34 | this.minChars = options.minChars;
35 | this.style = options.style;
36 | this.showToken = options.showToken;
37 | this.delay = options.delay;
38 | }
39 | if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;
40 | if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;
41 | if (this.delay == null) this.delay = DEFAULT_DELAY;
42 | this.overlay = this.timeout = null;
43 | }
44 |
45 | CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
46 | if (old && old != CodeMirror.Init) {
47 | var over = cm.state.matchHighlighter.overlay;
48 | if (over) cm.removeOverlay(over);
49 | clearTimeout(cm.state.matchHighlighter.timeout);
50 | cm.state.matchHighlighter = null;
51 | cm.off("cursorActivity", cursorActivity);
52 | }
53 | if (val) {
54 | cm.state.matchHighlighter = new State(val);
55 | highlightMatches(cm);
56 | cm.on("cursorActivity", cursorActivity);
57 | }
58 | });
59 |
60 | function cursorActivity(cm) {
61 | var state = cm.state.matchHighlighter;
62 | clearTimeout(state.timeout);
63 | state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay);
64 | }
65 |
66 | function highlightMatches(cm) {
67 | cm.operation(function() {
68 | var state = cm.state.matchHighlighter;
69 | if (state.overlay) {
70 | cm.removeOverlay(state.overlay);
71 | state.overlay = null;
72 | }
73 | if (!cm.somethingSelected() && state.showToken) {
74 | var re = state.showToken === true ? /[\w$]/ : state.showToken;
75 | var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;
76 | while (start && re.test(line.charAt(start - 1))) --start;
77 | while (end < line.length && re.test(line.charAt(end))) ++end;
78 | if (start < end)
79 | cm.addOverlay(state.overlay = makeOverlay(line.slice(start, end), re, state.style));
80 | return;
81 | }
82 | var from = cm.getCursor("from"), to = cm.getCursor("to");
83 | if (from.line != to.line) return;
84 | var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, "");
85 | if (selection.length >= state.minChars)
86 | cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style));
87 | });
88 | }
89 |
90 | function boundariesAround(stream, re) {
91 | return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) &&
92 | (stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos)));
93 | }
94 |
95 | function makeOverlay(query, hasBoundary, style) {
96 | return {token: function(stream) {
97 | if (stream.match(query) &&
98 | (!hasBoundary || boundariesAround(stream, hasBoundary)))
99 | return style;
100 | stream.next();
101 | stream.skipTo(query.charAt(0)) || stream.skipToEnd();
102 | }};
103 | }
104 | });
105 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/search/search.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Define search commands. Depends on dialog.js or another
5 | // implementation of the openDialog method.
6 |
7 | // Replace works a little oddly -- it will do the replace on the next
8 | // Ctrl-G (or whatever is bound to findNext) press. You prevent a
9 | // replace by making sure the match is no longer selected when hitting
10 | // Ctrl-G.
11 |
12 | (function(mod) {
13 | if (typeof exports == "object" && typeof module == "object") // CommonJS
14 | mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
15 | else if (typeof define == "function" && define.amd) // AMD
16 | define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
17 | else // Plain browser env
18 | mod(CodeMirror);
19 | })(function(CodeMirror) {
20 | "use strict";
21 | function searchOverlay(query, caseInsensitive) {
22 | if (typeof query == "string")
23 | query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
24 | else if (!query.global)
25 | query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
26 |
27 | return {token: function(stream) {
28 | query.lastIndex = stream.pos;
29 | var match = query.exec(stream.string);
30 | if (match && match.index == stream.pos) {
31 | stream.pos += match[0].length;
32 | return "searching";
33 | } else if (match) {
34 | stream.pos = match.index;
35 | } else {
36 | stream.skipToEnd();
37 | }
38 | }};
39 | }
40 |
41 | function SearchState() {
42 | this.posFrom = this.posTo = this.query = null;
43 | this.overlay = null;
44 | }
45 | function getSearchState(cm) {
46 | return cm.state.search || (cm.state.search = new SearchState());
47 | }
48 | function queryCaseInsensitive(query) {
49 | return typeof query == "string" && query == query.toLowerCase();
50 | }
51 | function getSearchCursor(cm, query, pos) {
52 | // Heuristic: if the query string is all lowercase, do a case insensitive search.
53 | return cm.getSearchCursor(query, pos, queryCaseInsensitive(query));
54 | }
55 | function dialog(cm, text, shortText, deflt, f) {
56 | if (cm.openDialog) cm.openDialog(text, f, {value: deflt});
57 | else f(prompt(shortText, deflt));
58 | }
59 | function confirmDialog(cm, text, shortText, fs) {
60 | if (cm.openConfirm) cm.openConfirm(text, fs);
61 | else if (confirm(shortText)) fs[0]();
62 | }
63 | function parseQuery(query) {
64 | var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
65 | if (isRE) {
66 | query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i");
67 | if (query.test("")) query = /x^/;
68 | } else if (query == "") {
69 | query = /x^/;
70 | }
71 | return query;
72 | }
73 | var queryDialog =
74 | 'Search: (Use /re/ syntax for regexp search) ';
75 | function doSearch(cm, rev) {
76 | var state = getSearchState(cm);
77 | if (state.query) return findNext(cm, rev);
78 | dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) {
79 | cm.operation(function() {
80 | if (!query || state.query) return;
81 | state.query = parseQuery(query);
82 | cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
83 | state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
84 | cm.addOverlay(state.overlay);
85 | state.posFrom = state.posTo = cm.getCursor();
86 | findNext(cm, rev);
87 | });
88 | });
89 | }
90 | function findNext(cm, rev) {cm.operation(function() {
91 | var state = getSearchState(cm);
92 | var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
93 | if (!cursor.find(rev)) {
94 | cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
95 | if (!cursor.find(rev)) return;
96 | }
97 | cm.setSelection(cursor.from(), cursor.to());
98 | cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
99 | state.posFrom = cursor.from(); state.posTo = cursor.to();
100 | });}
101 | function clearSearch(cm) {cm.operation(function() {
102 | var state = getSearchState(cm);
103 | if (!state.query) return;
104 | state.query = null;
105 | cm.removeOverlay(state.overlay);
106 | });}
107 |
108 | var replaceQueryDialog =
109 | 'Replace: (Use /re/ syntax for regexp search) ';
110 | var replacementQueryDialog = 'With: ';
111 | var doReplaceConfirm = "Replace? Yes No Stop ";
112 | function replace(cm, all) {
113 | if (cm.getOption("readOnly")) return;
114 | dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) {
115 | if (!query) return;
116 | query = parseQuery(query);
117 | dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {
118 | if (all) {
119 | cm.operation(function() {
120 | for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
121 | if (typeof query != "string") {
122 | var match = cm.getRange(cursor.from(), cursor.to()).match(query);
123 | cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
124 | } else cursor.replace(text);
125 | }
126 | });
127 | } else {
128 | clearSearch(cm);
129 | var cursor = getSearchCursor(cm, query, cm.getCursor());
130 | var advance = function() {
131 | var start = cursor.from(), match;
132 | if (!(match = cursor.findNext())) {
133 | cursor = getSearchCursor(cm, query);
134 | if (!(match = cursor.findNext()) ||
135 | (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
136 | }
137 | cm.setSelection(cursor.from(), cursor.to());
138 | cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
139 | confirmDialog(cm, doReplaceConfirm, "Replace?",
140 | [function() {doReplace(match);}, advance]);
141 | };
142 | var doReplace = function(match) {
143 | cursor.replace(typeof query == "string" ? text :
144 | text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
145 | advance();
146 | };
147 | advance();
148 | }
149 | });
150 | });
151 | }
152 |
153 | CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
154 | CodeMirror.commands.findNext = doSearch;
155 | CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
156 | CodeMirror.commands.clearSearch = clearSearch;
157 | CodeMirror.commands.replace = replace;
158 | CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
159 | });
160 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/addon/wrap/hardwrap.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var Pos = CodeMirror.Pos;
15 |
16 | function findParagraph(cm, pos, options) {
17 | var startRE = options.paragraphStart || cm.getHelper(pos, "paragraphStart");
18 | for (var start = pos.line, first = cm.firstLine(); start > first; --start) {
19 | var line = cm.getLine(start);
20 | if (startRE && startRE.test(line)) break;
21 | if (!/\S/.test(line)) { ++start; break; }
22 | }
23 | var endRE = options.paragraphEnd || cm.getHelper(pos, "paragraphEnd");
24 | for (var end = pos.line + 1, last = cm.lastLine(); end <= last; ++end) {
25 | var line = cm.getLine(end);
26 | if (endRE && endRE.test(line)) { ++end; break; }
27 | if (!/\S/.test(line)) break;
28 | }
29 | return {from: start, to: end};
30 | }
31 |
32 | function findBreakPoint(text, column, wrapOn, killTrailingSpace) {
33 | for (var at = column; at > 0; --at)
34 | if (wrapOn.test(text.slice(at - 1, at + 1))) break;
35 | if (at == 0) at = column;
36 | var endOfText = at;
37 | if (killTrailingSpace)
38 | while (text.charAt(endOfText - 1) == " ") --endOfText;
39 | return {from: endOfText, to: at};
40 | }
41 |
42 | function wrapRange(cm, from, to, options) {
43 | from = cm.clipPos(from); to = cm.clipPos(to);
44 | var column = options.column || 80;
45 | var wrapOn = options.wrapOn || /\s\S|-[^\.\d]/;
46 | var killTrailing = options.killTrailingSpace !== false;
47 | var changes = [], curLine = "", curNo = from.line;
48 | var lines = cm.getRange(from, to, false);
49 | if (!lines.length) return null;
50 | var leadingSpace = lines[0].match(/^[ \t]*/)[0];
51 |
52 | for (var i = 0; i < lines.length; ++i) {
53 | var text = lines[i], oldLen = curLine.length, spaceInserted = 0;
54 | if (curLine && text && !wrapOn.test(curLine.charAt(curLine.length - 1) + text.charAt(0))) {
55 | curLine += " ";
56 | spaceInserted = 1;
57 | }
58 | var spaceTrimmed = "";
59 | if (i) {
60 | spaceTrimmed = text.match(/^\s*/)[0];
61 | text = text.slice(spaceTrimmed.length);
62 | }
63 | curLine += text;
64 | if (i) {
65 | var firstBreak = curLine.length > column && leadingSpace == spaceTrimmed &&
66 | findBreakPoint(curLine, column, wrapOn, killTrailing);
67 | // If this isn't broken, or is broken at a different point, remove old break
68 | if (!firstBreak || firstBreak.from != oldLen || firstBreak.to != oldLen + spaceInserted) {
69 | changes.push({text: [spaceInserted ? " " : ""],
70 | from: Pos(curNo, oldLen),
71 | to: Pos(curNo + 1, spaceTrimmed.length)});
72 | } else {
73 | curLine = leadingSpace + text;
74 | ++curNo;
75 | }
76 | }
77 | while (curLine.length > column) {
78 | var bp = findBreakPoint(curLine, column, wrapOn, killTrailing);
79 | changes.push({text: ["", leadingSpace],
80 | from: Pos(curNo, bp.from),
81 | to: Pos(curNo, bp.to)});
82 | curLine = leadingSpace + curLine.slice(bp.to);
83 | ++curNo;
84 | }
85 | }
86 | if (changes.length) cm.operation(function() {
87 | for (var i = 0; i < changes.length; ++i) {
88 | var change = changes[i];
89 | cm.replaceRange(change.text, change.from, change.to);
90 | }
91 | });
92 | return changes.length ? {from: changes[0].from, to: CodeMirror.changeEnd(changes[changes.length - 1])} : null;
93 | }
94 |
95 | CodeMirror.defineExtension("wrapParagraph", function(pos, options) {
96 | options = options || {};
97 | if (!pos) pos = this.getCursor();
98 | var para = findParagraph(this, pos, options);
99 | return wrapRange(this, Pos(para.from, 0), Pos(para.to - 1), options);
100 | });
101 |
102 | CodeMirror.commands.wrapLines = function(cm) {
103 | cm.operation(function() {
104 | var ranges = cm.listSelections(), at = cm.lastLine() + 1;
105 | for (var i = ranges.length - 1; i >= 0; i--) {
106 | var range = ranges[i], span;
107 | if (range.empty()) {
108 | var para = findParagraph(cm, range.head, {});
109 | span = {from: Pos(para.from, 0), to: Pos(para.to - 1)};
110 | } else {
111 | span = {from: range.from(), to: range.to()};
112 | }
113 | if (span.to.line >= at) continue;
114 | at = span.from.line;
115 | wrapRange(cm, span.from, span.to, {});
116 | }
117 | });
118 | };
119 |
120 | CodeMirror.defineExtension("wrapRange", function(from, to, options) {
121 | return wrapRange(this, from, to, options || {});
122 | });
123 |
124 | CodeMirror.defineExtension("wrapParagraphsInRange", function(from, to, options) {
125 | options = options || {};
126 | var cm = this, paras = [];
127 | for (var line = from.line; line <= to.line;) {
128 | var para = findParagraph(cm, Pos(line, 0), options);
129 | paras.push(para);
130 | line = para.to;
131 | }
132 | var madeChange = false;
133 | if (paras.length) cm.operation(function() {
134 | for (var i = paras.length - 1; i >= 0; --i)
135 | madeChange = madeChange || wrapRange(cm, Pos(paras[i].from, 0), Pos(paras[i].to - 1), options);
136 | });
137 | return madeChange;
138 | });
139 | });
140 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: Autocomplete Demo
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
34 |
35 |
54 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/activebookmark.js:
--------------------------------------------------------------------------------
1 | // Kludge in HTML5 tag recognition in IE8
2 | document.createElement("section");
3 | document.createElement("article");
4 |
5 | (function() {
6 | if (!window.addEventListener) return;
7 | var pending = false, prevVal = null;
8 |
9 | function updateSoon() {
10 | if (!pending) {
11 | pending = true;
12 | setTimeout(update, 250);
13 | }
14 | }
15 |
16 | function update() {
17 | pending = false;
18 | var marks = document.getElementById("nav").getElementsByTagName("a"), found;
19 | for (var i = 0; i < marks.length; ++i) {
20 | var mark = marks[i], m;
21 | if (mark.getAttribute("data-default")) {
22 | if (found == null) found = i;
23 | } else if (m = mark.href.match(/#(.*)/)) {
24 | var ref = document.getElementById(m[1]);
25 | if (ref && ref.getBoundingClientRect().top < 50)
26 | found = i;
27 | }
28 | }
29 | if (found != null && found != prevVal) {
30 | prevVal = found;
31 | var lis = document.getElementById("nav").getElementsByTagName("li");
32 | for (var i = 0; i < lis.length; ++i) lis[i].className = "";
33 | for (var i = 0; i < marks.length; ++i) {
34 | if (found == i) {
35 | marks[i].className = "active";
36 | for (var n = marks[i]; n; n = n.parentNode)
37 | if (n.nodeName == "LI") n.className = "active";
38 | } else {
39 | marks[i].className = "";
40 | }
41 | }
42 | }
43 | }
44 |
45 | window.addEventListener("scroll", updateSoon);
46 | window.addEventListener("load", updateSoon);
47 | window.addEventListener("hashchange", function() {
48 | setTimeout(function() {
49 | var hash = document.location.hash, found = null, m;
50 | var marks = document.getElementById("nav").getElementsByTagName("a");
51 | for (var i = 0; i < marks.length; i++)
52 | if ((m = marks[i].href.match(/(#.*)/)) && m[1] == hash) { found = i; break; }
53 | if (found != null) for (var i = 0; i < marks.length; i++)
54 | marks[i].className = i == found ? "active" : "";
55 | }, 300);
56 | });
57 | })();
58 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/docs.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Source Sans Pro';
3 | font-style: normal;
4 | font-weight: 400;
5 | src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(//themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
6 | }
7 |
8 | body, html { margin: 0; padding: 0; height: 100%; }
9 | section, article { display: block; padding: 0; }
10 |
11 | body {
12 | background: #f8f8f8;
13 | font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
14 | line-height: 1.5;
15 | }
16 |
17 | p { margin-top: 0; }
18 |
19 | h2, h3 {
20 | font-weight: normal;
21 | margin-bottom: .7em;
22 | }
23 | h2 { font-size: 120%; }
24 | h3 { font-size: 110%; }
25 | article > h2:first-child, section:first-child > h2 { margin-top: 0; }
26 |
27 | a, a:visited, a:link, .quasilink {
28 | color: #A21313;
29 | text-decoration: none;
30 | }
31 |
32 | em {
33 | padding-right: 2px;
34 | }
35 |
36 | .quasilink {
37 | cursor: pointer;
38 | }
39 |
40 | article {
41 | max-width: 700px;
42 | margin: 0 0 0 160px;
43 | border-left: 2px solid #E30808;
44 | border-right: 1px solid #ddd;
45 | padding: 30px 50px 100px 50px;
46 | background: white;
47 | z-index: 2;
48 | position: relative;
49 | min-height: 100%;
50 | box-sizing: border-box;
51 | -moz-box-sizing: border-box;
52 | }
53 |
54 | #nav {
55 | position: fixed;
56 | padding-top: 30px;
57 | max-height: 100%;
58 | box-sizing: -moz-border-box;
59 | box-sizing: border-box;
60 | overflow-y: auto;
61 | left: 0; right: none;
62 | width: 160px;
63 | text-align: right;
64 | z-index: 1;
65 | }
66 |
67 | @media screen and (min-width: 1000px) {
68 | article {
69 | margin: 0 auto;
70 | }
71 | #nav {
72 | right: 50%;
73 | width: auto;
74 | border-right: 349px solid transparent;
75 | }
76 | }
77 |
78 | #nav ul {
79 | display: block;
80 | margin: 0; padding: 0;
81 | margin-bottom: 32px;
82 | }
83 |
84 | #nav li {
85 | display: block;
86 | margin-bottom: 4px;
87 | }
88 |
89 | #nav li ul {
90 | font-size: 80%;
91 | margin-bottom: 0;
92 | display: none;
93 | }
94 |
95 | #nav li.active ul {
96 | display: block;
97 | }
98 |
99 | #nav li li a {
100 | padding-right: 20px;
101 | display: inline-block;
102 | }
103 |
104 | #nav ul a {
105 | color: black;
106 | padding: 0 7px 1px 11px;
107 | }
108 |
109 | #nav ul a.active, #nav ul a:hover {
110 | border-bottom: 1px solid #E30808;
111 | margin-bottom: -1px;
112 | color: #E30808;
113 | }
114 |
115 | #logo {
116 | border: 0;
117 | margin-right: 7px;
118 | margin-bottom: 25px;
119 | }
120 |
121 | section {
122 | border-top: 1px solid #E30808;
123 | margin: 1.5em 0;
124 | }
125 |
126 | section.first {
127 | border: none;
128 | margin-top: 0;
129 | }
130 |
131 | #demo {
132 | position: relative;
133 | }
134 |
135 | #demolist {
136 | position: absolute;
137 | right: 5px;
138 | top: 5px;
139 | z-index: 25;
140 | }
141 |
142 | .bankinfo {
143 | text-align: left;
144 | display: none;
145 | padding: 0 .5em;
146 | position: absolute;
147 | border: 2px solid #aaa;
148 | border-radius: 5px;
149 | background: #eee;
150 | top: 10px;
151 | left: 30px;
152 | }
153 |
154 | .bankinfo_close {
155 | position: absolute;
156 | top: 0; right: 6px;
157 | font-weight: bold;
158 | cursor: pointer;
159 | }
160 |
161 | .bigbutton {
162 | cursor: pointer;
163 | text-align: center;
164 | padding: 0 1em;
165 | display: inline-block;
166 | color: white;
167 | position: relative;
168 | line-height: 1.9;
169 | color: white !important;
170 | background: #A21313;
171 | }
172 |
173 | .bigbutton.right {
174 | border-bottom-left-radius: 100px;
175 | border-top-left-radius: 100px;
176 | }
177 |
178 | .bigbutton.left {
179 | border-bottom-right-radius: 100px;
180 | border-top-right-radius: 100px;
181 | }
182 |
183 | .bigbutton:hover {
184 | background: #E30808;
185 | }
186 |
187 | th {
188 | text-decoration: underline;
189 | font-weight: normal;
190 | text-align: left;
191 | }
192 |
193 | #features ul {
194 | list-style: none;
195 | margin: 0 0 1em;
196 | padding: 0 0 0 1.2em;
197 | }
198 |
199 | #features li:before {
200 | content: "-";
201 | width: 1em;
202 | display: inline-block;
203 | padding: 0;
204 | margin: 0;
205 | margin-left: -1em;
206 | }
207 |
208 | .rel {
209 | margin-bottom: 0;
210 | }
211 | .rel-note {
212 | margin-top: 0;
213 | color: #555;
214 | }
215 |
216 | pre {
217 | padding-left: 15px;
218 | border-left: 2px solid #ddd;
219 | }
220 |
221 | code {
222 | padding: 0 2px;
223 | }
224 |
225 | strong {
226 | text-decoration: underline;
227 | font-weight: normal;
228 | }
229 |
230 | .field {
231 | border: 1px solid #A21313;
232 | }
233 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/codemirror/doc/logo.png
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/reporting.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: Reporting Bugs
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
18 |
19 |
20 |
21 |
22 | Reporting bugs effectively
23 |
24 |
25 |
26 |
So you found a problem in CodeMirror. By all means, report it! Bug
27 | reports from users are the main drive behind improvements to
28 | CodeMirror. But first, please read over these points:
29 |
30 |
31 | CodeMirror is maintained by volunteers. They don't owe you
32 | anything, so be polite. Reports with an indignant or belligerent
33 | tone tend to be moved to the bottom of the pile.
34 |
35 | Include information about the browser in which the
36 | problem occurred . Even if you tested several browsers, and
37 | the problem occurred in all of them, mention this fact in the bug
38 | report. Also include browser version numbers and the operating
39 | system that you're on.
40 |
41 | Mention which release of CodeMirror you're using. Preferably,
42 | try also with the current development snapshot, to ensure the
43 | problem has not already been fixed.
44 |
45 | Mention very precisely what went wrong. "X is broken" is not a
46 | good bug report. What did you expect to happen? What happened
47 | instead? Describe the exact steps a maintainer has to take to make
48 | the problem occur. We can not fix something that we can not
49 | observe.
50 |
51 | If the problem can not be reproduced in any of the demos
52 | included in the CodeMirror distribution, please provide an HTML
53 | document that demonstrates the problem. The best way to do this is
54 | to go to jsbin.com , enter
55 | it there, press save, and include the resulting link in your bug
56 | report.
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/upgrade_v2.2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: Version 2.2 upgrade guide
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
18 |
19 |
20 |
21 |
22 | Upgrading to v2.2
23 |
24 | There are a few things in the 2.2 release that require some care
25 | when upgrading.
26 |
27 | No more default.css
28 |
29 | The default theme is now included
30 | in codemirror.css
, so
31 | you do not have to included it separately anymore. (It was tiny, so
32 | even if you're not using it, the extra data overhead is negligible.)
33 |
34 |
Different key customization
35 |
36 | CodeMirror has moved to a system
37 | where keymaps are used to
38 | bind behavior to keys. This means custom
39 | bindings are now possible.
40 |
41 | Three options that influenced key
42 | behavior, tabMode
, enterMode
,
43 | and smartHome
, are no longer supported. Instead, you can
44 | provide custom bindings to influence the way these keys act. This is
45 | done through the
46 | new extraKeys
47 | option, which can hold an object mapping key names to functionality. A
48 | simple example would be:
49 |
50 | extraKeys: {
51 | "Ctrl-S": function(instance) { saveText(instance.getValue()); },
52 | "Ctrl-/": "undo"
53 | }
54 |
55 | Keys can be mapped either to functions, which will be given the
56 | editor instance as argument, or to strings, which are mapped through
57 | functions through the CodeMirror.commands
table, which
58 | contains all the built-in editing commands, and can be inspected and
59 | extended by external code.
60 |
61 | By default, the Home
key is bound to
62 | the "goLineStartSmart"
command, which moves the cursor to
63 | the first non-whitespace character on the line. You can set do this to
64 | make it always go to the very start instead:
65 |
66 | extraKeys: {"Home": "goLineStart"}
67 |
68 | Similarly, Enter
is bound
69 | to "newlineAndIndent"
by default. You can bind it to
70 | something else to get different behavior. To disable special handling
71 | completely and only get a newline character inserted, you can bind it
72 | to false
:
73 |
74 | extraKeys: {"Enter": false}
75 |
76 | The same works for Tab
. If you don't want CodeMirror
77 | to handle it, bind it to false
. The default behaviour is
78 | to indent the current line more ("indentMore"
command),
79 | and indent it less when shift is held ("indentLess"
).
80 | There are also "indentAuto"
(smart indent)
81 | and "insertTab"
commands provided for alternate
82 | behaviors. Or you can write your own handler function to do something
83 | different altogether.
84 |
85 | Tabs
86 |
87 | Handling of tabs changed completely. The display width of tabs can
88 | now be set with the tabSize
option, and tabs can
89 | be styled by setting CSS rules
90 | for the cm-tab
class.
91 |
92 | The default width for tabs is now 4, as opposed to the 8 that is
93 | hard-wired into browsers. If you are relying on 8-space tabs, make
94 | sure you explicitly set tabSize: 8
in your options.
95 |
96 |
97 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/doc/upgrade_v4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: Version 4 upgrade guide
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
27 |
28 |
29 |
30 |
31 | Upgrading to version 4
32 |
33 | CodeMirror 4's interface is very close version 3, but it
34 | does fix a few awkward details in a backwards-incompatible ways. At
35 | least skim the text below before upgrading.
36 |
37 | Multiple selections
38 |
39 | The main new feature in version 4 is multiple selections. The
40 | single-selection variants of methods are still there, but now
41 | typically act only on the primary selection (usually the last
42 | one added).
43 |
44 | The exception to this
45 | is getSelection
,
46 | which will now return the content of all selections
47 | (separated by newlines, or whatever lineSep
parameter you passed
48 | it).
49 |
50 |
51 |
52 | The beforeSelectionChange event
53 |
54 | This event still exists, but the object it is passed has
55 | a completely new
56 | interface , because such changes now concern multiple
57 | selections.
58 |
59 |
60 |
61 | replaceSelection's collapsing behavior
62 |
63 | By
64 | default, replaceSelection
65 | would leave the newly inserted text selected. This is only rarely what
66 | you want, and also (slightly) more expensive in the new model, so the
67 | default was changed to "end"
, meaning the old behavior
68 | must be explicitly specified by passing a second argument
69 | of "around"
.
70 |
71 |
72 |
73 | change event data
74 |
75 | Rather than forcing client code to follow next
76 | pointers from one change object to the next, the library will now
77 | simply fire
78 | multiple "change"
79 | events. Existing code will probably continue to work unmodified.
80 |
81 |
82 |
83 | showIfHidden option to line widgets
84 |
85 | This option, which conceptually caused line widgets to be visible
86 | even if their line was hidden, was never really well-defined, and was
87 | buggy from the start. It would be a rather expensive feature, both in
88 | code complexity and run-time performance, to implement properly. It
89 | has been dropped entirely in 4.0.
90 |
91 |
92 |
93 | Module loaders
94 |
95 | All modules in the CodeMirror distribution are now wrapped in a
96 | shim function to make them compatible with both AMD
97 | (requirejs ) and CommonJS (as used
98 | by node
99 | and browserify ) module loaders.
100 | When neither of these is present, they fall back to simply using the
101 | global CodeMirror
variable.
102 |
103 | If you have a module loader present in your environment, CodeMirror
104 | will attempt to use it, and you might need to change the way you load
105 | CodeMirror modules.
106 |
107 |
108 |
109 | Mutating shared data structures
110 |
111 | Data structures produced by the library should not be mutated
112 | unless explicitly allowed, in general. This is slightly more strict in
113 | 4.0 than it was in earlier versions, which copied the position objects
114 | returned by getCursor
115 | for nebulous, historic reasons. In 4.0, mutating these
116 | objects will corrupt your editor's selection.
117 |
118 |
119 |
120 | Deprecated interfaces dropped
121 |
122 | A few properties and methods that have been deprecated for a while
123 | are now gone. Most notably, the onKeyEvent
124 | and onDragEvent
options (use the
125 | corresponding events instead).
126 |
127 | Two silly methods, which were mostly there to stay close to the 0.x
128 | API, setLine
and removeLine
are now gone.
129 | Use the more
130 | flexible replaceRange
131 | method instead.
132 |
133 | The long names for folding and completing functions
134 | (CodeMirror.braceRangeFinder
, CodeMirror.javascriptHint
,
135 | etc) are also gone
136 | (use CodeMirror.fold.brace
, CodeMirror.hint.javascript
).
137 |
138 | The className
property in the return value
139 | of getTokenAt
, which
140 | has been superseded by the type
property, is also no
141 | longer present.
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/mode/htmlmixed.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
15 | var htmlMode = CodeMirror.getMode(config, {name: "xml",
16 | htmlMode: true,
17 | multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
18 | multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag});
19 | var cssMode = CodeMirror.getMode(config, "css");
20 |
21 | var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
22 | scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
23 | mode: CodeMirror.getMode(config, "javascript")});
24 | if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
25 | var conf = scriptTypesConf[i];
26 | scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
27 | }
28 | scriptTypes.push({matches: /./,
29 | mode: CodeMirror.getMode(config, "text/plain")});
30 |
31 | function html(stream, state) {
32 | var tagName = state.htmlState.tagName;
33 | var style = htmlMode.token(stream, state.htmlState);
34 | if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
35 | // Script block: mode to change to depends on type attribute
36 | var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
37 | scriptType = scriptType ? scriptType[1] : "";
38 | if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
39 | for (var i = 0; i < scriptTypes.length; ++i) {
40 | var tp = scriptTypes[i];
41 | if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
42 | if (tp.mode) {
43 | state.token = script;
44 | state.localMode = tp.mode;
45 | state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
46 | }
47 | break;
48 | }
49 | }
50 | } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
51 | state.token = css;
52 | state.localMode = cssMode;
53 | state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
54 | }
55 | return style;
56 | }
57 | function maybeBackup(stream, pat, style) {
58 | var cur = stream.current();
59 | var close = cur.search(pat), m;
60 | if (close > -1) stream.backUp(cur.length - close);
61 | else if (m = cur.match(/<\/?$/)) {
62 | stream.backUp(cur.length);
63 | if (!stream.match(pat, false)) stream.match(cur);
64 | }
65 | return style;
66 | }
67 | function script(stream, state) {
68 | if (stream.match(/^<\/\s*script\s*>/i, false)) {
69 | state.token = html;
70 | state.localState = state.localMode = null;
71 | return html(stream, state);
72 | }
73 | return maybeBackup(stream, /<\/\s*script\s*>/,
74 | state.localMode.token(stream, state.localState));
75 | }
76 | function css(stream, state) {
77 | if (stream.match(/^<\/\s*style\s*>/i, false)) {
78 | state.token = html;
79 | state.localState = state.localMode = null;
80 | return html(stream, state);
81 | }
82 | return maybeBackup(stream, /<\/\s*style\s*>/,
83 | cssMode.token(stream, state.localState));
84 | }
85 |
86 | return {
87 | startState: function() {
88 | var state = htmlMode.startState();
89 | return {token: html, localMode: null, localState: null, htmlState: state};
90 | },
91 |
92 | copyState: function(state) {
93 | if (state.localState)
94 | var local = CodeMirror.copyState(state.localMode, state.localState);
95 | return {token: state.token, localMode: state.localMode, localState: local,
96 | htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
97 | },
98 |
99 | token: function(stream, state) {
100 | return state.token(stream, state);
101 | },
102 |
103 | indent: function(state, textAfter) {
104 | if (!state.localMode || /^\s*<\//.test(textAfter))
105 | return htmlMode.indent(state.htmlState, textAfter);
106 | else if (state.localMode.indent)
107 | return state.localMode.indent(state.localState, textAfter);
108 | else
109 | return CodeMirror.Pass;
110 | },
111 |
112 | innerMode: function(state) {
113 | return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
114 | }
115 | };
116 | }, "xml", "javascript", "css");
117 |
118 | CodeMirror.defineMIME("text/html", "htmlmixed");
119 |
120 | });
121 |
--------------------------------------------------------------------------------
/theme-smart/assets/codemirror/theme/monokai.css:
--------------------------------------------------------------------------------
1 | /* Based on Sublime Text's Monokai theme */
2 |
3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
6 | .cm-s-monokai .CodeMirror-guttermarker { color: white; }
7 | .cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
8 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
9 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
10 |
11 | .cm-s-monokai span.cm-comment {color: #75715e;}
12 | .cm-s-monokai span.cm-atom {color: #ae81ff;}
13 | .cm-s-monokai span.cm-number {color: #ae81ff;}
14 |
15 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
16 | .cm-s-monokai span.cm-keyword {color: #f92672;}
17 | .cm-s-monokai span.cm-string {color: #e6db74;}
18 |
19 | .cm-s-monokai span.cm-variable {color: #a6e22e;}
20 | .cm-s-monokai span.cm-variable-2 {color: #9effff;}
21 | .cm-s-monokai span.cm-def {color: #fd971f;}
22 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;}
23 | .cm-s-monokai span.cm-tag {color: #f92672;}
24 | .cm-s-monokai span.cm-link {color: #ae81ff;}
25 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
26 |
27 | .cm-s-monokai .CodeMirror-activeline-background {background: #373831 !important;}
28 | .cm-s-monokai .CodeMirror-matchingbracket {
29 | text-decoration: underline;
30 | color: white !important;
31 | }
32 |
--------------------------------------------------------------------------------
/theme-smart/assets/css/codeDemo.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 60px;
3 | }
4 | .code-toolbar {
5 | margin : 8px;
6 | }
7 |
8 | #mod {
9 | margin-right: 5px;
10 | font-weight: bold;
11 | }
12 | .htmlInput .CodeMirror{
13 | height : 200px;
14 | }
15 | .CodeMirror {
16 | position: relative;
17 | border:solid 2px #f8f8f8;
18 | margin-bottom : 10px;
19 | border-radius: 10px;
20 | }
21 | .CodeMirror:before {
22 | content : "html";
23 | display: block;
24 | position: absolute;
25 | top:0;
26 | left:100%;
27 | z-index: 999;
28 | color: #fff;
29 | width : 50px;
30 | margin-left:-50px;
31 | padding : 5px 0;
32 | text-align: center;
33 | /*font-style: italic;*/
34 | font-weight: bold;
35 | font-size: 16px;
36 | /*opacity : .6;*/
37 | }
38 | .htmlInput .CodeMirror:before {
39 | content : "Html";
40 | }
41 | .jsInput .CodeMirror:before {
42 | content : "JS";
43 | }
44 | #render {
45 | border-width : 0;
46 | width : 100%;
47 | height : 350px;
48 | }
--------------------------------------------------------------------------------
/theme-smart/assets/css/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/css/loading.gif
--------------------------------------------------------------------------------
/theme-smart/assets/css/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/css/logo.png
--------------------------------------------------------------------------------
/theme-smart/assets/css/showDemo.css:
--------------------------------------------------------------------------------
1 |
2 | #__show {
3 | margin : 5px 10px;
4 | }
5 | #__logs {
6 | margin : 5px 10px;
7 | font-size : 10px;
8 | }
9 | #__logs li {
10 | margin : 5px;
11 | padding : 5px;
12 | }
13 | #__logs p {
14 | margin : 0;
15 | }
16 | #__logs li.success {
17 | background-color: #a6e22e;
18 | }
19 | #__logs li.fail {
20 | background-color: #f92672;
21 | }
--------------------------------------------------------------------------------
/theme-smart/assets/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/favicon.png
--------------------------------------------------------------------------------
/theme-smart/assets/img/spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/img/spinner.gif
--------------------------------------------------------------------------------
/theme-smart/assets/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Redirector
5 |
6 |
7 |
8 | Click here to redirect
9 |
10 |
11 |
--------------------------------------------------------------------------------
/theme-smart/assets/js/code.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | var txtCode = $("#txtCode"),
3 | txtHtml = $("#txtHtml"),
4 | ifrRender = $('#render')[0],
5 | editor, htmlEditor, code, html;
6 |
7 | editor = CodeMirror.fromTextArea(txtCode[0], {
8 | lineNumbers: true,
9 | mode: "javascript",
10 | keyMap: "sublime",
11 | autoCloseBrackets: true,
12 | matchBrackets: true,
13 | showCursorWhenSelecting: true,
14 | theme: "monokai",
15 | lint: true,
16 | extraKeys: {
17 | "Ctrl-J": "autocomplete"
18 | },
19 | gutters: ["CodeMirror-lint-markers"]
20 | });
21 |
22 | htmlEditor = CodeMirror.fromTextArea(txtHtml[0], {
23 | lineNumbers: true,
24 | mode: "text/html",
25 | keyMap: "sublime",
26 | autoCloseBrackets: true,
27 | matchBrackets: true,
28 | showCursorWhenSelecting: true,
29 | theme: "monokai",
30 | extraKeys: {
31 | "Ctrl-J": "autocomplete"
32 | }
33 | })
34 |
35 |
36 | code = window.name;
37 | html = getCode('html');
38 | code = getCode('script') || (html && code);
39 |
40 | function getCode(type) {
41 | var index = code.indexOf('<'+ type + '>');
42 |
43 | if (index > -1) {
44 | return code.substring(index + type.length + 2, code.indexOf(''+ type + '>'));
45 | }
46 | }
47 |
48 | function resetCode() {
49 | editor.setValue(code);
50 | htmlEditor.setValue(html || '');
51 | ifrRender.src = "demo.html";
52 | }
53 | resetCode();
54 |
55 | $('#mod').text(location.search.substr(3));
56 |
57 | $('#btnRun').click(function() {
58 | var win = ifrRender.contentWindow;
59 | if(win && win.__st_render){
60 | win.__st_render(htmlEditor.getValue(),editor.getValue());
61 | }
62 | }).next().click(resetCode).next().click(function(){
63 | var code = editor.getValue(),
64 | html = htmlEditor.getValue();
65 |
66 | if(html)
67 | {
68 | code += '' + html + '';
69 | }
70 | window.open('show.html', code);
71 |
72 |
73 | });
74 |
75 | });
--------------------------------------------------------------------------------
/theme-smart/assets/js/demo.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var logs = document.getElementById('__logs'),win = window;
3 |
4 | win.__st_render = function (html,code) {
5 | html && (document.getElementById('__show').innerHTML = html);
6 | logs.innerHTML = '';
7 |
8 | if(code){
9 | eval('(function (){ \r\n try { \r\n' + code + "\r\n} \r\n catch(e) {\r\n __showErr(e); \r\n} \r\n})();")
10 | }
11 | }
12 |
13 | function __showErr(e){
14 | //ff下错误行捕获
15 | if(e.lineNumber){
16 | alert(e.message + '\n at JS ' + e.lineNumber);
17 | return;
18 | }
19 | else {
20 | var stack = e.stack;
21 | if(stack)
22 | {
23 | var arr = stack.split('\n'),
24 | msg = arr[0],
25 | code = arr[1];
26 |
27 | var index = code.lastIndexOf(':');
28 | index = code.lastIndexOf(':',--index);
29 | if(index > 0){
30 | var lines = code.substring(index + 1,code.length - 1).split(':');
31 | lines[0] = lines[0] * 1 - 2;
32 | alert(msg + '\n at JS ' + lines.join(':'));
33 | return;
34 | }
35 | }
36 | }
37 |
38 | alert(e);
39 | }
40 |
41 | function expect(result) {
42 | return new Tester(result);
43 | }
44 |
45 | function Tester(result) {
46 | this.ret = result;
47 | this.not = new Not(result);
48 | }
49 |
50 | Tester.prototype = {
51 | toBe: function(expectResult) {
52 | check(this, expectResult);
53 | },
54 | toEqual: function(expectResult) {
55 | check(this, expectResult, this.ret == expectResult);
56 | },
57 | toBeDefined: function() {
58 | check(this, 'defined', this.ret !== undefined);
59 | },
60 | toBeUndefined: function() {
61 | check(this, undefined);
62 | },
63 | toBeNull: function() {
64 | check(this, null);
65 | },
66 | toBeTruthy: function() {
67 | check(this, true);
68 | },
69 | toBeFalsy: function() {
70 | check(this, false);
71 | }
72 | }
73 |
74 | function Not(result) {
75 | this.ret = result;
76 | }
77 |
78 | Not.prototype = Tester.prototype;
79 |
80 |
81 | function check(tester, expectResult, success) {
82 | success === undefined && (success = tester.ret === expectResult);
83 | if (!tester.not)
84 | success = !success;
85 |
86 | var html = 'result : ' + tester.ret + '
expect : ' + expectResult;
87 | addLi(html,success ? 'success' : 'fail')
88 | }
89 |
90 | function log() {
91 | var item,args = arguments,i =0,len = args.length,result = [];
92 | for(;i < len; i++){
93 | item = args[i];
94 | if(item && typeof item === 'object' && window.JSON)
95 | item = window.JSON.stringify(item);
96 |
97 | result.push(item);
98 | }
99 |
100 | addLi('
log : ' + result.join(' , ') + '
');
101 | }
102 |
103 | function addLi(html,css){
104 | var li = document.createElement('li');
105 | css && (li.className = css);
106 | li.innerHTML = html;
107 | logs.appendChild(li);
108 | }
109 |
110 | })();
--------------------------------------------------------------------------------
/theme-smart/assets/js/show.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | var code = window.name,
3 | html = getCode('html');
4 | code = getCode('script') || code;
5 |
6 | function getCode(type) {
7 | var index = code.indexOf('<'+ type + '>');
8 |
9 | if (index > -1) {
10 | return code.substring(index + type.length + 2, code.indexOf(''+ type + '>'));
11 | }
12 | }
13 |
14 | if(window.__st_render)
15 | {
16 | window.__st_render(html,code);
17 | }
18 | })();
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/bootstrap/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/vendor/bootstrap/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/bootstrap/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhh77/smartDoc/26b370cb394b27c9b8bfdc391091bb0eef403e5f/theme-smart/assets/vendor/bootstrap/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/theme-smart/assets/vendor/prettify/prettify-min.css:
--------------------------------------------------------------------------------
1 | .com {color: #93a1a1;}.lit{ color: #195f91;}.pun,.opn,.clo { color: #93a1a1;}.fun { color: #dc322f;}.str,.atv {color: #D14;}.kwd, .prettyprint .tag { color: #1e347b; }.typ, .atn, .dec, .var { color: teal; }.pln { color: #48484c; }.prettyprint {padding: 8px;background-color: #f7f7f9;border: 1px solid #e1e1e8;}.prettyprint.linenums {-webkit-box-shadow: inset 45px 0 0 #fbfbfc, inset 46px 0 0 #ececf0;-moz-box-shadow: inset 45px 0 0 #fbfbfc, inset 46px 0 0 #ececf0;box-shadow: inset 45px 0 0 #fbfbfc, inset 46px 0 0 #ececf0;}ol.linenums {margin: 0 0 0 43px;}ol.linenums li {padding-left: 12px;color: #bebec5;line-height: 20px;text-shadow: 0 1px 0 #fff;}
--------------------------------------------------------------------------------
/theme-smart/helpers/helpers.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | publicClasses: function(context, options) {
3 | 'use strict';
4 | var ret = "";
5 |
6 | for(var i=0; i < context.length; i++) {
7 | if(!context[i].itemtype && context[i].access === 'public') {
8 | ret = ret + options.fn(context[i]);
9 | } else if (context[i].itemtype) {
10 | ret = ret + options.fn(context[i]);
11 | }
12 | }
13 |
14 | return ret;
15 | },
16 | search : function(classes, modules) {
17 | 'use strict';
18 | var ret = '';
19 |
20 | for(var i=0; i < classes.length; i++) {
21 | if(i > 0) {
22 | ret += ', ';
23 | }
24 | ret += "\"" + 'classes/' + classes[i].displayName + "\"";
25 | }
26 |
27 | if(ret.length > 0 && modules.length > 0) {
28 | ret += ', ';
29 | }
30 |
31 | for(var j=0; j < modules.length; j++) {
32 | if(j > 0) {
33 | ret += ', ';
34 | }
35 | ret += "\"" + 'modules/' + modules[j].displayName + "\"";
36 | }
37 |
38 | return ret;
39 |
40 |
41 | }
42 | };
43 |
--------------------------------------------------------------------------------
/theme-smart/layouts/demo.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Smart Demo Show
6 |
7 |
8 |
9 | {{#css}}
10 |
11 | {{/css}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | {{#script}}
27 |
28 | {{/script}}
29 |
30 |
--------------------------------------------------------------------------------
/theme-smart/layouts/main.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{htmlTitle}}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
31 |
32 |
33 | {{#projectNavs}}
34 | {{name}}
35 |
36 | {{/projectNavs}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | {{>sidebar}}
46 |
47 |
48 |
49 |
50 | {{>layout_content}}
51 |
52 |
53 |
54 |
55 |
56 | Top
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/theme-smart/layouts/xhr.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{>layout_content}}
4 |
5 |
6 |
7 | {{title}}
8 |
--------------------------------------------------------------------------------
/theme-smart/partials/attrs.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
{{! For backwards compatibility }}
3 |
{{name}}
4 |
{{#crossLink type}}{{/crossLink}}
5 |
6 | {{#if deprecated}}
7 |
deprecated
8 | {{/if}}
9 |
10 | {{#if access}}
11 |
{{access}}
12 | {{/if}}
13 |
14 | {{#if final}}
15 |
final
16 | {{/if}}
17 |
18 | {{#if static}}
19 |
static
20 | {{/if}}
21 |
22 | {{#if optional}}
23 |
optional
24 | {{/if}}
25 |
26 | {{#if required}}
27 |
required
28 | {{/if}}
29 |
30 | {{#if readonly}}
31 |
readonly
32 | {{/if}}
33 |
34 |
70 |
71 |
72 | {{{attrDescription}}}
73 |
74 |
75 | {{#if default}}
76 |
Default: {{default}}
77 | {{/if}}
78 |
79 | {{#if emit}}
80 |
81 |
Fires event {{name}}Change
82 |
83 |
84 | Fires when the value for the configuration attribute `{{{name}}}` is
85 | changed. You can listen for the event using the `on` method if you
86 | wish to be notified before the attribute's value has changed, or
87 | using the `after` method if you wish to be notified after the
88 | attribute's value has changed.
89 |
90 |
91 |
92 |
Parameters:
93 |
94 |
128 |
129 |
130 | {{/if}}
131 |
132 | {{#example}}
133 |
134 |
Example:
135 |
136 |
137 | {{{.}}}
138 |
139 |
140 | {{/example}}
141 |
142 |
--------------------------------------------------------------------------------
/theme-smart/partials/classes.handlebars:
--------------------------------------------------------------------------------
1 |
4 |
5 | {{{classDescription}}}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Methods
13 | {{#if methods}}
14 |
15 | {{#methods}}
16 |
17 | {{name}}
18 |
19 | {{#if static}}
20 | static
21 | {{/if}}
22 | {{#if deprecated}}
23 | deprecated
24 | {{/if}}
25 |
26 | {{/methods}}
27 |
28 | {{/if}}
29 |
30 |
31 |
32 |
Properties
33 | {{#if properties}}
34 |
35 | {{#properties}}
36 |
37 | {{name}}
38 |
39 | {{#if static}}
40 | static
41 | {{/if}}
42 | {{#if deprecated}}
43 | deprecated
44 | {{/if}}
45 |
46 | {{/properties}}
47 |
48 | {{/if}}
49 |
50 |
51 |
52 |
Events
53 | {{#if events}}
54 |
55 | {{#events}}
56 |
57 | {{name}}
58 |
59 | {{#if static}}
60 | static
61 | {{/if}}
62 | {{#if deprecated}}
63 | deprecated
64 | {{/if}}
65 |
66 | {{/events}}
67 |
68 | {{/if}}
69 |
70 |
71 |
72 |
73 |
74 |
75 | Detail
76 | {{#if methods}}
77 | Methods
78 | {{/if}}
79 | {{#if properties}}
80 | Properties
81 | {{/if}}
82 | {{#if events}}
83 | Events
84 | {{/if}}
85 |
86 |
87 |
88 |
89 |
90 | {{#if uses}}
91 |
92 | Uses
93 |
94 | {{#uses}}
95 | {{.}}
96 | {{/uses}}
97 |
98 |
99 | {{/if}}
100 |
101 | {{#if extends}}
102 |
103 | Extends {{#crossLink extends}}{{/crossLink}}
104 |
105 | {{/if}}
106 |
107 | {{#if foundAt}}
108 |
111 | {{/if}}
112 |
113 | {{#if module}}
114 | {{#if submodule}}
115 | Module: {{#crossLinkModule submodule}}{{/crossLinkModule}}
116 | Parent Module: {{#crossLinkModule module}}{{/crossLinkModule}}
117 | {{else}}
118 | Module: {{#crossLinkModule module}}{{/crossLinkModule}}
119 | {{/if}}
120 | {{/if}}
121 |
122 | {{#if since}}
123 |
Available since {{since}}
124 | {{/if}}
125 |
126 |
127 | {{#if deprecated}}
128 |
129 |
130 | {{#if deprecationMessage}}
131 | Deprecated: {{deprecationMessage}}
132 | {{else}}
133 | This class is deprecated.
134 | {{/if}}
135 |
136 |
137 | {{/if}}
138 | {{#is_constructor}}
139 |
140 |
Constructor
141 | {{>method}}
142 |
143 | {{/is_constructor}}
144 |
145 |
146 | {{#if methods}}
147 |
148 |
Methods
149 |
150 | {{#methods}}
151 | {{>method}}
152 | {{/methods}}
153 |
154 | {{/if}}
155 |
156 | {{#if properties}}
157 |
158 |
Properties
159 |
160 | {{#properties}}
161 | {{>props}}
162 | {{/properties}}
163 |
164 | {{/if}}
165 |
166 | {{#if events}}
167 |
168 |
Events
169 |
170 | {{#events}}
171 | {{>events}}
172 | {{/events}}
173 |
174 | {{/if}}
175 |
176 |
177 |
--------------------------------------------------------------------------------
/theme-smart/partials/events.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
{{name}}
3 |
{{#crossLink type}}{{/crossLink}}
4 |
5 | {{#if deprecated}}
6 |
deprecated
7 | {{/if}}
8 |
9 | {{#if access}}
10 |
{{access}}
11 | {{/if}}
12 |
13 | {{#if final}}
14 |
final
15 | {{/if}}
16 |
17 | {{#if static}}
18 |
static
19 | {{/if}}
20 |
21 |
57 |
58 | {{{eventDescription}}}
59 |
60 |
61 | {{#if params}}
62 |
63 |
Parameters:
64 |
65 |
66 | name type flag description
67 | {{#params}}
68 |
69 | {{#if optional}}
70 |
71 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]
72 | {{#crossLink type}}{{/crossLink}}
73 | optional
74 | {{else}}
75 | {{name}}
76 | {{#crossLink type}}{{/crossLink}}
77 |
78 | {{/if}}
79 |
80 | {{#if multiple}}
81 | multiple
82 | {{/if}}
83 |
84 |
85 | {{{description}}}
86 |
87 |
88 | {{#if props}}
89 |
90 | name type flag description
91 | {{#props}}
92 |
93 | {{#if optional}}
94 |
95 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]
96 | {{#crossLink type}}{{/crossLink}}
97 | optional
98 | {{else}}
99 | {{name}}
100 | {{#crossLink type}}{{/crossLink}}
101 |
102 | {{/if}}
103 |
104 | {{#if multiple}}
105 | multiple
106 | {{/if}}
107 |
108 |
109 | {{{description}}}
110 |
111 | {{#if props}}
112 |
113 | name type flag description
114 | {{#props}}
115 |
116 | {{#if optional}}
117 |
118 | [{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]
119 | {{#crossLink type}}{{/crossLink}}
120 | optional
121 | {{else}}
122 | {{name}}
123 | {{#crossLink type}}{{/crossLink}}
124 |
125 | {{/if}}
126 |
127 | {{#if multiple}}
128 | multiple
129 | {{/if}}
130 |
131 |
132 | {{{description}}}
133 |
134 |
135 |
136 | {{/props}}
137 |
138 |
139 | {{/if}}
140 |
141 | {{/props}}
142 |
143 |
144 | {{/if}}
145 |
146 | {{/params}}
147 |
148 |
149 | {{/if}}
150 |
151 |
152 | {{#example}}
153 |
154 |
Example:
155 |
156 |
157 | {{{.}}}
158 |
159 |
view demo
160 |
edit code
161 |
162 | {{/example}}
163 |
164 |
--------------------------------------------------------------------------------
/theme-smart/partials/files.handlebars:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | {{fileData}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/theme-smart/partials/index.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{#if projectDescription}}
4 | {{{projectDescription}}}
5 | {{else}}
6 |
{{{projectName}}}
7 |
8 | Please type keyword to search api in SearchBox on the top navbar.
9 | Please click the Left Nav to view the detail.
10 | Using the filter box to search modules and classes
11 | In Example Panel,Click the [view domo] button will popup demo page and click [edit code] then you will eidt the example code online
12 |
13 | {{/if}}
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/theme-smart/partials/module.handlebars:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {{#extra}}
7 | {{#selleck}}
8 |
User Guide & Examples
9 | {{/selleck}}
10 | {{/extra}}
11 |
12 | {{#if requires}}
13 |
14 | Requires
15 |
16 | {{#requires}}
17 | {{#crossLinkModule .}}{{/crossLinkModule}}
18 | {{/requires}}
19 |
20 |
21 | {{/if}}
22 |
23 | {{#if foundAt}}
24 |
27 | {{/if}}
28 |
29 | {{#if since}}
30 |
Available since {{since}}
31 | {{/if}}
32 |
33 |
34 | {{#if deprecated}}
35 |
36 |
37 | {{#if deprecationMessage}}
38 | Deprecated: {{deprecationMessage}}
39 | {{else}}
40 | This module is deprecated.
41 | {{/if}}
42 |
43 |
44 | {{/if}}
45 |
46 |
47 | {{{moduleDescription}}}
48 |
49 |
50 | {{#example}}
51 |
52 |
Example:
53 |
54 | {{{.}}}
55 |
56 |
view demo
57 |
edit code
58 |
59 | {{/example}}
60 |
61 |
62 |
63 | {{#if moduleClasses}}
64 |
This module provides the following classes:
65 |
66 |
75 | {{/if}}
76 |
77 |
78 |
79 | {{#if subModules}}
80 |
This module is a rollup of the following modules:
81 |
82 |
95 | {{/if}}
96 |
97 |
98 |
--------------------------------------------------------------------------------
/theme-smart/partials/options.handlebars:
--------------------------------------------------------------------------------
1 |
23 |
24 |
--------------------------------------------------------------------------------
/theme-smart/partials/props.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
{{name}}
3 |
{{#crossLink type}}{{/crossLink}}
4 |
5 | {{#if deprecated}}
6 |
deprecated
7 | {{/if}}
8 |
9 | {{#if access}}
10 |
{{access}}
11 | {{/if}}
12 |
13 | {{#if final}}
14 |
final
15 | {{/if}}
16 |
17 | {{#if static}}
18 |
static
19 | {{/if}}
20 |
21 |
57 |
58 |
59 | {{{propertyDescription}}}
60 |
61 |
62 | {{#if default}}
63 |
Default:
64 |
{{default}}
65 | {{/if}}
66 |
67 | {{#example}}
68 |
69 |
Example:
70 |
71 |
72 | {{{.}}}
73 |
74 |
75 | {{/example}}
76 |
77 | {{#if subprops}}
78 |
Sub-properties:
79 |
80 |
119 | {{/if}}
120 |
121 |
--------------------------------------------------------------------------------
/theme-smart/partials/sidebar.handlebars:
--------------------------------------------------------------------------------
1 |
34 |
--------------------------------------------------------------------------------