docsify-mustache
Advanced tools
@@ -1,2 +0,2 @@ | ||
| !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){$docsify.plugins=[].concat($docsify.plugins,(function(e,t){let r=n(1).render,o={};var i;function a(e){"string"==typeof e?s(e):"object"==typeof e&&(Array.isArray(e)?e.forEach(a):c(t.mustache,e))}function s(e,n){function r(){delete o[e],0==Object.keys(o).length&&i&&(i(),i=void 0)}o[e]=!0,Docsify.get(e,!0).then(e=>{let o=function(e){if(!e.startsWith("<"))return JSON.parse(e);return function e(t,n){let r={};for(var o=n.firstChild;null!==o;o=o.nextSibling)o.nodeType==Node.ELEMENT_NODE&&e(r,o);return t[n.tagName]=0!=Object.keys(r).length?r:n.textContent,t}({},(new DOMParser).parseFromString(e,"text/xml").documentElement)}(e);n?t.mustache[n]=o:c(t.mustache,o),r()},e=>{console.log(e),r()})}function c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}e.init((function(){t.mustache=t.mustache||{};var e=window.$docsify.mustache||{};e.noPackage||s("/package.json","package"),e.data&&a(e.data)})),e.beforeEach((function(e,n){var a=function(){var o={};c(o,t.mustache),t.frontmatter&&c(o,t.frontmatter),n(r(e,o))};0==Object.keys(o).length?a():i=a}))}))},function(e,t,n){e.exports=function(){"use strict"; | ||
| !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){$docsify.plugins=[].concat($docsify.plugins,(function(e,t){let r=n(1).render,o={};var i;function a(e){"string"==typeof e?s(e):"object"==typeof e&&(Array.isArray(e)?e.forEach(a):c(t.mustache,e))}function s(e,n){function r(){delete o[e],0==Object.keys(o).length&&i&&(i(),i=void 0)}o[e]=!0,Docsify.get(e,!0).then(e=>{let o=function(e){if(!e.startsWith("<"))return JSON.parse(e);return function e(t,n){let r={};for(var o=n.firstChild;null!==o;o=o.nextSibling)o.nodeType==Node.ELEMENT_NODE&&e(r,o);return t[n.tagName]=0!=Object.keys(r).length?r:n.textContent,t}({},(new DOMParser).parseFromString(e,"text/xml").documentElement)}(e);n?t.mustache[n]=o:c(t.mustache,o),r()},e=>{console.log(e),r()})}function c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}e.init((function(){t.mustache=t.mustache||{};var e=window.$docsify.mustache||{};e.noPackage||s("package.json","package"),e.data&&a(e.data)})),e.beforeEach((function(e,n){var a=function(){var o={};c(o,t.mustache),t.frontmatter&&c(o,t.frontmatter),n(r(e,o))};0==Object.keys(o).length?a():i=a}))}))},function(e,t,n){e.exports=function(){"use strict"; | ||
| /*! | ||
@@ -3,0 +3,0 @@ * mustache.js - Logic-less {{mustache}} templates with JavaScript |
+1
-1
| { | ||
| "name": "docsify-mustache", | ||
| "version": "1.0.3", | ||
| "version": "1.0.4", | ||
| "description": "A Docsify plugin that allow preprocessing markdown documents with Mustache template engine. You can substitute variables in markdown documents using mustache syntax {{variable}} and {{variable.property}}.", | ||
@@ -5,0 +5,0 @@ "main": "dist/docsify-mustache.min.js", |
+42
-0
@@ -23,2 +23,44 @@ # docsify-mustache | ||
| ## Options | ||
| ### data | ||
| You can load Mustache variables with `data` option. The value can be a *string*, *object* or *array*. | ||
| - *string* value interpreted as data file URL (relative or absolute). Both JSON and XML data file formats are supported. | ||
| - properties from JSON data file will be available as Mustache variables | ||
| - XML root element will be mapped to Mustache variable with root elements tag name as variable name | ||
| - *object* properties will be mapped to Mustache variables using property name as variable name | ||
| - *array* may be use to specify multiple string or object values as data sources | ||
| Example: | ||
| ```javascript | ||
| window.$docsify = { | ||
| mustache: { | ||
| data: [ | ||
| 'doc/vars.json', | ||
| 'doc/pom.xml', | ||
| { | ||
| question: 'What is your favorite number?' | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
| > There is no way to access XML attributes, tag names used for hierarchy and for referring element's inner text. | ||
| ### package | ||
| The plugin loads `package.json` and make it available for Mustache as `package` variable. You can disable this feature setting `noPackage` option to `true` value: | ||
| ```javascript | ||
| window.$docsify = { | ||
| mustache: { | ||
| noPackage : true | ||
| } | ||
| } | ||
| ``` | ||
| ## Documentation | ||
@@ -25,0 +67,0 @@ |
12993
9.93%72
140%