fix Adoc template style

This commit is contained in:
oppofind 2019-09-30 10:10:13 +08:00
parent 7be04d61be
commit 0f8fc0bcf7
6 changed files with 19 additions and 17 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId>
<packaging>jar</packaging>
<version>1.6.4</version>
<version>1.7.0</version>
<name>smart-doc</name>
<url>https://github.com/shalousun/smart-doc.git</url>

View File

@ -188,8 +188,9 @@ public class SourceBuilder {
String annotationName = annotation.getType().getName();
if (REQUEST_MAPPING.equals(annotationName) || DocGlobalConstants.REQUEST_MAPPING_FULLY.equals(annotationName)) {
url = DocUtil.handleMappingValue(annotation);
if (null != annotation.getNamedParameter("method")) {
methodType = annotation.getNamedParameter("method").toString();
Object nameParam = annotation.getNamedParameter("method");
if (null != nameParam) {
methodType = nameParam.toString();
methodType = DocUtil.handleHttpMethod(methodType);
} else {
methodType = "GET";
@ -381,9 +382,9 @@ public class SourceBuilder {
} else if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(className)) {
ApiParam param = ApiParam.of().setField(pre + "any object").setType("object");
if (StringUtil.isEmpty(isRequired)) {
param.setDesc("any object.").setVersion(DocGlobalConstants.DEFAULT_VERSION);
param.setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setVersion(DocGlobalConstants.DEFAULT_VERSION);
} else {
param.setDesc("any object.").setRequired(false).setVersion(DocGlobalConstants.DEFAULT_VERSION);
param.setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setRequired(false).setVersion(DocGlobalConstants.DEFAULT_VERSION);
}
paramList.add(param);
@ -489,7 +490,7 @@ public class SourceBuilder {
String gNameTemp = field.getType().getGenericCanonicalName();
if (DocGlobalConstants.JAVA_MAP_FULLY.equals(gNameTemp)) {
ApiParam param1 = ApiParam.of().setField(preBuilder.toString() + "any object")
.setType("object").setDesc("any object").setVersion(DocGlobalConstants.DEFAULT_VERSION);
.setType("object").setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setVersion(DocGlobalConstants.DEFAULT_VERSION);
paramList.add(param1);
continue;
}

View File

@ -9,7 +9,7 @@ public class DocGlobalConstants {
public static final String HTML_DOC_OUT_PATH = "src/main/resources/static/doc";
public static final String ADOC_OUT_PATH = "src/main/docs/asciidoc";
public static final String ADOC_OUT_PATH = "src/docs/asciidoc";
public static final String PROJECT_CODE_PATH = "src/main/java";
@ -62,7 +62,6 @@ public class DocGlobalConstants {
public static final String MODE_AND_VIEW_FULLY = "org.springframework.web.servlet.ModelAndView";
public static final String JAVA_OBJECT_FULLY = "java.lang.Object";
public static final String JAVA_STRING_FULLY = "java.lang.String";
@ -78,4 +77,6 @@ public class DocGlobalConstants {
public static final String ERROR_CODE_LIST_EN_TITLE = "Error Code List";
public static final String FIELD_SPACE = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
public static final String ANY_OBJECT_MSG = "any object.";
}

View File

@ -1,6 +1,6 @@
<%if(isNotEmpty(revisionLogList)){%>
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Version | Update Time | Status | Author | Description
@ -30,7 +30,7 @@ for(doc in api.list){
<%if(isNotEmpty(doc.headers)){%>
*Request-headers:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Header | Type|Description|Required|Since
@ -41,7 +41,7 @@ ${doc.headers}
<%if(isNotEmpty(doc.requestParams)){%>
*Request-parameters:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Parameter | Type|Description|Required|Since
@ -62,7 +62,7 @@ ${doc.requestUsage}
<%if(isNotEmpty(doc.responseParams)){%>
*Response-fields:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Field | Type|Description|Since
@ -86,7 +86,7 @@ ${doc.responseUsage}
<%if(isNotEmpty(errorCodeList)){%>
== Error code list
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Error code |Description

View File

@ -13,7 +13,7 @@ for(doc in list){
<%if(isNotEmpty(doc.headers)){%>
*Request-headers:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Header | Type|Description|Required|Since
@ -24,7 +24,7 @@ ${doc.headers}
<%if(isNotEmpty(doc.requestParams)){%>
*Request-parameters:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Parameter | Type|Description|Required|Since
@ -45,7 +45,7 @@ ${doc.requestUsage}
<%if(isNotEmpty(doc.responseParams)){%>
*Response-fields:*
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Field | Type|Description|Since

View File

@ -1,6 +1,6 @@
# Error code list
[width="100%",options="header,footer"]
[width="100%",options="header"]
[stripes=even]
|====================
|Error code |Description