erp_app 3.0.10 → 3.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/lib/erp_app/version.rb +1 -1
  2. data/public/javascripts/erp_app/codemirror/README.md +1 -1
  3. data/public/javascripts/erp_app/codemirror/doc/compress.html +11 -3
  4. data/public/javascripts/erp_app/codemirror/doc/docs.css +16 -5
  5. data/public/javascripts/erp_app/codemirror/doc/internals.html +6 -3
  6. data/public/javascripts/erp_app/codemirror/doc/manual.html +103 -41
  7. data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +43 -5
  8. data/public/javascripts/erp_app/codemirror/doc/reporting.html +6 -3
  9. data/public/javascripts/erp_app/codemirror/doc/upgrade_v2.2.html +7 -4
  10. data/public/javascripts/erp_app/codemirror/keymap/vim.js +10 -6
  11. data/public/javascripts/erp_app/codemirror/lib/codemirror.css +16 -12
  12. data/public/javascripts/erp_app/codemirror/lib/codemirror.js +699 -787
  13. data/public/javascripts/erp_app/codemirror/lib/util/closetag.js +35 -35
  14. data/public/javascripts/erp_app/codemirror/lib/util/dialog.js +4 -1
  15. data/public/javascripts/erp_app/codemirror/lib/util/formatting.js +147 -253
  16. data/public/javascripts/erp_app/codemirror/lib/util/javascript-hint.js +3 -3
  17. data/public/javascripts/erp_app/codemirror/lib/util/loadmode.js +1 -1
  18. data/public/javascripts/erp_app/codemirror/lib/util/multiplex.js +5 -9
  19. data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +3 -1
  20. data/public/javascripts/erp_app/codemirror/lib/util/pig-hint.js +1 -1
  21. data/public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js +90 -0
  22. data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +8 -4
  23. data/public/javascripts/erp_app/codemirror/lib/util/search.js +4 -4
  24. data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +13 -11
  25. data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +89 -68
  26. data/public/javascripts/erp_app/codemirror/lib/util/xml-hint.js +8 -8
  27. data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +6 -2
  28. data/public/javascripts/erp_app/codemirror/mode/clike/index.html +1 -0
  29. data/public/javascripts/erp_app/codemirror/mode/clike/scala.html +1 -0
  30. data/public/javascripts/erp_app/codemirror/mode/clojure/clojure.js +8 -9
  31. data/public/javascripts/erp_app/codemirror/mode/clojure/index.html +1 -0
  32. data/public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js +3 -3
  33. data/public/javascripts/erp_app/codemirror/mode/coffeescript/index.html +1 -0
  34. data/public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js +101 -0
  35. data/public/javascripts/erp_app/codemirror/mode/commonlisp/index.html +165 -0
  36. data/public/javascripts/erp_app/codemirror/mode/css/css.js +339 -15
  37. data/public/javascripts/erp_app/codemirror/mode/css/index.html +3 -0
  38. data/public/javascripts/erp_app/codemirror/mode/css/test.js +501 -0
  39. data/public/javascripts/erp_app/codemirror/mode/diff/index.html +1 -0
  40. data/public/javascripts/erp_app/codemirror/mode/ecl/ecl.js +1 -1
  41. data/public/javascripts/erp_app/codemirror/mode/erlang/index.html +1 -0
  42. data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +10 -4
  43. data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +1 -0
  44. data/public/javascripts/erp_app/codemirror/mode/go/go.js +2 -2
  45. data/public/javascripts/erp_app/codemirror/mode/go/index.html +1 -0
  46. data/public/javascripts/erp_app/codemirror/mode/groovy/groovy.js +1 -1
  47. data/public/javascripts/erp_app/codemirror/mode/groovy/index.html +1 -0
  48. data/public/javascripts/erp_app/codemirror/mode/haskell/haskell.js +2 -2
  49. data/public/javascripts/erp_app/codemirror/mode/haskell/index.html +1 -0
  50. data/public/javascripts/erp_app/codemirror/mode/haxe/haxe.js +4 -7
  51. data/public/javascripts/erp_app/codemirror/mode/haxe/index.html +1 -0
  52. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +8 -4
  53. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/index.html +1 -0
  54. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/htmlmixed.js +12 -13
  55. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/index.html +1 -0
  56. data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +1 -0
  57. data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +3 -3
  58. data/public/javascripts/erp_app/codemirror/mode/jinja2/index.html +1 -0
  59. data/public/javascripts/erp_app/codemirror/mode/less/index.html +124 -2
  60. data/public/javascripts/erp_app/codemirror/mode/less/less.js +94 -60
  61. data/public/javascripts/erp_app/codemirror/mode/lua/index.html +1 -0
  62. data/public/javascripts/erp_app/codemirror/mode/markdown/index.html +3 -0
  63. data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +134 -20
  64. data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +1084 -0
  65. data/public/javascripts/erp_app/codemirror/mode/mysql/index.html +1 -0
  66. data/public/javascripts/erp_app/codemirror/mode/ntriples/index.html +1 -0
  67. data/public/javascripts/erp_app/codemirror/mode/ntriples/ntriples.js +4 -4
  68. data/public/javascripts/erp_app/codemirror/mode/ocaml/ocaml.js +1 -1
  69. data/public/javascripts/erp_app/codemirror/mode/pascal/index.html +1 -0
  70. data/public/javascripts/erp_app/codemirror/mode/pascal/pascal.js +1 -1
  71. data/public/javascripts/erp_app/codemirror/mode/perl/index.html +1 -0
  72. data/public/javascripts/erp_app/codemirror/mode/perl/perl.js +71 -71
  73. data/public/javascripts/erp_app/codemirror/mode/php/index.html +1 -0
  74. data/public/javascripts/erp_app/codemirror/mode/php/php.js +7 -9
  75. data/public/javascripts/erp_app/codemirror/mode/pig/index.html +1 -0
  76. data/public/javascripts/erp_app/codemirror/mode/pig/pig.js +3 -3
  77. data/public/javascripts/erp_app/codemirror/mode/plsql/index.html +1 -0
  78. data/public/javascripts/erp_app/codemirror/mode/properties/index.html +1 -0
  79. data/public/javascripts/erp_app/codemirror/mode/python/index.html +1 -0
  80. data/public/javascripts/erp_app/codemirror/mode/python/python.js +1 -1
  81. data/public/javascripts/erp_app/codemirror/mode/r/index.html +1 -0
  82. data/public/javascripts/erp_app/codemirror/mode/rpm/changes/index.html +1 -0
  83. data/public/javascripts/erp_app/codemirror/mode/rpm/spec/index.html +1 -0
  84. data/public/javascripts/erp_app/codemirror/mode/rst/index.html +1 -0
  85. data/public/javascripts/erp_app/codemirror/mode/ruby/index.html +1 -0
  86. data/public/javascripts/erp_app/codemirror/mode/rust/index.html +1 -0
  87. data/public/javascripts/erp_app/codemirror/mode/scheme/index.html +1 -0
  88. data/public/javascripts/erp_app/codemirror/mode/scheme/scheme.js +1 -1
  89. data/public/javascripts/erp_app/codemirror/mode/shell/shell.js +2 -2
  90. data/public/javascripts/erp_app/codemirror/mode/sieve/LICENSE +23 -0
  91. data/public/javascripts/erp_app/codemirror/mode/sieve/index.html +81 -0
  92. data/public/javascripts/erp_app/codemirror/mode/sieve/sieve.js +156 -0
  93. data/public/javascripts/erp_app/codemirror/mode/smalltalk/index.html +1 -0
  94. data/public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js +2 -2
  95. data/public/javascripts/erp_app/codemirror/mode/smarty/index.html +1 -0
  96. data/public/javascripts/erp_app/codemirror/mode/smarty/smarty.js +2 -2
  97. data/public/javascripts/erp_app/codemirror/mode/sparql/index.html +1 -0
  98. data/public/javascripts/erp_app/codemirror/mode/stex/index.html +3 -0
  99. data/public/javascripts/erp_app/codemirror/mode/stex/stex.js +1 -1
  100. data/public/javascripts/erp_app/codemirror/mode/stex/test.js +343 -0
  101. data/public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html +1 -0
  102. data/public/javascripts/erp_app/codemirror/mode/tiki/index.html +1 -0
  103. data/public/javascripts/erp_app/codemirror/mode/tiki/tiki.js +4 -11
  104. data/public/javascripts/erp_app/codemirror/mode/vb/index.html +1 -0
  105. data/public/javascripts/erp_app/codemirror/mode/vb/vb.js +2 -2
  106. data/public/javascripts/erp_app/codemirror/mode/vbscript/index.html +1 -0
  107. data/public/javascripts/erp_app/codemirror/mode/velocity/index.html +1 -0
  108. data/public/javascripts/erp_app/codemirror/mode/velocity/velocity.js +1 -1
  109. data/public/javascripts/erp_app/codemirror/mode/verilog/index.html +1 -0
  110. data/public/javascripts/erp_app/codemirror/mode/verilog/verilog.js +1 -1
  111. data/public/javascripts/erp_app/codemirror/mode/xml/index.html +2 -1
  112. data/public/javascripts/erp_app/codemirror/mode/xml/xml.js +2 -10
  113. data/public/javascripts/erp_app/codemirror/mode/xquery/index.html +3 -2
  114. data/public/javascripts/erp_app/codemirror/mode/xquery/xquery.js +7 -4
  115. data/public/javascripts/erp_app/codemirror/mode/yaml/index.html +1 -0
  116. data/public/javascripts/erp_app/codemirror/package.json +15 -23
  117. data/public/javascripts/erp_app/codemirror/test/driver.js +109 -22
  118. data/public/javascripts/erp_app/codemirror/test/index.html +129 -16
  119. data/public/javascripts/erp_app/codemirror/test/lint/lint.js +120 -0
  120. data/public/javascripts/erp_app/codemirror/test/lint/parse-js.js +1372 -0
  121. data/public/javascripts/erp_app/codemirror/test/mode_test.css +0 -12
  122. data/public/javascripts/erp_app/codemirror/test/mode_test.js +66 -27
  123. data/public/javascripts/erp_app/codemirror/test/phantom_driver.js +30 -0
  124. data/public/javascripts/erp_app/codemirror/test/run.js +32 -0
  125. data/public/javascripts/erp_app/codemirror/test/test.js +213 -8
  126. data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +33 -27
  127. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +2 -1
  128. metadata +15 -3
  129. data/public/javascripts/erp_app/codemirror/mode/stex/test.html +0 -263
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: Lua mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -1,6 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>CodeMirror: Markdown mode</title>
5
6
  <link rel="stylesheet" href="../../lib/codemirror.css">
