Skip to content

Commit

Permalink
[Feature] add for new
Browse files Browse the repository at this point in the history
  • Loading branch information
houbb committed Mar 16, 2019
1 parent fb8dcbc commit 4306097
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 38 deletions.
24 changes: 21 additions & 3 deletions doc/blog/文档生成-04-字段类型别名支持.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,26 @@ public class TypeAliasSimpleBean {

但是数量比较多的时候就没有那么方便,本来考虑添加对应的配置属性接口,权衡下还是使用了 xml 配置的方式。

## i18n
## 是否使用 comment 信息?

到目前为止,本项目的设计都过于拘泥于中文。
如果一个字段,没有指定别名,是否使用 comment 信息做替代?

后期如果考虑到扩展的话,将考虑添加 i18n 支持。
建议使用,当前版本不做处理。

- 为什么使用

比起冗长的类信息,大部分人更乐于看到解释。

如果是针对同构的系统(都是 java 语言),则可以理解。

如果是针对异构的系统(比如前台是 php),则不易于理解。

- 为什么不处理

大部分的接口都是常见字段, 性价比不高。

可能存在字段没有些 comment 的情况,会导致判断的复杂性。

## 如果用户不想使用别名

直接修改模板即可,使用原来的字段 `type` 属性即可。
Empty file removed doc/issues/v0.0.3.md
Empty file.
28 changes: 27 additions & 1 deletion doc/issues/v0.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,30 @@

Type 可以映射为对应的中文。

支持用户自定义。
支持用户自定义。

# 其他思考

## 是否使用 comment 信息?

如果一个字段,没有指定别名,是否使用 comment 信息做替代?

建议使用,当前版本不做处理。

- 为什么使用

比起冗长的类信息,大部分人更乐于看到解释。

如果是针对同构的系统(都是 java 语言),则可以理解。

如果是针对异构的系统(比如前台是 php),则不易于理解。

- 为什么不处理

大部分的接口都是常见字段, 性价比不高。

可能存在字段没有些 comment 的情况,会导致判断的复杂性。

## 如果用户不想使用别名

直接修改模板即可,使用原来的字段 `type` 属性即可。
21 changes: 19 additions & 2 deletions doc/issues/v0.2.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# 添加对于 word 的支持
# 生成序号

## word 怎么可以最简单??
有时候 word 文档对于序号要求比较多。

生成对应的序号。

## 序号

默认不开启序号。

## 支持用户自定义

enableOrder=false
enableOrder=true

## 处理

无论用户开启与否,都有 order 相关属性的处理。

用户可以自定义模板选择是否展示响应的 order 信息。

22 changes: 3 additions & 19 deletions doc/issues/v0.3.0.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# 多线程处理
# 生成对应的索引文件

提升性能
index.md 文件的生成

# 全局属性

初始化构建的时候,存放一个全局的 javaClass 信息 map,并且加载到内存中。

用于 @see @throw 列表的信息获取。

# 继续补全信息。

# 后续优化方向

所有的版本列表

since 列表

author 列表

需要一个 `IDocContext`
当不是 all-in-one 的时候。
25 changes: 25 additions & 0 deletions doc/issues/v0.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 多线程处理

提升性能。

直接使用 `Async` 框架即可。

不用重复造轮子。

# 全局属性

初始化构建的时候,存放一个全局的 javaClass 信息 map,并且加载到内存中。

用于 @see @throw 列表的信息获取。

# 继续补全信息。

# 后续优化方向

所有的版本列表

since 列表

author 列表

需要一个 `IDocContext`
11 changes: 11 additions & 0 deletions doc/issues/v0.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# i18n

对于编码信息

用户可以指定一个属性 `lang=zh_CN` 默认为中文。

## 英文

暂时考虑只支持英文

后续有时间可以主键添加,保证 i18n 即可。
12 changes: 11 additions & 1 deletion doc/issues/word替换符号的设计.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@

2. 替换掉其中的列表等处理信息(使用FTL的处理方式)

3. 设置好替换后的文本内容。
3. 设置好替换后的文本内容。

# 类型转换的问题

专业的事情应该交给专业的人来做。

统一使用 pandoc 来实现。

https://github.com/jgm/pandoc/releases/tag/2.2.3.2

word 可以使用 wirteage
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<#if class??>
# ${class.name}-${class.comment!""}
## ${class.name}-${class.comment!""}

${class.remark!"暂无类备注信息"}
${class.remark!class.comment!""}

<#if class.methods??>
<#list class.methods as method>
## ${method.name}-${method.comment!""}
### ${method.name}-${method.comment!""}

${method.remark!"暂无方法备注信息"}
${method.remark!method.comment!""}

### 方法入参
#### 方法入参

| 字段 | 说明 | 字段类型 | 是否必填 | 备注 |
|:---|:---|:---|:---|:----|
Expand All @@ -21,7 +21,7 @@ ${method.remark!"暂无方法备注信息"}
暂无入参
</#if>

#### 方法入参详情
##### 方法入参详情
<#if method.paramDetails?? && (method.paramDetails?size > 0)>
<#list method.paramDetails?keys as detailName>

Expand All @@ -37,19 +37,19 @@ ${method.remark!"暂无方法备注信息"}
暂无入参详情
</#if>

### 方法出参
#### 方法出参

| 字段 | 说明 | 字段类型 | 备注 |
|:---|:---|:---|:---|
<#if method.returns?? && (method.returns?size > 0)>
<#list method.returns as return>
| ${return.name} | ${return.comment!""} | ${return.type!""} | ${return.remark!""} |
| ${return.name} | ${return.comment!""} | ${return.typeAlias!""} | ${return.remark!""} |
</#list>
<#else>
暂无出参
</#if>

#### 方法出参详情
##### 方法出参详情

<#if method.returnDetails?? && (method.returnDetails?size > 0)>
<#list method.returnDetails?keys as detailName>
Expand All @@ -63,7 +63,7 @@ ${method.remark!"暂无方法备注信息"}
</#list>
</#list>
<#else>
暂无入参详情
暂无出参详情
</#if>

</#list>
Expand Down
7 changes: 5 additions & 2 deletions idoc-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@
<artifactId>idoc-core</artifactId>
<version>${project.version}</version>
<configuration>
<generates>
<generate>com.github.houbb.idoc.ftl.api.generator.MarkdownDocGenerator</generate>
</generates>
<generateFilters>
<generateFilter>com.github.houbb.idoc.test.filter.MyGenerateAliasFilter</generateFilter>
<generateFilter>com.github.houbb.idoc.test.filter.MyGenerateFilter</generateFilter>
</generateFilters>
<isAllInOne>true</isAllInOne>
<typeAliases>
<typeAlias>
<key>java.lang.String</key>
<value>String自定义说明</value>
<value>字符串</value>
</typeAlias>
</typeAliases>
</configuration>
Expand Down

0 comments on commit 4306097

Please sign in to comment.