Skip to content

Commit

Permalink
fix: amend doc server
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdingding committed Aug 26, 2022
1 parent af6da61 commit b992988
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ API 解释说明。

- `lang` 表示要获取的文档的语言,目前支持 `zh`/`en` 两种。
- `key` 表示要获取的文档的唯一标识符,这个 `key` 要和文档的文件名一致。
- `sections` 可选参数,表示要获取文档的哪几部分,这里的 `section` 要和制定文档中的 `data-section` 属性一致。如果 `sections` 为空,则表示获取整篇文档。
- `sections` 可选参数,表示要获取文档的哪几部分,这里的 `section` 要和制定文档中的 `data-section` 属性一致。如果不传 `sections` `sections` 为空数组,则表示获取整篇文档。

**返回值**

Expand Down
4 changes: 1 addition & 3 deletions src/server/controllers/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ export function retrieveDocs(criteria, htmlDocs) {
const fragment = JSDOM.fragment(doc.data);
item.sections.forEach(section => {
const element = fragment.querySelector(`[data-section=${section}]`);
if (element) {
result.data.push(element.outerHTML);
}
result.data.push(element?.outerHTML);
});
results.push(result);
});
Expand Down

0 comments on commit b992988

Please sign in to comment.