From bab76e004d54b953397c041d7f8a26df9508cc2d Mon Sep 17 00:00:00 2001 From: gpresland Date: Sun, 21 May 2017 14:45:43 -0400 Subject: [PATCH 1/4] Pretty dir tree --- docs/more-pages.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/more-pages.md b/docs/more-pages.md index b9db3a961..9ced12e2a 100644 --- a/docs/more-pages.md +++ b/docs/more-pages.md @@ -6,12 +6,12 @@ For example, the directory structure is as follows: ```text . -├── docs -| └── README.md -| └── guide.md -| └── zh-cn -| └──README.md -| └──guide.md +└── docs + ├── README.md + ├── guide.md + └── zh-cn + ├── README.md + └── guide.md ``` Matching routes From eca33681524d7047080c817d202d7b7d188634ea Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 22 May 2017 20:54:50 +0800 Subject: [PATCH 2/4] fix(render): find => filter --- src/core/render/index.js | 2 +- src/plugins/search/component.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/render/index.js b/src/core/render/index.js index 6c5581e4d..0b5dd805d 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -70,7 +70,7 @@ function renderNameLink (vm) { if (isPrimitive(vm.config.nameLink)) { el.setAttribute('href', nameLink) } else if (typeof nameLink === 'object') { - const match = Object.keys(nameLink).find(key => path.indexOf(key) > -1) + const match = Object.keys(nameLink).filter(key => path.indexOf(key) > -1)[0] el.setAttribute('href', nameLink[match]) } diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 455314f97..66ddc5455 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -124,7 +124,7 @@ function updatePlaceholder (text, path) { if (typeof text === 'string') { $input.placeholder = text } else { - const match = Object.keys(text).find(key => path.indexOf(key) > -1) + const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0] $input.placeholder = text[match] } } @@ -133,7 +133,7 @@ function updateNoData (text, path) { if (typeof text === 'string') { NO_DATA_TEXT = text } else { - const match = Object.keys(text).find(key => path.indexOf(key) > -1) + const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0] NO_DATA_TEXT = text[match] } } From 6d244139dd9a785c5e95059195c08501eabad5b5 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 22 May 2017 20:56:25 +0800 Subject: [PATCH 3/4] bump: 3.7.3 --- CHANGELOG.md | 5 ++++- lib/docsify.js | 2 +- lib/docsify.min.js | 2 +- lib/plugins/search.js | 4 ++-- lib/plugins/search.min.js | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66075e586..497db0364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,14 @@ # Changelog +## 3.7.3 / 2017-05-22 + + * fix(render): find => filter, Compatible with old browser + * Pretty dir tree ## 3.7.2 / 2017-05-19 * tweaks - ## 3.7.1 / 2017-05-19 * fix: docsify-updated is undefined diff --git a/lib/docsify.js b/lib/docsify.js index 2d04a4a64..7cf701834 100644 --- a/lib/docsify.js +++ b/lib/docsify.js @@ -3229,7 +3229,7 @@ function renderNameLink (vm) { if (isPrimitive(vm.config.nameLink)) { el.setAttribute('href', nameLink); } else if (typeof nameLink === 'object') { - var match = Object.keys(nameLink).find(function (key) { return path.indexOf(key) > -1; }); + var match = Object.keys(nameLink).filter(function (key) { return path.indexOf(key) > -1; })[0]; el.setAttribute('href', nameLink[match]); } diff --git a/lib/docsify.min.js b/lib/docsify.min.js index 2c30421a4..fd683413c 100644 --- a/lib/docsify.min.js +++ b/lib/docsify.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}function t(e){return"string"==typeof e||"number"==typeof e}function n(){}function r(e){return"function"==typeof e}function i(e){var t=["init","mounted","beforeEach","afterEach","doneEach","ready"];e._hooks={},e._lifecycle={},t.forEach(function(t){var n=e._hooks[t]=[];e._lifecycle[t]=function(e){return n.push(e)}})}function a(e,t,r,i){void 0===i&&(i=n);var a=r,o=e._hooks[t],s=function(e){var t=o[e];if(e>=o.length)i(a);else if("function"==typeof t)if(2===t.length)t(r,function(t){a=t,s(e+1)});else{var n=t(r);a=void 0!==n?n:a,s(e+1)}else s(e+1)};s(0)}function o(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return s(e);e=t?s(e):de[e]||(de[e]=s(e))}return e}function s(e,t){return t?e.querySelector(t):fe.querySelector(e)}function l(e,t){return[].slice.call(t?e.querySelectorAll(t):fe.querySelectorAll(e))}function u(e,t){return e=fe.createElement(e),t&&(e.innerHTML=t),e}function c(e,t){return e.appendChild(t)}function p(e,t){return e.insertBefore(t,e.children[0])}function g(e,t,n){r(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function h(e,t,n){r(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function d(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}function f(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("=");t[n[0]]=xe(n[1])}),t):t}function m(e){var t=[];for(var n in e)t.push((_e(n)+"="+_e(e[n])).toLowerCase());return t.length?"?"+t.join("&"):""}function v(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return $e(e.join("/"))}function b(e){var t=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,t>=0?t:0)+"#"+e)}function y(){var e=k();if(e=Ee(e),"/"===e.charAt(0))return b(e);b("/"+e)}function k(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.slice(t+1)}function w(e){void 0===e&&(e=window.location.href);var t="",n=e.indexOf("?");n>=0&&(t=e.slice(n+1),e=e.slice(0,n));var r=e.indexOf("#");return r&&(e=e.slice(r+1)),{path:e,query:f(t)}}function x(e,t,n){var r=n&&"#"===e[0],i=w(Ee(e));return i.query=se({},i.query,t),e=i.path+m(i.query),e=e.replace(/\.md(\?)|\.md$/,"$1"),r&&(e=n+e),$e("#/"+e)}function _(e){var t=function(e){return me.classList.toggle("close")};e=o(e),g(e,"click",function(e){e.stopPropagation(),t()});var n=o(".sidebar");we&&g(me,"click",function(e){return me.classList.contains("close")&&t()}),g(n,"click",function(e){return setTimeout(0)})}function L(){var e=o("section.cover");if(e){var t=e.getBoundingClientRect().height;window.pageYOffset>=t||e.classList.contains("hidden")?d(me,"add","sticky"):d(me,"remove","sticky")}}function S(e,t,n){e=o(e);var r,i=l(e,"a"),a="#"+k();return i.sort(function(e,t){return t.href.length-e.href.length}).forEach(function(e){var n=e.getAttribute("href"),i=t?e.parentNode:e;0!==a.indexOf(n)||r?d(i,"remove","active"):(r=e,d(i,"add","active"))}),n&&(fe.title=r?r.innerText+" - "+Ae:Ae),r}function C(){for(var e,t=o(".sidebar"),n=l(".anchor"),r=s(t,".sidebar-nav"),i=s(t,"li.active"),a=me.scrollTop,u=0,c=n.length;ua){e||(e=p);break}e=p}if(e){var g=je[e.getAttribute("data-id")];if(g&&g!==i&&(i&&i.classList.remove("active"),g.classList.add("active"),i=g,!Me&&me.classList.contains("sticky"))){var h=t.clientHeight,d=i.offsetTop+i.clientHeight+40,f=i.offsetTop>=r.scrollTop&&d<=r.scrollTop+h,m=d-0=400)o(n);else{var i=qe[e]={content:n.response,opt:{updatedAt:r.getResponseHeader("last-modified")}};a(i.content,i.opt)}})},abort:function(e){return 4!==r.readyState&&r.abort()}})}function M(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}function O(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),''):""}function P(e){var t='';return(we?t+"
":"
"+t)+'
'}function q(){var e=", 100%, 85%";return'
'}function N(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
    • '+N(e.children)+"
    ")}),t):""}function H(e,t){return'

    '+t.slice(5).trim()+"

    "}function F(e){return""}function I(e,t){return t={exports:{}},e(t,t.exports),t.exports}function z(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,a=i-1;i>t||(r[a]?r[a].children=(r[a].children||[]).concat(e):n.push(e),r[i]=e)}),n}function R(e){if("string"!=typeof e)return"";var t=e.toLowerCase().trim().replace(/<[^>\d]+>/g,"").replace(Re,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=ze[t];return n=ze.hasOwnProperty(t)?n+1:0,ze[t]=n,n&&(t=t+"-"+n),t}function W(e,t){return''+t+''}function D(e){return $docsify.noEmoji?e:e.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,window.emojify||W).replace(/__colon__/g,":")}function B(e,t){var n="";if(e)n=Xe(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0];else{var r=Ge[Be]||z(Ve,t);n=N(r,"