Skip to content

Commit

Permalink
【doc】jsdoc输出fun lineNo
Browse files Browse the repository at this point in the history
  • Loading branch information
songyumeng committed Oct 8, 2023
1 parent 83fc392 commit afc8d20
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/jsdocs/plugins/moduleCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports.handlers = {
e.doclet.modulecategory.className = modulecategory.name;
if (!modulecategory.name.startsWith('SuperMap')) {
const matchTag = e.doclet.tags.find(tag => tag.title === 'browsernamespace') || {};
const prefix = matchTag.value || globalParams.namespace;
const prefix = matchTag.value || (globalParams && globalParams.namespace);
e.doclet.modulecategory.name = `${prefix}.${modulecategory.name}`;
}
e.doclet.modulecategory.des = (e.doclet.classdesc || '').split('。')[0].replace('<p>', '').replace('类', '');
Expand Down
14 changes: 11 additions & 3 deletions build/jsdocs/template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,15 @@ function buildNav(members, view, templatePath) {
for (const key in view.navMap ) {
if (Object.hasOwnProperty.call(view.navMap , key)) {
const element = view.navMap[key];
const m = element.methods.map(e => {
return e.name;
if(element.scope === 'global'){
element.methods = [element];
}
const m = element.methods.filter((e)=>{
return !e.inherited
}).map(e => {
var commentLength = e.comment && !e.meta.range?e.comment.split('\n').length:0;
var funLineNo = e.meta.lineno + commentLength;
return {name:e.name,lineNo:funLineNo,version:e.version || element.version};
});
if(!element.fileName && m.length>0){
console.log("没有文件名的类:", element.longname,element.type,m)
Expand Down Expand Up @@ -432,7 +439,8 @@ function buildNavMap(members,linkto) {
events: find({
kind: 'event',
memberof: v.longname
})
}),
...v
};
}
navMap[v.longname] = nav;
Expand Down
6 changes: 5 additions & 1 deletion build/jsdocs/template/tmpl/navigation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var self = this;
//}

function build(nav,navOrder,level){

if(!nav){
return;
}
Expand Down Expand Up @@ -68,6 +69,7 @@ function build(nav,navOrder,level){
}
}
function buildLi(obj){

?>
<li class="item" file-name="<?js= obj.fileName ?>" data-name="<?js= obj.longname ?>">
<span class="title" title="<?js= obj.longname ?>">
Expand Down Expand Up @@ -109,8 +111,10 @@ function buildLi(obj){
<?js

obj.methods.forEach(function (v) {
var commentLength = v.comment?v.comment.split('\n').length:0;
var funLineNo = v.meta.lineno + commentLength;
?>
<li data-version= "<?js= v.version||obj.version ?>" data-name="<?js= v.longname ?>"><?js= self.linkto(v.longname, v.name) ?></li>
<li data-version= "<?js= v.version||obj.version ?>" data-name="<?js= v.longname ?>" data-line="<?js= funLineNo ?>"><?js= self.linkto(v.longname, v.name) ?></li>
<?js
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/mapboxgl/overlay/FGBLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class FGBLayer {
}

/**
* @function DeckglLayer.prototype.onAdd
* @function FGBLayer.prototype.onAdd
* @param {mapboxgl.Map} map - MapBoxGL Map 对象。
*/
onAdd(map) {
Expand Down Expand Up @@ -102,13 +102,13 @@ export class FGBLayer {
this._handleFeatures(extent);
}
/**
* @function DeckglLayer.prototype.onRemove
* @function FGBLayer.prototype.onRemove
*/
onRemove() {
this.map.off('moveend', this._updateFeaturesFn);
}
/**
* @function DeckglLayer.prototype.moveLayer
* @function FGBLayer.prototype.moveLayer
*/
moveLayer(beforeId) {
this.map.moveLayer(this.layerId, beforeId);
Expand Down

0 comments on commit afc8d20

Please sign in to comment.