From 661a40f0483e35b47ceae669272766b5007e45f2 Mon Sep 17 00:00:00 2001 From: chenqi <1535985458@qq.com> Date: Sun, 19 Nov 2023 23:01:23 +0800 Subject: [PATCH] feat: Adjust the interface url rules when the document is html Closes https://github.com/TongchengOpenSource/smart-doc/issues/658 --- src/main/resources/template/AllInOne.html | 2 +- src/main/resources/template/debug-all.html | 2 +- src/main/resources/template/html/index.html | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/resources/template/AllInOne.html b/src/main/resources/template/AllInOne.html index c12dc6a6..13f00bc8 100644 --- a/src/main/resources/template/AllInOne.html +++ b/src/main/resources/template/AllInOne.html @@ -1 +1 @@ -<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%><%if(isNotEmpty(highlightCssLink)){%><%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

<%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}.${htmlEscape(apiGroup.name)}

<%}%><%for(api in apiGroup.childrenApiDocs){%>

<%if(apiGroupLP.size>1){%>${apiGroup.order}.${api.order}.${htmlEscape(api.desc)}<%}else{%>${api.order}.${htmlEscape(api.desc)}<%}%>

<%for(doc in api.list){%>

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.<%}else{%>${api.order}.${doc.order}.<%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}%><%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderTypeDescriptionRequiredSince

${header.name}

${header.type}

${htmlEscape(header.desc)}

${header.required}

${header.since}

<%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%>

Query-parameters:

<%for(param in doc.queryParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%>

Body-parameters:

<%for(param in doc.requestParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Request-example:

${doc.requestUsage}
<%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${param.desc}

${param.version}

<%}%><%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%>
<%}%>
<%}%><%}%><%if(isNotEmpty(errorCodeList)){%>

${errorCodeListOrder}.${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}.${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}.${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
CodeTypeDescription

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
Top
\ No newline at end of file +<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%><%if(isNotEmpty(highlightCssLink)){%><%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

<%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}.${htmlEscape(apiGroup.name)}

<%}%><%for(api in apiGroup.childrenApiDocs){%>

<%if(apiGroupLP.size>1){%>${apiGroup.order}.${api.order}.${htmlEscape(api.desc)}<%}else{%>${api.order}.${htmlEscape(api.desc)}<%}%>

<%for(doc in api.list){%>

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.<%}else{%>${api.order}.${doc.order}.<%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}%><%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderTypeDescriptionRequiredSince

${header.name}

${header.type}

${htmlEscape(header.desc)}

${header.required}

${header.since}

<%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%>

Query-parameters:

<%for(param in doc.queryParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%>

Body-parameters:

<%for(param in doc.requestParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Request-example:

${doc.requestUsage}
<%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${param.desc}

${param.version}

<%}%><%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%>
<%}%>
<%}%><%}%><%if(isNotEmpty(errorCodeList)){%>

${errorCodeListOrder}.${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}.${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}.${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
CodeTypeDescription

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
Top
\ No newline at end of file diff --git a/src/main/resources/template/debug-all.html b/src/main/resources/template/debug-all.html index 889c60ec..6958db28 100644 --- a/src/main/resources/template/debug-all.html +++ b/src/main/resources/template/debug-all.html @@ -1 +1 @@ -<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%><%if(isNotEmpty(highlightCssLink)){%><%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

<%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}. ${htmlEscape(apiGroup.name)}

<%}%><%for(api in apiGroup.childrenApiDocs){%>

<%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}. ${htmlEscape(api.desc)}<%}else{%>${api.order}. ${htmlEscape(api.desc)}<%}%>

<%for(doc in api.list){%>

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}. <%}else{%>${api.order}.${doc.order}. <%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}. ${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}. ${htmlEscape(doc.desc)}<%}%><%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderValueTypeRequiredDescription

${header.name}

${header.type}

${header.required}

${htmlEscape(header.desc)}

<%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterValueTypeRequiredDescription

${param.field}

${param.type}

${param.required}

${param.desc}

<%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%>

Query-parameters:

<%for(param in doc.queryParams){%><%if(param.version!='-'){%><%}else{%><%}%><%}%>
ParameterValueTypeRequiredDescription

${param.field}

<%if(param.type=="file"&&!param.hasItems){%><%}else if(param.type=="file"&¶m.hasItems){%><%}else{%><%}%>

${param.type}

${param.required}

${param.desc}@since ${param.version}

${param.desc}

<%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%>

Body-parameters:

<%for(param in doc.requestParams){%><%if(param.version!='-'){%><%}else{%><%}%><%}%>
ParameterTypeRequiredDescription

${param.field}

${param.type}

${param.required}

${param.desc}@since ${param.version}

${param.desc}

<%}%><%if(isNotEmpty(doc.requestExample.jsonBody)&&isRequestExample){%>

Request-body:

${doc.requestExample.jsonBody}
<%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${param.desc}

${param.version}

<%}%>

<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Curl-example:

${doc.requestUsage}
<%}%>
<%}%>
<%}%><%}%><%if(isNotEmpty(errorCodeList)){%>

${errorCodeListOrder}. ${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}. ${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}. ${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
CodeTypeDescription

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
Top
\ No newline at end of file +<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%><%if(isNotEmpty(highlightCssLink)){%><%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

<%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}. ${htmlEscape(apiGroup.name)}

<%}%><%for(api in apiGroup.childrenApiDocs){%>

<%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}. ${htmlEscape(api.desc)}<%}else{%>${api.order}. ${htmlEscape(api.desc)}<%}%>

<%for(doc in api.list){%>

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}. <%}else{%>${api.order}.${doc.order}. <%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}. ${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}. ${htmlEscape(doc.desc)}<%}%><%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderValueTypeRequiredDescription

${header.name}

${header.type}

${header.required}

${htmlEscape(header.desc)}

<%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterValueTypeRequiredDescription

${param.field}

${param.type}

${param.required}

${param.desc}

<%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%>

Query-parameters:

<%for(param in doc.queryParams){%><%if(param.version!='-'){%><%}else{%><%}%><%}%>
ParameterValueTypeRequiredDescription

${param.field}

<%if(param.type=="file"&&!param.hasItems){%><%}else if(param.type=="file"&¶m.hasItems){%><%}else{%><%}%>

${param.type}

${param.required}

${param.desc}@since ${param.version}

${param.desc}

<%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%>

Body-parameters:

<%for(param in doc.requestParams){%><%if(param.version!='-'){%><%}else{%><%}%><%}%>
ParameterTypeRequiredDescription

${param.field}

${param.type}

${param.required}

${param.desc}@since ${param.version}

${param.desc}

<%}%><%if(isNotEmpty(doc.requestExample.jsonBody)&&isRequestExample){%>

Request-body:

${doc.requestExample.jsonBody}
<%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${param.desc}

${param.version}

<%}%>

<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Curl-example:

${doc.requestUsage}
<%}%>
<%}%>
<%}%><%}%><%if(isNotEmpty(errorCodeList)){%>

${errorCodeListOrder}. ${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}. ${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}. ${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
CodeTypeDescription

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
Top
\ No newline at end of file diff --git a/src/main/resources/template/html/index.html b/src/main/resources/template/html/index.html index 85f65784..c9ee3e34 100644 --- a/src/main/resources/template/html/index.html +++ b/src/main/resources/template/html/index.html @@ -29,7 +29,7 @@ @@ -37,9 +37,9 @@ <%}else{%>
  • ${api.order}. ${htmlEscape(api.desc)} @@ -62,11 +62,11 @@

    ${order}. ${htmlEscape(desc)}