|
1 | 1 | const languages = { |
2 | | - title: 'Language', |
3 | | - type: 'dropdown', |
4 | | - exact: true, |
5 | | - items: [ |
6 | | - { title: 'English', path: '/en/', matchPath: /\/en\/.*/i } |
7 | | - ] |
| 2 | + title: 'Language', |
| 3 | + type: 'dropdown', |
| 4 | + exact: true, |
| 5 | + items: [{ title: 'English', path: '/en/', matchPath: /\/en\/.*/i }] |
8 | 6 | } |
9 | 7 |
|
10 | 8 | const home = { title: 'Home', path: '/' } |
11 | 9 |
|
12 | 10 | const versions = [ |
13 | | - { title: 'Version 2.2', path: '/2.2/', matchPath: /^\/([a-z-]+)\/2.2\/.*/i }, |
14 | | - { title: 'Version 2.3', path: '/2.3/', matchPath: /^\/([a-z-]+)\/2.3\/.*/i }, |
| 11 | + { title: 'Version 2.2', path: '/2.2/', matchPath: /^\/([a-z-]+)\/2.2\/.*/i }, |
| 12 | + { title: 'Version 2.3', path: '/2.3/', matchPath: /^\/([a-z-]+)\/2.3\/.*/i } |
15 | 13 | ] |
16 | 14 |
|
17 | 15 | function lang_version(lang) { |
18 | | - const version = { |
19 | | - title: 'Version', |
20 | | - type: 'dropdown', |
21 | | - exact: true, |
22 | | - } |
23 | | - version.items = versions.map(function (v) { |
24 | | - const ver = Object.assign({}, v) |
25 | | - ver.path = '/' + lang + ver.path |
26 | | - |
27 | | - return ver |
28 | | - }) |
| 16 | + const version = { |
| 17 | + title: 'Version', |
| 18 | + type: 'dropdown', |
| 19 | + exact: true |
| 20 | + } |
| 21 | + version.items = versions.map(function(v) { |
| 22 | + const ver = Object.assign({}, v) |
| 23 | + ver.path = '/' + lang + ver.path |
29 | 24 |
|
30 | | - return version |
| 25 | + return ver |
| 26 | + }) |
| 27 | + |
| 28 | + return version |
31 | 29 | } |
32 | 30 |
|
33 | 31 | docute.init({ |
34 | | - repo: 'vuejs/rollup-plugin-vue', |
35 | | - 'edit-link': 'https://github.com/vuejs/rollup-plugin-vue/edit/master/docs', |
36 | | - |
37 | | - nav: { |
38 | | - default: [home, languages, lang_version('en')], |
39 | | - 'en2.3': [{ title: 'Home', path: '/en/2.3/' }, { title: 'Examples', path: '/en/2.3/examples' }, languages, lang_version('en')], |
40 | | - 'en2.2': [{ title: 'Home', path: '/en/2.2/' }, { title: 'Examples', path: '/en/2.2/examples' }, languages, lang_version('en')], |
41 | | - }, |
42 | | - |
43 | | - plugins: [ |
44 | | - docsearch({ |
45 | | - apiKey: '7792597613e997afeb0b75a206ca0c5a', |
46 | | - indexName: 'rollup-plugin-vue', |
47 | | - url: 'https://vuejs.github.io/rollup-plugin-vue' |
48 | | - }) |
| 32 | + repo: 'vuejs/rollup-plugin-vue', |
| 33 | + 'edit-link': 'https://github.com/vuejs/rollup-plugin-vue/edit/master/docs', |
| 34 | + |
| 35 | + nav: { |
| 36 | + default: [home, languages, lang_version('en')], |
| 37 | + 'en2.3': [ |
| 38 | + { title: 'Home', path: '/en/2.3/' }, |
| 39 | + { title: 'Examples', path: '/en/2.3/examples' }, |
| 40 | + languages, |
| 41 | + lang_version('en') |
| 42 | + ], |
| 43 | + 'en2.2': [ |
| 44 | + { title: 'Home', path: '/en/2.2/' }, |
| 45 | + { title: 'Examples', path: '/en/2.2/examples' }, |
| 46 | + languages, |
| 47 | + lang_version('en') |
49 | 48 | ] |
50 | | - |
| 49 | + }, |
| 50 | + |
| 51 | + plugins: [ |
| 52 | + docsearch({ |
| 53 | + apiKey: '7792597613e997afeb0b75a206ca0c5a', |
| 54 | + indexName: 'rollup-plugin-vue', |
| 55 | + url: 'https://vuejs.github.io/rollup-plugin-vue' |
| 56 | + }) |
| 57 | + ] |
51 | 58 | }) |
0 commit comments