6
7
  <script src="../../lib/codemirror.js"></script>
@@ -336,5 +337,7 @@ Output:
336
337
 
337
338
  <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
338
339
 
340
+ <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>, <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
341
+
339
342
  </body>
340
343
  </html>
@@ -2,12 +2,18 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
2
2
 
3
3
  var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html");
4
4
  var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain");
5
+
6
+ var codeDepth = 0;
7
+ var prevLineHasContent = false
8
+ , thisLineHasContent = false;
5
9
 
6
10
  var header = 'header'
7
11
  , code = 'comment'
8
12
  , quote = 'quote'
9
13
  , list = 'string'
10
14
  , hr = 'hr'
15
+ , linkinline = 'link'
16
+ , linkemail = 'link'
11
17
  , linktext = 'link'
12
18
  , linkhref = 'string'
13
19
  , em = 'em'
@@ -17,8 +23,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
17
23
  var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
18
24
  , ulRE = /^[*\-+]\s+/
19
25
  , olRE = /^[0-9]+\.\s+/
20
- , headerRE = /^(?:\={3,}|-{3,})$/
21
- , textRE = /^[^\[*_\\<>`]+/;
26
+ , headerRE = /^(?:\={1,}|-{1,})$/
27
+ , textRE = /^[^\[*_\\<>` "'(]+/;
22
28
 
23
29
  function switchInline(stream, state, f) {
24
30
  state.f = state.inline = f;
@@ -34,10 +40,16 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
34
40
  // Blocks
35
41
 
36
42
  function blankLine(state) {
43
+ // Reset linkTitle state
44
+ state.linkTitle = false;
45
+ // Reset CODE state
46
+ state.code = false;
37
47
  // Reset EM state
38
48
  state.em = false;
39
49
  // Reset STRONG state
40
50
  state.strong = false;
51
+ // Reset state.quote
52
+ state.quote = false;
41
53
  if (!htmlFound && state.f == htmlBlock) {
42
54
  state.f = inlineNormal;
43
55
  state.block = blockNormal;
@@ -47,13 +59,23 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
47
59
 
48
60
  function blockNormal(stream, state) {
49
61
  var match;
62
+
63
+ if (state.list !== false && state.indentationDiff >= 0) { // Continued list
64
+ if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
65
+ state.indentation -= state.indentationDiff;
66
+ }
67
+ state.list = null;
68
+ } else { // No longer a list
69
+ state.list = false;
70
+ }
71
+
50
72
  if (state.indentationDiff >= 4) {
51
- state.indentation -= state.indentationDiff;
73
+ state.indentation -= 4;
52
74
  stream.skipToEnd();
53
75
  return code;
54
76
  } else if (stream.eatSpace()) {
55
77
  return null;
56
- } else if (stream.peek() === '#' || stream.match(headerRE)) {
78
+ } else if (stream.peek() === '#' || (prevLineHasContent && stream.match(headerRE)) ) {
57
79
  state.header = true;
58
80
  } else if (stream.eat('>')) {
59
81
  state.indentation++;
@@ -63,8 +85,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
63
85
  } else if (stream.match(hrRE, true)) {
64
86
  return hr;
65
87
  } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
66
- state.indentation += match[0].length;
67
- return list;
88
+ state.indentation += 4;
89
+ state.list = true;
68
90
  }
69
91
 
70
92
  return switchInline(stream, state, state.inline);
@@ -92,8 +114,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
92
114
  if (state.strong) { styles.push(state.em ? emstrong : strong); }
93
115
  else if (state.em) { styles.push(em); }
94
116
 
117
+ if (state.code) { styles.push(code); }
118
+
95
119
  if (state.header) { styles.push(header); }
96
120
  if (state.quote) { styles.push(quote); }
121
+ if (state.list !== false) { styles.push(list); }
97
122
 
98
123
  return styles.length ? styles.join(' ') : null;
99
124
  }
@@ -106,22 +131,68 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
106
131
  }
107
132
 
108
133
  function inlineNormal(stream, state) {
109
- var style = state.text(stream, state)
134
+ var style = state.text(stream, state);
110
135
  if (typeof style !== 'undefined')
111
136
  return style;
112
137
 
138
+ if (state.list) { // List marker (*, +, -, 1., etc)
139
+ state.list = null;
140
+ return list;
141
+ }
142
+
113
143
  var ch = stream.next();
114
144
 
115
145
  if (ch === '\\') {
116
146
  stream.next();
117
147
  return getType(state);
118
148
  }
149
+
150
+ // Matches link titles present on next line
151
+ if (state.linkTitle) {
152
+ state.linkTitle = false;
153
+ var matchCh = ch;
154
+ if (ch === '(') {
155
+ matchCh = ')';
156
+ }
157
+ matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
158
+ var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
159
+ if (stream.match(new RegExp(regex), true)) {
160
+ return linkhref;
161
+ }
162
+ }
163
+
119
164
  if (ch === '`') {
120
- return switchInline(stream, state, inlineElement(code, '`'));
165
+ var t = getType(state);
166
+ var before = stream.pos;
167
+ stream.eatWhile('`');
168
+ var difference = 1 + stream.pos - before;
169
+ if (!state.code) {
170
+ codeDepth = difference;
171
+ state.code = true;
172
+ return getType(state);
173
+ } else {
174
+ if (difference === codeDepth) { // Must be exact
175
+ state.code = false;
176
+ return t;
177
+ }
178
+ return getType(state);
179
+ }
180
+ } else if (state.code) {
181
+ return getType(state);
121
182
  }
122
- if (ch === '[') {
183
+
184
+ if (ch === '[' && stream.match(/.*\] ?(?:\(|\[)/, false)) {
123
185
  return switchInline(stream, state, linkText);
124
186
  }
187
+
188
+ if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, true)) {
189
+ return switchInline(stream, state, inlineElement(linkinline, '>'));
190
+ }
191
+
192
+ if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, true)) {
193
+ return switchInline(stream, state, inlineElement(linkemail, '>'));
194
+ }
195
+
125
196
  if (ch === '<' && stream.match(/^\w/, false)) {
126
197
  var md_inside = false;
127
198
  if (stream.string.indexOf(">")!=-1) {
@@ -141,10 +212,27 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
141
212
 
142
213
  var t = getType(state);
143
214
  if (ch === '*' || ch === '_') {
144
- if (stream.eat(ch)) {
145
- return (state.strong = !state.strong) ? getType(state) : t;
215
+ if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
216
+ state.strong = false;
217
+ return t;
218
+ } else if (!state.strong && stream.eat(ch)) { // Add STRONG
219
+ state.strong = ch;
220
+ return getType(state);
221
+ } else if (state.em === ch) { // Remove EM
222
+ state.em = false;
223
+ return t;
224
+ } else if (!state.em) { // Add EM
225
+ state.em = ch;
226
+ return getType(state);
227
+ }
228
+ } else if (ch === ' ') {
229
+ if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
230
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
231
+ return getType(state);
232
+ } else { // Not surrounded by spaces, back up pointer
233
+ stream.backUp(1);
234
+ }
146
235
  }
147
- return (state.em = !state.em) ? getType(state) : t;
148
236
  }
149
237
 
150
238
  return getType(state);
@@ -163,7 +251,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
163
251
  }
