Skip to content

Commit b633f15

Browse files
committed
优化api打包 可链接外部文档 支持L的factionFunction
1 parent e5e32e2 commit b633f15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2694
-27
lines changed

build/jsdocs/leaflet/docs.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"opts": {
33
"recurse": true,
4-
"template": "../../node_modules/jaguarjs-jsdoc",
4+
"template": "../template",
55
"destination": "./docs/leaflet"
66
},
77
"disqus":"",
88
"tags": {
9-
"allowUnknownTags": true
9+
"allowUnknownTags": true,
10+
"linkdoc-leaflet":"http://leafletjs.com/reference-1.2.0.html"
1011
},
1112
"source": {
1213
"includePattern": ".+\\.js?$",
@@ -15,10 +16,10 @@
1516
"src/common","src/leaflet"
1617
]
1718
},
18-
"plugins": ["plugins/markdown"],
19+
"plugins": ["plugins/markdown","../plugins/factoryFunction","../plugins/linkdoc"],
1920
"templates": {
20-
"cleverLinks": false,
21-
"monospaceLinks": false,
21+
"cleverLinks": true,
22+
"monospaceLinks": true,
2223
"default": {
2324
"outputSourceFiles": false
2425
},

build/jsdocs/legacy/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"opts": {
33
"recurse": true,
4-
"template": "../../node_modules/jaguarjs-jsdoc",
4+
"template": "../template",
55
"destination": "./docs/legacy"
66
},
77
"disqus":"",

build/jsdocs/mapboxgl/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"opts": {
33
"recurse": true,
4-
"template": "../../node_modules/jaguarjs-jsdoc",
4+
"template": "../template",
55
"destination": "./docs/mapboxgl"
66
},
77
"disqus":"",

build/jsdocs/openlayers/docs.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"opts": {
33
"recurse": true,
4-
"template": "../../node_modules/jaguarjs-jsdoc",
4+
"template": "../template",
55
"destination": "./docs/openlayers"
66
},
77
"disqus":"",
88
"tags": {
9-
"allowUnknownTags": true
9+
"allowUnknownTags": true,
10+
"linkdoc-openlayers":"https://openlayers.org/en/latest/apidoc/",
11+
"linkdoc-htmlExtension":true
1012
},
1113
"source": {
1214
"includePattern": ".+\\.js?$",
@@ -15,7 +17,7 @@
1517
"src/common","src/openlayers"
1618
]
1719
},
18-
"plugins": ["plugins/markdown"],
20+
"plugins": ["plugins/markdown","../plugins/linkdoc"],
1921
"templates": {
2022
"cleverLinks": false,
2123
"monospaceLinks": false,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
var logger = require('jsdoc/util/logger');
4+
5+
exports.handlers = {
6+
/**
7+
* Support @source tag. Expected value like:
8+
*
9+
* { "filename": "myfile.js", "lineno": 123 }
10+
*
11+
* Modifies the corresponding meta values on the given doclet.
12+
*
13+
* WARNING: If you are using a JSDoc template that generates pretty-printed source files,
14+
* such as JSDoc's default template, this plugin can cause JSDoc to crash. To fix this issue,
15+
* update your template settings to disable pretty-printed source files.
16+
*
17+
* @source { "filename": "sourcetag.js", "lineno": 9 }
18+
*/
19+
newDoclet: function (e) {
20+
var longname = e.doclet.longname
21+
if (longname && longname.indexOf('L.') == 0) {
22+
e.doclet.isFactoryFunction = true;
23+
}
24+
25+
}
26+
};

build/jsdocs/plugins/linkdoc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var logger = require('jsdoc/util/logger');
4+
5+
exports.handlers = {
6+
newDoclet: function (e) {
7+
if (e.doclet.augments) {
8+
for (var i = 0; i < e.doclet.augments.length; i++) {
9+
var a = e.doclet.augments[i];
10+
if (a.indexOf("@linkdoc")) {
11+
var reg = new RegExp("@(.*?)/");
12+
var match = a.match(reg);
13+
if (match) {
14+
e.doclet.augments[i] = a.replace("@" + match[1] + "/", env.conf.tags[match[1]]);
15+
if (env.conf.tags["linkdoc-htmlExtension"]) {
16+
e.doclet.augments[i] = e.doclet.augments[i].replace("}", ".html}");
17+
}
18+
}
19+
20+
}
21+
}
22+
}
23+
}
24+
};

build/jsdocs/template/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This template is based on the [jaguarjs-jsdoc](https://github.com/davidshimjs/jaguarjs-jsdoc) template which under the MIT License and refered by default template for JSDoc 3.

0 commit comments

Comments
 (0)