From 8874c4a80e2ba8757932a7f5c2a7c8ef88c7d1cf Mon Sep 17 00:00:00 2001
From: oppofind <836575280@qq.com>
Date: Tue, 29 Oct 2019 11:09:00 +0800
Subject: [PATCH] update 'error code title ' set error when set language is
chinese
---
.../java/com/power/doc/builder/DocBuilderTemplate.java | 9 +++++++++
src/main/resources/template/AllInOne.adoc | 2 +-
src/main/resources/template/AllInOne.btl | 6 +++---
src/main/resources/template/AllInOne.html | 2 +-
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/power/doc/builder/DocBuilderTemplate.java b/src/main/java/com/power/doc/builder/DocBuilderTemplate.java
index e79fdfb..42b5f99 100644
--- a/src/main/java/com/power/doc/builder/DocBuilderTemplate.java
+++ b/src/main/java/com/power/doc/builder/DocBuilderTemplate.java
@@ -103,6 +103,15 @@ public class DocBuilderTemplate {
tpl.binding(TemplateVariable.VERSION_LIST.getVariable(), config.getRevisionLogs());
tpl.binding(TemplateVariable.VERSION.getVariable(),now);
tpl.binding(TemplateVariable.CREATE_TIME.getVariable(), strTime);
+ if (null != config.getLanguage()) {
+ if (DocLanguage.CHINESE.code.equals(config.getLanguage().getCode())) {
+ tpl.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), DocGlobalConstants.ERROR_CODE_LIST_CN_TITLE);
+ } else {
+ tpl.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), DocGlobalConstants.ERROR_CODE_LIST_EN_TITLE);
+ }
+ } else {
+ tpl.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), DocGlobalConstants.ERROR_CODE_LIST_CN_TITLE);
+ }
FileUtil.nioWriteFile(tpl.render(), outPath + FILE_SEPARATOR + outPutFileName);
}
diff --git a/src/main/resources/template/AllInOne.adoc b/src/main/resources/template/AllInOne.adoc
index e1f70f7..fc36d03 100644
--- a/src/main/resources/template/AllInOne.adoc
+++ b/src/main/resources/template/AllInOne.adoc
@@ -86,7 +86,7 @@ ${doc.responseUsage}
<% } %>
<% } %>
<%if(isNotEmpty(errorCodeList)){%>
-== Error code list
+== ${errorListTitle}
[width="100%",options="header"]
[stripes=even]
diff --git a/src/main/resources/template/AllInOne.btl b/src/main/resources/template/AllInOne.btl
index da274da..37529f6 100644
--- a/src/main/resources/template/AllInOne.btl
+++ b/src/main/resources/template/AllInOne.btl
@@ -13,11 +13,11 @@ ${revisionLog.version}|${revisionLog.revisionTime}|${revisionLog.status}|${revis
<%
for(api in apiDocList){
%>
-# ${api.desc}
+# ${api.order}. ${api.desc}
<%
for(doc in api.list){
%>
-## ${doc.desc}
+## ${api.order}.${doc.order} ${doc.desc}
**URL:** ${doc.url}
**Type:** ${doc.type}
@@ -74,7 +74,7 @@ ${doc.responseUsage}
<% } %>
<% } %>
<%if(isNotEmpty(errorCodeList)){%>
-# Error code list
+# ${apiDocList.~size+1}. ${errorListTitle}
Error code |Description
---|---
<%
diff --git a/src/main/resources/template/AllInOne.html b/src/main/resources/template/AllInOne.html
index c35b2c0..2b3865c 100644
--- a/src/main/resources/template/AllInOne.html
+++ b/src/main/resources/template/AllInOne.html
@@ -1,4 +1,4 @@
-
API Reference<%if(isNotEmpty(revisionLogList)){%>
Version | Update Time | Status | Author | Description |
<%for(revisionLog in revisionLogList){%>${revisionLog.version} | ${revisionLog.revisionTime} | ${revisionLog.status} | ${revisionLog.author} | ${revisionLog.remarks} |
<%}%>
<%}%><%for(api in apiDocList){%>
<%for(doc in api.list){%>
Content-Type:${doc.contentType}
Description:${doc.detail}
<%if(isNotEmpty(doc.requestHeaders)){%>
Header | Type | Description | Required | Since |
<%for(header in doc.requestHeaders){%>${header.name} | ${header.type} | ${header.desc} | ${header.required} | ${header.since} |
<%}%>
<%}%><%if(isNotEmpty(doc.requestParams)){%>
Parameter | Type | Description | Required | Since |
<%for(param in doc.requestParams){%>${param.field} | ${param.type} | ${param.desc} | ${param.required} | ${param.version} |
<%}%>
<%}%><%if(isNotEmpty(doc.requestUsage)){%>
<%}%><%if(isNotEmpty(doc.responseParams)){%>
Field | Type | Description | Since |
<%for(param in doc.responseParams){%>${param.field} | ${param.type} | ${param.desc} | ${param.version} |
<%}%>
<%}%><%if(isNotEmpty(doc.responseUsage)){%>
<%}%>
<%}%>
<%}%><%if(isNotEmpty(errorCodeList)){%>
Error code | Description |
<%for(error in errorCodeList){%>${error.value} | ${error.desc} |
<%}%>
<%}%>
+API Reference<%if(isNotEmpty(revisionLogList)){%>
Version | Update Time | Status | Author | Description |
<%for(revisionLog in revisionLogList){%>${revisionLog.version} | ${revisionLog.revisionTime} | ${revisionLog.status} | ${revisionLog.author} | ${revisionLog.remarks} |
<%}%>
<%}%><%for(api in apiDocList){%>
<%for(doc in api.list){%>
Content-Type:${doc.contentType}
Description:${doc.detail}
<%if(isNotEmpty(doc.requestHeaders)){%>
Header | Type | Description | Required | Since |
<%for(header in doc.requestHeaders){%>${header.name} | ${header.type} | ${header.desc} | ${header.required} | ${header.since} |
<%}%>
<%}%><%if(isNotEmpty(doc.requestParams)){%>
Parameter | Type | Description | Required | Since |
<%for(param in doc.requestParams){%>${param.field} | ${param.type} | ${param.desc} | ${param.required} | ${param.version} |
<%}%>
<%}%><%if(isNotEmpty(doc.requestUsage)){%>
<%}%><%if(isNotEmpty(doc.responseParams)){%>
Field | Type | Description | Since |
<%for(param in doc.responseParams){%>${param.field} | ${param.type} | ${param.desc} | ${param.version} |
<%}%>
<%}%><%if(isNotEmpty(doc.responseUsage)){%>
<%}%>
<%}%>
<%}%><%if(isNotEmpty(errorCodeList)){%>
Error code | Description |
<%for(error in errorCodeList){%>${error.value} | ${error.desc} |
<%}%>
<%}%>