File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ API 解释说明。
24
24
25
25
- ` lang ` 表示要获取的文档的语言,目前支持 ` zh ` /` en ` 两种。
26
26
- ` key ` 表示要获取的文档的唯一标识符,这个 ` key ` 要和文档的文件名一致。
27
- - ` sections ` 可选参数,表示要获取文档的哪几部分,这里的 ` section ` 要和制定文档中的 ` data-section ` 属性一致。如果 ` sections ` 为空 ,则表示获取整篇文档。
27
+ - ` sections ` 可选参数,表示要获取文档的哪几部分,这里的 ` section ` 要和制定文档中的 ` data-section ` 属性一致。如果不传 ` sections ` 或 ` sections ` 为空数组 ,则表示获取整篇文档。
28
28
29
29
** 返回值**
30
30
Original file line number Diff line number Diff line change @@ -24,9 +24,7 @@ export function retrieveDocs(criteria, htmlDocs) {
24
24
const fragment = JSDOM . fragment ( doc . data ) ;
25
25
item . sections . forEach ( section => {
26
26
const element = fragment . querySelector ( `[data-section=${ section } ]` ) ;
27
- if ( element ) {
28
- result . data . push ( element . outerHTML ) ;
29
- }
27
+ result . data . push ( element ?. outerHTML ) ;
30
28
} ) ;
31
29
results . push ( result ) ;
32
30
} ) ;
You can’t perform that action at this time.
0 commit comments