164
252
 
165
253
  function linkHref(stream, state) {
166
- stream.eatSpace();
254
+ // Check if space, and return NULL if so (to avoid marking the space)
255
+ if(stream.eatSpace()){
256
+ return null;
257
+ }
167
258
  var ch = stream.next();
168
259
  if (ch === '(' || ch === '[') {
169
260
  return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
@@ -180,17 +271,29 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
180
271
  }
181
272
 
182
273
  function footnoteUrl(stream, state) {
183
- stream.eatSpace();
274
+ // Check if space, and return NULL if so (to avoid marking the space)
275
+ if(stream.eatSpace()){
276
+ return null;
277
+ }
278
+ // Match URL
184
279
  stream.match(/^[^\s]+/, true);
280
+ // Check for link title
281
+ if (stream.peek() === undefined) { // End of line, set flag to check next line
282
+ state.linkTitle = true;
283
+ } else { // More content on line, check if link title
284
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
285
+ }
185
286
  state.f = state.inline = inlineNormal;
186
287
  return linkhref;
187
288
  }
188
289
 
189
290
  function inlineRE(endChar) {
190
291
  if (!inlineRE[endChar]) {
191
- // match any not-escaped-non-endChar and any escaped char
192
- // then match endChar or eol
193
- inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)');
292
+ // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
293
+ endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
294
+ // Match any non-endChar, escaped character, as well as the closing
295
+ // endChar.
296
+ inlineRE[endChar] = new RegExp('^(?:[^\\\\]+?|\\\\.)*?(' + endChar + ')');
194
297
  }
195
298
  return inlineRE[endChar];
196
299
  }
