[build] 4.1.14

This commit is contained in:
qingwei.li 2017-06-24 20:52:21 +08:00
commit f598e53098
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
6 changed files with 21 additions and 15 deletions

View file

@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>4.1.13</small> # docsify <small>4.1.14</small>
> A magical documentation site generator. > A magical documentation site generator.

View file

@ -3318,7 +3318,7 @@ History.prototype.getBasePath = function getBasePath () {
return this.config.basePath return this.config.basePath
}; };
History.prototype.getFile = function getFile (path) { History.prototype.getFile = function getFile (path, isRelative) {
path = path || this.getCurrentPath(); path = path || this.getCurrentPath();
var ref = this; var ref = this;
@ -3330,6 +3330,10 @@ History.prototype.getFile = function getFile (path) {
path = path === '/README.md' ? (config.homepage || path) : path; path = path === '/README.md' ? (config.homepage || path) : path;
path = isAbsolutePath(path) ? path : getPath(base, path); path = isAbsolutePath(path) ? path : getPath(base, path);
if (isRelative) {
path = path.replace(new RegExp(("^" + base)), '');
}
return path return path
}; };
@ -3423,7 +3427,7 @@ var HashHistory = (function (History$$1) {
return { return {
path: path, path: path,
file: this.getFile(path), file: this.getFile(path, true),
query: parseQuery(query) query: parseQuery(query)
} }
}; };
@ -3536,6 +3540,12 @@ function routerMixin (proto) {
var lastRoute = {}; var lastRoute = {};
function updateRender (vm) {
vm.router.normalize();
vm.route = vm.router.parse();
body.setAttribute('data-page', vm.route.file);
}
function initRouter (vm) { function initRouter (vm) {
var config = vm.config; var config = vm.config;
var mode = config.routerMode || 'hash'; var mode = config.routerMode || 'hash';
@ -3548,13 +3558,11 @@ function initRouter (vm) {
} }
vm.router = router; vm.router = router;
updateRender(vm);
router.normalize(); lastRoute = vm.route;
lastRoute = vm.route = router.parse();
router.onchange(function (_) { router.onchange(function (_) {
router.normalize(); updateRender(vm);
vm.route = router.parse();
vm._updateRender(); vm._updateRender();
if (lastRoute.path === vm.route.path) { if (lastRoute.path === vm.route.path) {
@ -3750,7 +3758,7 @@ initGlobalAPI();
/** /**
* Version * Version
*/ */
Docsify.version = '4.1.13'; Docsify.version = '4.1.14';
/** /**
* Run Docsify * Run Docsify

4
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -88,8 +88,6 @@ function search (keywords) {
var postContent = post.body && post.body.trim(); var postContent = post.body && post.body.trim();
var postUrl = post.slug || ''; var postUrl = post.slug || '';
postContent = postContent.replace(/!\[.*\]\((.+)\)/g,'');
if (postTitle && postContent) { if (postTitle && postContent) {
keywords.forEach(function (keyword, i) { keywords.forEach(function (keyword, i) {
var regEx = new RegExp(keyword, 'gi'); var regEx = new RegExp(keyword, 'gi');

View file

@ -1,6 +1,6 @@
{ {
"name": "docsify-server-renderer", "name": "docsify-server-renderer",
"version": "4.1.13", "version": "4.1.14",
"description": "docsify server renderer", "description": "docsify server renderer",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",

View file

@ -9,7 +9,7 @@ export function routerMixin (proto) {
let lastRoute = {} let lastRoute = {}
function updateRender(vm) { function updateRender (vm) {
vm.router.normalize() vm.router.normalize()
vm.route = vm.router.parse() vm.route = vm.router.parse()
dom.body.setAttribute('data-page', vm.route.file) dom.body.setAttribute('data-page', vm.route.file)