Pārlūkot izejas kodu

Merge branch 'develop'

Estevão Soares dos Santos 10 gadi atpakaļ
vecāks
revīzija
cf2a70c966

+ 10 - 10
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 23-08-2015 */
+;/*! showdown 27-08-2015 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -525,12 +525,7 @@ if (showdown.helper.isUndefined(console)) {
  * Showdown Converter class
  * @class
  * @param {object} [converterOptions]
- * @returns {
- *  {makeHtml: Function},
- *  {setOption: Function},
- *  {getOption: Function},
- *  {getOptions: Function}
- * }
+ * @returns {Converter}
  */
 showdown.Converter = function (converterOptions) {
   'use strict';
@@ -1029,6 +1024,9 @@ showdown.subParser('autoLinks', function (text, options) {
 showdown.subParser('blockGamut', function (text, options, globals) {
   'use strict';
 
+  // we parse blockquotes first so that we can have headings and hrs
+  // inside blockquotes
+  text = showdown.subParser('blockQuotes')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
 
   // Do Horizontal Rules:
@@ -1037,10 +1035,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
   text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
   text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);
 
-  text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
-  text = showdown.subParser('blockQuotes')(text, options, globals);
+  text = showdown.subParser('tables')(text, options, globals);
 
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // was to escape raw HTML in the original Markdown source. This time,
@@ -1069,7 +1066,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
    /gm, function(){...});
    */
 
-  text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
+  text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
     var bq = m1;
 
     // attacklab: hack around Konqueror 3.5.4 bug:
@@ -1080,6 +1077,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
     bq = bq.replace(/~0/g, '');
 
     bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
+    bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
     bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
 
     bq = bq.replace(/(^|\n)/g, '$1  ');
@@ -1753,6 +1751,7 @@ showdown.subParser('lists', function (text, options, globals) {
    * Process the contents of a single ordered or unordered list, splitting it
    * into individual list items.
    * @param {string} listStr
+   * @param {boolean} trimTrailing
    * @returns {string}
    */
   function processListItems (listStr, trimTrailing) {
@@ -1840,6 +1839,7 @@ showdown.subParser('lists', function (text, options, globals) {
    * Check and parse consecutive lists (better fix for issue #142)
    * @param {string} list
    * @param {string} listType
+   * @param {boolean} trimTrailing
    * @returns {string}
    */
   function parseConsecutiveLists(list, listType, trimTrailing) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/showdown.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/showdown.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 6
src/converter.js

@@ -6,12 +6,7 @@
  * Showdown Converter class
  * @class
  * @param {object} [converterOptions]
- * @returns {
- *  {makeHtml: Function},
- *  {setOption: Function},
- *  {getOption: Function},
- *  {getOptions: Function}
- * }
+ * @returns {Converter}
  */
 showdown.Converter = function (converterOptions) {
   'use strict';

+ 4 - 2
src/subParsers/blockGamut.js

@@ -5,6 +5,9 @@
 showdown.subParser('blockGamut', function (text, options, globals) {
   'use strict';
 
+  // we parse blockquotes first so that we can have headings and hrs
+  // inside blockquotes
+  text = showdown.subParser('blockQuotes')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
 
   // Do Horizontal Rules:
@@ -13,10 +16,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
   text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
   text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);
 
-  text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
-  text = showdown.subParser('blockQuotes')(text, options, globals);
+  text = showdown.subParser('tables')(text, options, globals);
 
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // was to escape raw HTML in the original Markdown source. This time,

+ 2 - 1
src/subParsers/blockQuotes.js

@@ -14,7 +14,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
    /gm, function(){...});
    */
 
-  text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
+  text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
     var bq = m1;
 
     // attacklab: hack around Konqueror 3.5.4 bug:
@@ -25,6 +25,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
     bq = bq.replace(/~0/g, '');
 
     bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
+    bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
     bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
 
     bq = bq.replace(/(^|\n)/g, '$1  ');

+ 2 - 0
src/subParsers/lists.js

@@ -8,6 +8,7 @@ showdown.subParser('lists', function (text, options, globals) {
    * Process the contents of a single ordered or unordered list, splitting it
    * into individual list items.
    * @param {string} listStr
+   * @param {boolean} trimTrailing
    * @returns {string}
    */
   function processListItems (listStr, trimTrailing) {
@@ -95,6 +96,7 @@ showdown.subParser('lists', function (text, options, globals) {
    * Check and parse consecutive lists (better fix for issue #142)
    * @param {string} list
    * @param {string} listType
+   * @param {boolean} trimTrailing
    * @returns {string}
    */
   function parseConsecutiveLists(list, listType, trimTrailing) {

+ 9 - 0
test/cases/blockquote-followed-by-code.html

@@ -0,0 +1,9 @@
+<blockquote>
+    <p>a blockquote with a 4 space indented line (not code)</p>
+</blockquote>
+<p>sep</p>
+<blockquote>
+    <p>a blockquote</p>
+</blockquote>
+<pre><code>with some code after
+</code></pre>

+ 8 - 0
test/cases/blockquote-followed-by-code.md

@@ -0,0 +1,8 @@
+> a blockquote
+    with a 4 space indented line (not code)
+
+sep
+
+> a blockquote
+
+    with some code after

+ 8 - 0
test/cases/blockquote-inside-code.html

@@ -0,0 +1,8 @@
+<pre><code>&gt; this is a pseudo blockquote
+    &gt; inside a code block
+</code></pre>
+
+<p>foo</p>
+<pre><code>&gt; this is another bq
+    inside code
+</code></pre>

+ 7 - 0
test/cases/blockquote-inside-code.md

@@ -0,0 +1,7 @@
+    > this is a pseudo blockquote
+    > inside a code block
+
+foo
+
+    > this is another bq
+    inside code

+ 15 - 0
test/cases/github-style-codeblock-inside-quote.html

@@ -0,0 +1,15 @@
+<blockquote>
+<p>Define a function in javascript:</p>
+
+<pre><code>function MyFunc(a) {
+  var s = '`';
+  }
+</code></pre>
+
+<blockquote>
+<p>And some nested quote</p>
+
+<pre><code class="html language-html">&lt;div&gt;HTML!&lt;/div&gt;
+</code></pre>
+</blockquote>
+</blockquote>

+ 13 - 0
test/cases/github-style-codeblock-inside-quote.md

@@ -0,0 +1,13 @@
+> Define a function in javascript:
+>
+> ```
+> function MyFunc(a) {
+>     var s = '`';
+> }
+> ```
+>
+>> And some nested quote
+>>
+>> ```html
+>> <div>HTML!</div>
+>> ```

+ 8 - 0
test/features/tables/table-inside-codeblock.html

@@ -0,0 +1,8 @@
+<p>some text</p>
+
+<pre><code>| Tables        | Are           | Cool  |
+| ------------- |:-------------:| -----:|
+| **col 3 is**  | right-aligned | $1600 |
+| col 2 is      | *centered*    |   $12 |
+| zebra stripes | ~~are neat~~  |    $1 |
+</code></pre>

+ 8 - 0
test/features/tables/table-inside-codeblock.md

@@ -0,0 +1,8 @@
+some text
+
+
+    | Tables        | Are           | Cool  |
+    | ------------- |:-------------:| -----:|
+    | **col 3 is**  | right-aligned | $1600 |
+    | col 2 is      | *centered*    |   $12 |
+    | zebra stripes | ~~are neat~~  |    $1 |

+ 4 - 0
test/issues/#191.blockquote-followed-by-an-heading.html

@@ -0,0 +1,4 @@
+<blockquote>
+    <p>a blockquote</p>
+    <h1 id="followedbyanheading">followed by an heading</h1>
+</blockquote>

+ 2 - 0
test/issues/#191.blockquote-followed-by-an-heading.md

@@ -0,0 +1,2 @@
+> a blockquote
+# followed by an heading

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels