[build] 4.4.1

This commit is contained in:
qingwei.li 2017-10-31 21:48:15 +08:00
commit d5194b4f6b
11 changed files with 65 additions and 316 deletions

View file

@ -2794,6 +2794,22 @@ var cleanPath = cached(function (path) {
});
var cachedLinks = {};
function getAndRemoveConfig (str) {
if ( str === void 0 ) str = '';
var config = {};
if (str) {
str = str
.replace(/:([\w-]+)=?([\w-]+)?/g, function (m, key, value) {
config[key] = value || true;
return ''
})
.trim();
}
return { str: str, config: config }
}
var Compiler = function Compiler (config, router) {
this.config = config;
@ -2894,16 +2910,11 @@ Compiler.prototype._initRenderer = function _initRenderer () {
if ( title === void 0 ) title = '';
var attrs = '';
var config = {};
if (title) {
title = title
.replace(/:(\w+)=?(\w+)?/g, function (m, key, value) {
config[key] = value || true;
return ''
})
.trim();
}
var ref = getAndRemoveConfig(title);
var str = ref.str;
var config = ref.config;
title = str;
if (
!/:|(\/{2})/.test(href) &&
@ -2925,9 +2936,10 @@ Compiler.prototype._initRenderer = function _initRenderer () {
}
if (title) {
title = " title=\"" + title + "\"";
attrs += " title=\"" + title + "\"";
}
return ("<a href=\"" + href + "\"" + (title || '') + attrs + ">" + text + "</a>")
return ("<a href=\"" + href + "\"" + attrs + ">" + text + "</a>")
};
origin.paragraph = renderer.paragraph = function (text) {
if (/^!&gt;/.test(text)) {
@ -2939,13 +2951,26 @@ Compiler.prototype._initRenderer = function _initRenderer () {
};
origin.image = renderer.image = function (href, title, text) {
var url = href;
var titleHTML = title ? (" title=\"" + title + "\"") : '';
var attrs = '';
var ref = getAndRemoveConfig(title);
var str = ref.str;
var config = ref.config;
title = str;
if (config['no-zoom']) {
attrs += ' data-no-zoom';
}
if (title) {
attrs += " title=\"" + title + "\"";
}
if (!isAbsolutePath(href)) {
url = getPath(contentBase, href);
}
return ("<img src=\"" + url + "\" data-origin=\"" + href + "\" alt=\"" + text + "\"" + titleHTML + ">")
return ("<img src=\"" + url + "\"data-origin=\"" + href + "\" alt=\"" + text + "\"" + attrs + ">")
};
renderer.origin = origin;
@ -2985,11 +3010,12 @@ Compiler.prototype.subSidebar = function subSidebar (level) {
var cacheTree = ref.cacheTree;
var toc = ref.toc;
toc[0] && toc[0].ignoreAllSubs && (this.toc = []);
toc[0] && toc[0].ignoreAllSubs && toc.splice(0);
toc[0] && toc[0].level === 1 && toc.shift();
toc.forEach(function (node, i) {
node.ignoreSubHeading && toc.splice(i, 1);
});
for (var i = 0; i < toc.length; i++) {
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--;
}
var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
@ -4010,7 +4036,7 @@ initGlobalAPI();
/**
* Version
*/
Docsify.version = '4.4.0';
Docsify.version = '4.4.1';
/**
* Run Docsify