swagr 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/Rakefile +20 -0
  2. data/bin/swagr +37 -9
  3. data/examples/examples01/app.rb +5 -1
  4. data/examples/examples01/views/edit.slim +31 -0
  5. data/examples/examples01/views/footer.slim +1 -1
  6. data/examples/examples01/views/layout.slim +23 -5
  7. data/examples/examples01/views/navbar.slim +17 -16
  8. data/lib/swagr/version.rb +3 -1
  9. data/templates/app.rb +5 -1
  10. data/templates/static/js/codemirror/keymap/vim.js +279 -66
  11. data/templates/static/js/codemirror/lib/codemirror.css +10 -9
  12. data/templates/static/js/codemirror/lib/codemirror.js +385 -152
  13. data/templates/static/js/codemirror/mode/apl/apl.js +160 -0
  14. data/templates/static/js/codemirror/mode/apl/index.html +61 -0
  15. data/templates/static/js/codemirror/mode/asterisk/asterisk.js +183 -0
  16. data/templates/static/js/codemirror/mode/asterisk/index.html +142 -0
  17. data/templates/static/js/codemirror/mode/clike/clike.js +2 -0
  18. data/templates/static/js/codemirror/mode/clike/index.html +1 -1
  19. data/templates/static/js/codemirror/mode/clike/scala.html +1 -1
  20. data/templates/static/js/codemirror/mode/clojure/clojure.js +3 -3
  21. data/templates/static/js/codemirror/mode/css/css.js +2 -2
  22. data/templates/static/js/codemirror/mode/css/test.js +76 -471
  23. data/templates/static/js/codemirror/mode/d/d.js +205 -0
  24. data/templates/static/js/codemirror/mode/d/index.html +262 -0
  25. data/templates/static/js/codemirror/mode/erlang/index.html +1 -1
  26. data/templates/static/js/codemirror/mode/gfm/gfm.js +2 -1
  27. data/templates/static/js/codemirror/mode/gfm/index.html +1 -2
  28. data/templates/static/js/codemirror/mode/gfm/test.js +84 -225
  29. data/templates/static/js/codemirror/mode/go/index.html +1 -1
  30. data/templates/static/js/codemirror/mode/groovy/index.html +1 -1
  31. data/templates/static/js/codemirror/mode/haskell/index.html +1 -1
  32. data/templates/static/js/codemirror/mode/javascript/index.html +2 -2
  33. data/templates/static/js/codemirror/mode/javascript/javascript.js +13 -2
  34. data/templates/static/js/codemirror/mode/less/index.html +1 -1
  35. data/templates/static/js/codemirror/mode/lua/index.html +1 -1
  36. data/templates/static/js/codemirror/mode/markdown/index.html +1 -1
  37. data/templates/static/js/codemirror/mode/markdown/markdown.js +8 -7
  38. data/templates/static/js/codemirror/mode/markdown/test.js +579 -1266
  39. data/templates/static/js/codemirror/mode/meta.js +71 -0
  40. data/templates/static/js/codemirror/mode/mysql/index.html +2 -0
  41. data/templates/static/js/codemirror/mode/ocaml/index.html +1 -1
  42. data/templates/static/js/codemirror/mode/php/index.html +1 -1
  43. data/templates/static/js/codemirror/mode/plsql/index.html +2 -0
  44. data/templates/static/js/codemirror/mode/python/index.html +1 -1
  45. data/templates/static/js/codemirror/mode/ruby/index.html +1 -1
  46. data/templates/static/js/codemirror/mode/sass/index.html +54 -0
  47. data/templates/static/js/codemirror/mode/sass/sass.js +349 -0
  48. data/templates/static/js/codemirror/mode/shell/index.html +1 -1
  49. data/templates/static/js/codemirror/mode/sieve/LICENSE +0 -4
  50. data/templates/static/js/codemirror/mode/sieve/sieve.js +37 -10
  51. data/templates/static/js/codemirror/mode/smalltalk/index.html +1 -1
  52. data/templates/static/js/codemirror/mode/sparql/index.html +1 -1
  53. data/templates/static/js/codemirror/mode/sql/index.html +68 -0
  54. data/templates/static/js/codemirror/mode/sql/sql.js +268 -0
  55. data/templates/static/js/codemirror/mode/stex/test.js +104 -343
  56. data/templates/static/js/codemirror/mode/tiddlywiki/index.html +1 -1
  57. data/templates/static/js/codemirror/mode/vb/index.html +1 -1
  58. data/templates/static/js/codemirror/mode/xquery/test.js +54 -67
  59. data/templates/static/js/codemirror/mode/xquery/xquery.js +8 -8
  60. data/templates/static/js/crossfilter.min.js +1 -0
  61. data/templates/views/edit.slim +31 -0
  62. data/templates/views/footer.slim +1 -1
  63. data/templates/views/layout.slim +23 -5
  64. data/templates/views/navbar.slim +17 -16
  65. metadata +16 -30
  66. data/examples/examples01/static/css/codemirror.css +0 -1247
  67. data/examples/examples01/static/js/codemirror-compressed-3-0.js +0 -5
  68. data/examples/examples01/views/about.slim +0 -15
  69. data/examples/examples01/views/application.slim +0 -0
  70. data/examples/examples01/views/layout_cm.slim +0 -17
  71. data/templates/static/js/codemirror/lib/util/closetag.js +0 -85
  72. data/templates/static/js/codemirror/lib/util/colorize.js +0 -29
  73. data/templates/static/js/codemirror/lib/util/continuecomment.js +0 -36
  74. data/templates/static/js/codemirror/lib/util/continuelist.js +0 -28
  75. data/templates/static/js/codemirror/lib/util/dialog.css +0 -32
  76. data/templates/static/js/codemirror/lib/util/dialog.js +0 -75
  77. data/templates/static/js/codemirror/lib/util/foldcode.js +0 -182
  78. data/templates/static/js/codemirror/lib/util/formatting.js +0 -108
  79. data/templates/static/js/codemirror/lib/util/javascript-hint.js +0 -137
  80. data/templates/static/js/codemirror/lib/util/loadmode.js +0 -51
  81. data/templates/static/js/codemirror/lib/util/match-highlighter.js +0 -46
  82. data/templates/static/js/codemirror/lib/util/matchbrackets.js +0 -63
  83. data/templates/static/js/codemirror/lib/util/multiplex.js +0 -95
  84. data/templates/static/js/codemirror/lib/util/overlay.js +0 -59
  85. data/templates/static/js/codemirror/lib/util/pig-hint.js +0 -117
  86. data/templates/static/js/codemirror/lib/util/runmode-standalone.js +0 -90
  87. data/templates/static/js/codemirror/lib/util/runmode.js +0 -52
  88. data/templates/static/js/codemirror/lib/util/search.js +0 -119
  89. data/templates/static/js/codemirror/lib/util/searchcursor.js +0 -119
  90. data/templates/static/js/codemirror/lib/util/simple-hint.css +0 -16
  91. data/templates/static/js/codemirror/lib/util/simple-hint.js +0 -102
  92. data/templates/static/js/codemirror/lib/util/xml-hint.js +0 -131
  93. data/templates/views/about.slim +0 -15
