浏览代码

fix(subParsers/stripLinkDefinitions): fix title attribute in link definitions

According to spec, the title attribute in link definitions can be wrapped in single quotes. Previously, showdown didn't support this.
Now the title attribute can be wrapped in single quotes.
Estevao Soares dos Santos 10 年之前
父节点
当前提交
9a2411b05f
共有 5 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      dist/showdown.js
  2. 0 0
      dist/showdown.js.map
  3. 0 0
      dist/showdown.min.js
  4. 0 0
      dist/showdown.min.js.map
  5. 2 2
      src/subParsers/stripLinkDefinitions.js

+ 2 - 2
dist/showdown.js

@@ -1905,7 +1905,7 @@ showdown.subParser('stripBlankLines', function (text) {
 showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
   'use strict';
 
-  var regex = /^[ ]{0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm;
+  var regex = /^[ ]{0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm;
 
   // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
   text += '~0';
@@ -1919,7 +1919,7 @@ showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
       return m3 + m4;
 
     } else if (m4) {
-      globals.gTitles[m1] = m4.replace(/"/g, '&quot;');
+      globals.gTitles[m1] = m4.replace(/"|'/g, '&quot;');
     }
 
     // Completely remove the definition from the text

文件差异内容过多而无法显示
+ 0 - 0
dist/showdown.js.map


文件差异内容过多而无法显示
+ 0 - 0
dist/showdown.min.js


文件差异内容过多而无法显示
+ 0 - 0
dist/showdown.min.js.map


+ 2 - 2
src/subParsers/stripLinkDefinitions.js

@@ -26,7 +26,7 @@
 showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
   'use strict';
 
-  var regex = /^[ ]{0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm;
+  var regex = /^[ ]{0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm;
 
   // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
   text += '~0';
@@ -40,7 +40,7 @@ showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
       return m3 + m4;
 
     } else if (m4) {
-      globals.gTitles[m1] = m4.replace(/"/g, '&quot;');
+      globals.gTitles[m1] = m4.replace(/"|'/g, '&quot;');
     }
 
     // Completely remove the definition from the text

部分文件因为文件数量过多而无法显示