({ template, config, cache })
| 59 | |
| 60 | export default class Renderer { |
| 61 | constructor({ template, config, cache }) { |
| 62 | this.html = template; |
| 63 | this.config = config = Object.assign({}, config, { |
| 64 | routerMode: 'history', |
| 65 | }); |
| 66 | this.cache = cache; |
| 67 | |
| 68 | this.router = new AbstractHistory(config); |
| 69 | this.compiler = new Compiler(config, this.router); |
| 70 | |
| 71 | this.router.getCurrentPath = () => this.url; |
| 72 | this._renderHtml( |
| 73 | 'inject-config', |
| 74 | `<script>window.$docsify = ${JSON.stringify(config)}</script>` |
| 75 | ); |
| 76 | this._renderHtml('inject-app', mainTpl(config)); |
| 77 | |
| 78 | this.template = this.html; |
| 79 | } |
| 80 | |
| 81 | _getPath(url) { |
| 82 | const file = this.router.getFile(url); |
nothing calls this directly
no test coverage detected