@@ -1,16 +0,0 @@
1
- .CodeMirror-completions {
2
- position: absolute;
3
- z-index: 10;
4
- overflow: hidden;
5
- -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
6
- -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
7
- box-shadow: 2px 3px 5px rgba(0,0,0,.2);
8
- }
9
- .CodeMirror-completions select {
10
- background: #fafafa;
11
- outline: none;
12
- border: none;
13
- padding: 0;
14
- margin: 0;
15
- font-family: monospace;
16
- }
@@ -1,102 +0,0 @@
1
- (function() {
2
- CodeMirror.simpleHint = function(editor, getHints, givenOptions) {
3
- // Determine effective options based on given values and defaults.
4
- var options = {}, defaults = CodeMirror.simpleHint.defaults;
5
- for (var opt in defaults)
6
- if (defaults.hasOwnProperty(opt))
7
- options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
8
-
9
- function collectHints(previousToken) {
10
- // We want a single cursor position.
11
- if (editor.somethingSelected()) return;
12
-
13
- var tempToken = editor.getTokenAt(editor.getCursor());
14
-
15
- // Don't show completions if token has changed and the option is set.
16
- if (options.closeOnTokenChange && previousToken != null &&
17
- (tempToken.start != previousToken.start || tempToken.type != previousToken.type)) {
18
- return;
19
- }
20
-
21
- var result = getHints(editor, givenOptions);
22
- if (!result || !result.list.length) return;
23
- var completions = result.list;
24
- function insert(str) {
25
- editor.replaceRange(str, result.from, result.to);
26
- }
27
- // When there is only one completion, use it directly.
28
- if (options.completeSingle && completions.length == 1) {
29
- insert(completions[0]);
30
- return true;
31
- }
32
-
33
- // Build the select widget
34
- var complete = document.createElement("div");
35
- complete.className = "CodeMirror-completions";
36
- var sel = complete.appendChild(document.createElement("select"));
37
- // Opera doesn't move the selection when pressing up/down in a
38
- // multi-select, but it does properly support the size property on
39
- // single-selects, so no multi-select is necessary.
40
- if (!window.opera) sel.multiple = true;
41
- for (var i = 0; i < completions.length; ++i) {
42
- var opt = sel.appendChild(document.createElement("option"));
43
- opt.appendChild(document.createTextNode(completions[i]));
44
- }
45
- sel.firstChild.selected = true;
46
- sel.size = Math.min(10, completions.length);
47
- var pos = editor.cursorCoords(options.alignWithWord ? result.from : null);
48
- complete.style.left = pos.left + "px";
49
- complete.style.top = pos.bottom + "px";
50
- document.body.appendChild(complete);
51
- // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
52
- var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
53
- if(winW - pos.left < sel.clientWidth)
54
- complete.style.left = (pos.left - sel.clientWidth) + "px";
55
- // Hack to hide the scrollbar.
56
- if (completions.length <= 10)
57
- complete.style.width = (sel.clientWidth - 1) + "px";
58
-
59
- var done = false;
60
- function close() {
61
- if (done) return;
62
- done = true;
63
- complete.parentNode.removeChild(complete);
64
- }
65
- function pick() {
66
- insert(completions[sel.selectedIndex]);
67
- close();
68
- setTimeout(function(){editor.focus();}, 50);
69
- }
70
- CodeMirror.on(sel, "blur", close);
71
- CodeMirror.on(sel, "keydown", function(event) {
72
- var code = event.keyCode;
73
- // Enter
74
- if (code == 13) {CodeMirror.e_stop(event); pick();}
75
- // Escape
76
- else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
77
- else if (code != 38 && code != 40 && code != 33 && code != 34 && !CodeMirror.isModifierKey(event)) {
78
- close(); editor.focus();
79
- // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
80
- editor.triggerOnKeyDown(event);
81
- // Don't show completions if the code is backspace and the option is set.
82
- if (!options.closeOnBackspace || code != 8) {
83
- setTimeout(function(){collectHints(tempToken);}, 50);
84
- }
85
- }
86
- });
87
- CodeMirror.on(sel, "dblclick", pick);
88
-
89
- sel.focus();
90
- // Opera sometimes ignores focusing a freshly created node
91
- if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
92
- return true;
93
- }
94
- return collectHints();
95
- };
96
- CodeMirror.simpleHint.defaults = {
97
- closeOnBackspace: true,
98
- closeOnTokenChange: false,
99
- completeSingle: true,
100
- alignWithWord: true
101
- };
102
- })();
@@ -1,131 +0,0 @@
1
-
2
- (function() {
3
-
4
- CodeMirror.xmlHints = [];
5
-
6
- CodeMirror.xmlHint = function(cm, simbol) {
7
-
8
- if(simbol.length > 0) {
9
- var cursor = cm.getCursor();
10
- cm.replaceSelection(simbol);
11
- cursor = {line: cursor.line, ch: cursor.ch + 1};
12
- cm.setCursor(cursor);
13
- }
14
-
15
- CodeMirror.simpleHint(cm, getHint);
16
- };
17
-
18
- var getHint = function(cm) {
19
-
20
- var cursor = cm.getCursor();
21
-
22
- if (cursor.ch > 0) {
23
-
24
- var text = cm.getRange({line: 0, ch: 0}, cursor);
25
- var typed = '';
26
- var simbol = '';
27
- for(var i = text.length - 1; i >= 0; i--) {
28
- if(text[i] == ' ' || text[i] == '<') {
29
- simbol = text[i];
30
- break;
31
- }
32
- else {
33
- typed = text[i] + typed;
34
- }
35
- }
36
-
37
- text = text.slice(0, text.length - typed.length);
38
-
39
- var path = getActiveElement(text) + simbol;
40
- var hints = CodeMirror.xmlHints[path];
41
-
42
- if(typeof hints === 'undefined')
43
- hints = [''];
44
- else {
45
- hints = hints.slice(0);
46
- for (var i = hints.length - 1; i >= 0; i--) {
47
- if(hints[i].indexOf(typed) != 0)
48
- hints.splice(i, 1);
49
- }
50
- }
51
-
52
- return {
53
- list: hints,
54
- from: { line: cursor.line, ch: cursor.ch - typed.length },
55
- to: cursor
56
- };
57
- };
58
- };
59
-
60
- var getActiveElement = function(text) {
61
-
62
- var element = '';
63
-
64
- if(text.length >= 0) {
65
-
66
- var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g');
67
-
68
- var matches = [];
69
- var match;
70
- while ((match = regex.exec(text)) != null) {
71
- matches.push({
72
- tag: match[1],
73
- selfclose: (match[0].slice(match[0].length - 2) === '/>')
74
- });
75
- }
76
-
77
- for (var i = matches.length - 1, skip = 0; i >= 0; i--) {
78
-
79
- var item = matches[i];
80
-
81
- if (item.tag[0] == '/')
82
- {
83
- skip++;
84
- }
85
- else if (item.selfclose == false)
86
- {
87
- if (skip > 0)
88
- {
89
- skip--;
90
- }
91
- else
92
- {
93
- element = '<' + item.tag + '>' + element;
94
- }
95
- }
96
- }
97
-
98
- element += getOpenTag(text);
99
- }
100
-
101
- return element;
102
- };
103
-
104
- var getOpenTag = function(text) {
105
-
106
- var open = text.lastIndexOf('<');
107
- var close = text.lastIndexOf('>');
108
-
109
- if (close < open)
110
- {
111
- text = text.slice(open);
112
-
113
- if(text != '<') {
114
-
115
- var space = text.indexOf(' ');
116
- if(space < 0)
117
- space = text.indexOf('\t');
118
- if(space < 0)
119
- space = text.indexOf('\n');
120
-
121
- if (space < 0)
122
- space = text.length;
123
-
124
- return text.slice(0, space);
125
- }
126
- }
127
-
128
- return '';
129
- };
130
-
131
- })();
@@ -1,15 +0,0 @@
1
- h1 Let's try in-browser code editing
2
-
3
- /! script src="js/coffee-script.js" type="text/javascript"
4
- div class="container" id="code"
5
- textarea id="editor" cols="50" rows="10" style="width:30%"
6
- | # Hello
7
- # This looks ok. How very nice!
8
- a = 1 + 2
9
-
10
- script type="text/javascript"
11
- | var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
12
- lineNumbers: true,
13
- mode: "ruby",
14
- theme: "lesser-dark"
15
- });