@@ -215,9 +318,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
215
318
 
216
319
  inline: inlineNormal,
217
320
  text: handleText,
321
+ linkTitle: false,
218
322
  em: false,
219
323
  strong: false,
220
324
  header: false,
325
+ list: false,
221
326
  quote: false
222
327
  };
223
328
  },
@@ -232,9 +337,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
232
337
 
233
338
  inline: s.inline,
234
339
  text: s.text,
340
+ linkTitle: s.linkTitle,
235
341
  em: s.em,
236
342
  strong: s.strong,
237
343
  header: s.header,
344
+ list: s.list,
238
345
  quote: s.quote,
239
346
  md_inside: s.md_inside
240
347
  };
@@ -242,12 +349,19 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
242
349
 
243
350
  token: function(stream, state) {
244
351
  if (stream.sol()) {
245
- if (stream.match(/^\s*$/, true)) { return blankLine(state); }
352
+ if (stream.match(/^\s*$/, true)) {
353
+ prevLineHasContent = false;
354
+ return blankLine(state);
355
+ } else {
356
+ if(thisLineHasContent){
357
+ prevLineHasContent = true;
358
+ thisLineHasContent = false;
359
+ }
360
+ thisLineHasContent = true;
361
+ }
246
362
 
247
363
  // Reset state.header
248
364
  state.header = false;
249
- // Reset state.quote
250
- state.quote = false;
251
365
 
252
366
  state.f = state.block;
253
367
  var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;