Просмотр исходного кода

Merge branch 'develop' into feature/source_indentation_auto_removal

Estevao Soares dos Santos 9 лет назад
Родитель
Сommit
8591ec8196

+ 10 - 0
CHANGELOG.md

@@ -1,3 +1,13 @@
+<a name="1.4.1"></a>
+## [1.4.1](https://github.com/showdownjs/showdown/compare/1.4.0...v1.4.1) (2016-05-17)
+
+
+### Bug Fixes
+
+* **tables:** fix table heading separators requiring 3 dashes instead of 2 ([ddaacfc](https://github.com/showdownjs/showdown/commit/ddaacfc)), closes [#256](https://github.com/showdownjs/showdown/issues/256)
+
+
+
 <a name="1.4.0"></a>
 # [1.4.0](https://github.com/showdownjs/showdown/compare/1.3.0...v1.4.0) (2016-05-13)
 

+ 11 - 7
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 07-06-2016 */
+;/*! showdown 21-06-2016 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -1439,6 +1439,10 @@ showdown.subParser('codeSpans', function (text, options, globals) {
    (?!`)
    /gm, function(){...});
    */
+
+  if (typeof(text) === 'undefined') {
+    text = '';
+  }
   text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
     function (wholeMatch, m1, m2, m3) {
       var c = m3;
@@ -1890,7 +1894,7 @@ showdown.subParser('images', function (text, options, globals) {
   text = globals.converter._dispatch('images.before', text, options, globals);
 
   var inlineRegExp    = /!\[(.*?)]\s?\([ \t]*()<?(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g,
-      referenceRegExp = /!\[(.*?)][ ]?(?:\n[ ]*)?\[(.*?)]()()()()()/g;
+      referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g;
 
   function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
 
@@ -2377,14 +2381,14 @@ showdown.subParser('tables', function (text, options, globals) {
     return text;
   }
 
-  var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){3,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){3,}[^]+?(?:\n\n|~0)/gm;
+  var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[^]+?(?:\n\n|~0)/gm;
 
   function parseStyles(sLine) {
-    if (/^:[ \t]*---*$/.test(sLine)) {
+    if (/^:[ \t]*--*$/.test(sLine)) {
       return ' style="text-align:left;"';
-    } else if (/^---*[ \t]*:[ \t]*$/.test(sLine)) {
+    } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
       return ' style="text-align:right;"';
-    } else if (/^:[ \t]*---*[ \t]*:$/.test(sLine)) {
+    } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
       return ' style="text-align:center;"';
     } else {
       return '';
@@ -2532,4 +2536,4 @@ if (typeof module !== 'undefined' && module.exports) {
 }
 }).call(this);
 
-//# sourceMappingURL=showdown.js.map
+//# sourceMappingURL=showdown.js.map

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/showdown.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/showdown.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "showdown",
-  "version": "1.4.0",
+  "version": "1.4.1",
   "description": "A Markdown to HTML converter written in Javascript",
   "author": "Estevão Santos",
   "homepage": "http://showdownjs.github.io/showdown/",

+ 4 - 0
src/subParsers/codeSpans.js

@@ -40,6 +40,10 @@ showdown.subParser('codeSpans', function (text, options, globals) {
    (?!`)
    /gm, function(){...});
    */
+
+  if (typeof(text) === 'undefined') {
+    text = '';
+  }
   text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
     function (wholeMatch, m1, m2, m3) {
       var c = m3;

+ 1 - 1
src/subParsers/images.js

@@ -7,7 +7,7 @@ showdown.subParser('images', function (text, options, globals) {
   text = globals.converter._dispatch('images.before', text, options, globals);
 
   var inlineRegExp    = /!\[(.*?)]\s?\([ \t]*()<?(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g,
-      referenceRegExp = /!\[(.*?)][ ]?(?:\n[ ]*)?\[(.*?)]()()()()()/g;
+      referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g;
 
   function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
 

+ 4 - 4
src/subParsers/tables.js

@@ -5,14 +5,14 @@ showdown.subParser('tables', function (text, options, globals) {
     return text;
   }
 
-  var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){3,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){3,}[^]+?(?:\n\n|~0)/gm;
+  var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[^]+?(?:\n\n|~0)/gm;
 
   function parseStyles(sLine) {
-    if (/^:[ \t]*---*$/.test(sLine)) {
+    if (/^:[ \t]*--*$/.test(sLine)) {
       return ' style="text-align:left;"';
-    } else if (/^---*[ \t]*:[ \t]*$/.test(sLine)) {
+    } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
       return ' style="text-align:right;"';
-    } else if (/^:[ \t]*---*[ \t]*:$/.test(sLine)) {
+    } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
       return ' style="text-align:center;"';
     } else {
       return '';

+ 14 - 0
test/features/tables/#256.table-header-separators-should-not-require-3-dashes.html

@@ -0,0 +1,14 @@
+<table>
+    <thead>
+    <tr>
+        <th>key</th>
+        <th>value</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr>
+        <td>My Key</td>
+        <td>My Value</td>
+    </tr>
+    </tbody>
+</table>

+ 3 - 0
test/features/tables/#256.table-header-separators-should-not-require-3-dashes.md

@@ -0,0 +1,3 @@
+|key|value|
+|--|--| 
+|My Key|My Value|

+ 48 - 0
test/features/tables/table-without-leading-pipe.html

@@ -0,0 +1,48 @@
+
+<h3 id="stats">Stats</h3>
+
+<table>
+<thead>
+<tr>
+<th>Status</th>
+<th>AGENT1</th>
+<th>AGENT2</th>
+<th>AGENT3</th>
+<th>AGENT4</th>
+<th>AGENT5</th>
+<th>AGENT6</th>
+<th>AGENT7</th>
+<th>AGENT8</th>
+<th>AGENT9</th>
+<th>TOTAL</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>AGENT ERROR</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td></td>
+</tr>
+<tr>
+<td>APPROVED</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td>0</td>
+<td></td>
+</tr>
+</tbody>
+</table>

+ 8 - 0
test/features/tables/table-without-leading-pipe.md

@@ -0,0 +1,8 @@
+
+### Stats
+
+
+Status | AGENT1 | AGENT2 | AGENT3 | AGENT4 | AGENT5 | AGENT6 | AGENT7 | AGENT8 | AGENT9 | TOTAL |
+--- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
+AGENT ERROR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
+APPROVED | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

+ 17 - 0
test/issues/#261.mix-images-with-links.html

@@ -0,0 +1,17 @@
+<p><img src="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png" alt="sd-inline" /> <a href="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">sd-ref</a></p>
+
+<p>foo</p>
+
+<p><a href="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png">sd-inline</a> <img src="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="sd-ref" /></p>
+
+<p>foo</p>
+
+<p><img src="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="sd-ref" /> <a href="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png">sd-inline</a></p>
+
+<p>foo</p>
+
+<p><a href="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">sd-ref</a> <img src="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png" alt="sd-inline" /></p>
+
+<p>foo</p>
+
+<p><a href="http://www.google.com/"><img src="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="sd-ref" /></a></p>

+ 19 - 0
test/issues/#261.mix-images-with-links.md

@@ -0,0 +1,19 @@
+![sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png) [sd-ref][sd-logo]
+
+foo
+
+[sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png) ![sd-ref][sd-logo]
+
+foo
+
+![sd-ref][sd-logo] [sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png)
+
+foo
+
+[sd-ref][sd-logo] ![sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png)
+
+foo
+
+[![sd-ref][sd-logo]](http://www.google.com/)
+
+[sd-logo]: https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png

+ 5 - 0
test/issues/#261.reference-style-image-after-inline-style-image-does-not-work-correctely.html

@@ -0,0 +1,5 @@
+<p><img src="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png" alt="sd-inline" /> <img src="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="sd-ref" /></p>
+
+<p>foo</p>
+
+<p><img src="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="sd-ref" /> <img src="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png" alt="sd-inline" /></p>

+ 7 - 0
test/issues/#261.reference-style-image-after-inline-style-image-does-not-work-correctely.md

@@ -0,0 +1,7 @@
+![sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png) ![sd-ref][sd-logo]
+
+foo
+
+![sd-ref][sd-logo] ![sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png)
+
+[sd-logo]: https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png

+ 5 - 0
test/issues/#261.reference-style-link-after-inline-style-link-does-not-work-correctely.html

@@ -0,0 +1,5 @@
+<p><a href="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png">sd-inline</a> <a href="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">sd-ref</a></p>
+
+<p>foo</p>
+
+<p><a href="https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">sd-ref</a> <a href="https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png">sd-inline</a></p>

+ 7 - 0
test/issues/#261.reference-style-link-after-inline-style-link-does-not-work-correctely.md

@@ -0,0 +1,7 @@
+[sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png) [sd-ref][sd-logo]
+
+foo
+
+[sd-ref][sd-logo] [sd-inline](https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png)
+
+[sd-logo]: https://www.google.pt/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png

Некоторые файлы не были показаны из-за большого количества измененных файлов