mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-11 06:16:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3c3180bab | ||
|
|
c30af850a1 | ||
|
|
2a2ed96eb8 | ||
|
|
0d54c0cf83 |
@@ -1,3 +1,13 @@
|
||||
<a name="4.5.1"></a>
|
||||
## [4.5.1](https://github.com/QingWei-Li/docsify/compare/v4.5.0...v4.5.1) (2017-11-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96))
|
||||
|
||||
|
||||
|
||||
<a name="4.5.0"></a>
|
||||
# [4.5.0](https://github.com/QingWei-Li/docsify/compare/v4.4.1...v4.5.0) (2017-11-04)
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ These projects are using docsify to generate their sites. Pull requests welcome
|
||||
| [Solidarity](https://infinitered.github.io/solidarity/) | Environment enforcer for your projects across machines. |
|
||||
| [rnback](https://rnback.com/) | Backend service for react-native applications. |
|
||||
| [IT-films](https://greybax.github.com/IT-films/) | A curated list of awesome movies, documentaries and TV series about hackers, geeks and IT in common, sorted by IMDB rating. |
|
||||
| [zooming](http://desmonding.me/zooming/docs) | Image zoom that makes sense. |
|
||||
|
||||
## Similar projects
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.5.0</small>
|
||||
# docsify <small>4.5.1</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
+37
-19
@@ -2758,10 +2758,13 @@ function parseQuery (query) {
|
||||
return res
|
||||
}
|
||||
|
||||
function stringifyQuery (obj) {
|
||||
function stringifyQuery (obj, ignores) {
|
||||
if ( ignores === void 0 ) ignores = [];
|
||||
|
||||
var qs = [];
|
||||
|
||||
for (var key in obj) {
|
||||
if (ignores.indexOf(key) > -1) { continue }
|
||||
qs.push(
|
||||
obj[key]
|
||||
? ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase()
|
||||
@@ -3851,14 +3854,14 @@ function initEvent (vm) {
|
||||
}
|
||||
}
|
||||
|
||||
function loadNested (path, file, next, vm, first) {
|
||||
function loadNested (path, qs, file, next, vm, first) {
|
||||
path = first ? path : path.replace(/\/$/, '');
|
||||
path = getParentPath(path);
|
||||
|
||||
if (!path) { return }
|
||||
|
||||
get(vm.router.getFile(path + file))
|
||||
.then(next, function (_) { return loadNested(path, file, next, vm); });
|
||||
get(vm.router.getFile(path + file) + qs).then(next, function (_) { return loadNested(path, qs, file, next, vm); }
|
||||
);
|
||||
}
|
||||
|
||||
function fetchMixin (proto) {
|
||||
@@ -3869,6 +3872,8 @@ function fetchMixin (proto) {
|
||||
|
||||
var ref = this.route;
|
||||
var path = ref.path;
|
||||
var query = ref.query;
|
||||
var qs = stringifyQuery(query, ['id']);
|
||||
var ref$1 = this.config;
|
||||
var loadNavbar = ref$1.loadNavbar;
|
||||
var loadSidebar = ref$1.loadSidebar;
|
||||
@@ -3876,7 +3881,7 @@ function fetchMixin (proto) {
|
||||
// Abort last request
|
||||
last && last.abort && last.abort();
|
||||
|
||||
last = get(this.router.getFile(path), true);
|
||||
last = get(this.router.getFile(path) + qs, true);
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(path);
|
||||
@@ -3884,25 +3889,37 @@ function fetchMixin (proto) {
|
||||
var loadSideAndNav = function () {
|
||||
if (!loadSidebar) { return cb() }
|
||||
|
||||
var fn = function (result) { this$1._renderSidebar(result); cb(); };
|
||||
var fn = function (result) {
|
||||
this$1._renderSidebar(result);
|
||||
cb();
|
||||
};
|
||||
|
||||
// Load sidebar
|
||||
loadNested(path, loadSidebar, fn, this$1, true);
|
||||
loadNested(path, qs, loadSidebar, fn, this$1, true);
|
||||
};
|
||||
|
||||
// Load main content
|
||||
last.then(function (text, opt) {
|
||||
this$1._renderMain(text, opt);
|
||||
loadSideAndNav();
|
||||
},
|
||||
function (_) {
|
||||
this$1._renderMain(null);
|
||||
loadSideAndNav();
|
||||
});
|
||||
last.then(
|
||||
function (text, opt) {
|
||||
this$1._renderMain(text, opt);
|
||||
loadSideAndNav();
|
||||
},
|
||||
function (_) {
|
||||
this$1._renderMain(null);
|
||||
loadSideAndNav();
|
||||
}
|
||||
);
|
||||
|
||||
// Load nav
|
||||
loadNavbar &&
|
||||
loadNested(path, loadNavbar, function (text) { return this$1._renderNav(text); }, this, true);
|
||||
loadNested(
|
||||
path,
|
||||
qs,
|
||||
loadNavbar,
|
||||
function (text) { return this$1._renderNav(text); },
|
||||
this,
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
proto._fetchCover = function () {
|
||||
@@ -3910,6 +3927,7 @@ function fetchMixin (proto) {
|
||||
|
||||
var ref = this.config;
|
||||
var coverpage = ref.coverpage;
|
||||
var query = this.route.query;
|
||||
var root = getParentPath(this.route.path);
|
||||
var path = this.router.getFile(root + coverpage);
|
||||
|
||||
@@ -3919,8 +3937,8 @@ function fetchMixin (proto) {
|
||||
}
|
||||
|
||||
this.coverIsHTML = /\.html$/g.test(path);
|
||||
get(path)
|
||||
.then(function (text) { return this$1._renderCover(text); });
|
||||
get(path + stringifyQuery(query, ['id'])).then(function (text) { return this$1._renderCover(text); }
|
||||
);
|
||||
};
|
||||
|
||||
proto.$fetch = function (cb) {
|
||||
@@ -4036,7 +4054,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.5.0';
|
||||
Docsify.version = '4.5.1';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.5.0",
|
||||
"version": "4.5.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.5.0",
|
||||
"version": "4.5.1",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.5.0"
|
||||
"version": "4.5.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.5.0",
|
||||
"version": "4.5.1",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+35
-19
@@ -1,29 +1,31 @@
|
||||
import { get } from './ajax'
|
||||
import { callHook } from '../init/lifecycle'
|
||||
import { getParentPath } from '../router/util'
|
||||
import { getParentPath, stringifyQuery } from '../router/util'
|
||||
import { noop } from '../util/core'
|
||||
import { getAndActive } from '../event/sidebar'
|
||||
|
||||
function loadNested (path, file, next, vm, first) {
|
||||
function loadNested (path, qs, file, next, vm, first) {
|
||||
path = first ? path : path.replace(/\/$/, '')
|
||||
path = getParentPath(path)
|
||||
|
||||
if (!path) return
|
||||
|
||||
get(vm.router.getFile(path + file))
|
||||
.then(next, _ => loadNested(path, file, next, vm))
|
||||
get(vm.router.getFile(path + file) + qs).then(next, _ =>
|
||||
loadNested(path, qs, file, next, vm)
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchMixin (proto) {
|
||||
let last
|
||||
proto._fetch = function (cb = noop) {
|
||||
const { path } = this.route
|
||||
const { path, query } = this.route
|
||||
const qs = stringifyQuery(query, ['id'])
|
||||
const { loadNavbar, loadSidebar } = this.config
|
||||
|
||||
// Abort last request
|
||||
last && last.abort && last.abort()
|
||||
|
||||
last = get(this.router.getFile(path), true)
|
||||
last = get(this.router.getFile(path) + qs, true)
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(path)
|
||||
@@ -31,29 +33,42 @@ export function fetchMixin (proto) {
|
||||
const loadSideAndNav = () => {
|
||||
if (!loadSidebar) return cb()
|
||||
|
||||
const fn = result => { this._renderSidebar(result); cb() }
|
||||
const fn = result => {
|
||||
this._renderSidebar(result)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Load sidebar
|
||||
loadNested(path, loadSidebar, fn, this, true)
|
||||
loadNested(path, qs, loadSidebar, fn, this, true)
|
||||
}
|
||||
|
||||
// Load main content
|
||||
last.then((text, opt) => {
|
||||
this._renderMain(text, opt)
|
||||
loadSideAndNav()
|
||||
},
|
||||
_ => {
|
||||
this._renderMain(null)
|
||||
loadSideAndNav()
|
||||
})
|
||||
last.then(
|
||||
(text, opt) => {
|
||||
this._renderMain(text, opt)
|
||||
loadSideAndNav()
|
||||
},
|
||||
_ => {
|
||||
this._renderMain(null)
|
||||
loadSideAndNav()
|
||||
}
|
||||
)
|
||||
|
||||
// Load nav
|
||||
loadNavbar &&
|
||||
loadNested(path, loadNavbar, text => this._renderNav(text), this, true)
|
||||
loadNested(
|
||||
path,
|
||||
qs,
|
||||
loadNavbar,
|
||||
text => this._renderNav(text),
|
||||
this,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
proto._fetchCover = function () {
|
||||
const { coverpage } = this.config
|
||||
const query = this.route.query
|
||||
const root = getParentPath(this.route.path)
|
||||
const path = this.router.getFile(root + coverpage)
|
||||
|
||||
@@ -63,8 +78,9 @@ export function fetchMixin (proto) {
|
||||
}
|
||||
|
||||
this.coverIsHTML = /\.html$/g.test(path)
|
||||
get(path)
|
||||
.then(text => this._renderCover(text))
|
||||
get(path + stringifyQuery(query, ['id'])).then(text =>
|
||||
this._renderCover(text)
|
||||
)
|
||||
}
|
||||
|
||||
proto.$fetch = function (cb = noop) {
|
||||
|
||||
@@ -22,10 +22,11 @@ export function parseQuery (query) {
|
||||
return res
|
||||
}
|
||||
|
||||
export function stringifyQuery (obj) {
|
||||
export function stringifyQuery (obj, ignores = []) {
|
||||
const qs = []
|
||||
|
||||
for (const key in obj) {
|
||||
if (ignores.indexOf(key) > -1) continue
|
||||
qs.push(
|
||||
obj[key]
|
||||
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
||||
|
||||
Reference in New Issue
Block a user