finish html support

This commit is contained in:
oppofind 2019-09-29 00:40:37 +08:00
parent 6606fec053
commit cba22b4d74
9 changed files with 445 additions and 29 deletions

View File

@ -77,6 +77,12 @@
<artifactId>flexmark-ext-tables</artifactId>
<version>${flexmark.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -1,6 +1,7 @@
package com.power.doc.builder;
import com.power.common.util.CollectionUtil;
import com.power.common.util.DateTimeUtil;
import com.power.common.util.FileUtil;
import com.power.common.util.StringUtil;
import com.power.doc.constants.DocGlobalConstants;
@ -21,7 +22,7 @@ import static com.power.doc.constants.DocGlobalConstants.FILE_SEPARATOR;
*/
public class DocBuilderTemplate {
private static long now = System.currentTimeMillis();
/**
* check condition and init
*
@ -94,11 +95,14 @@ public class DocBuilderTemplate {
*/
public void buildAllInOne(List<ApiDoc> apiDocList, ApiConfig config, String template, String outPutFileName) {
String outPath = config.getOutPath();
String strTime = DateTimeUtil.long2Str(now, DateTimeUtil.DATE_FORMAT_SECOND);
FileUtil.mkdirs(outPath);
Template tpl = BeetlTemplateUtil.getByName(template);
tpl.binding(TemplateVariable.API_DOC_LIST.getVariable(), apiDocList);
tpl.binding(TemplateVariable.ERROR_CODE_LIST.getVariable(), config.getErrorCodes());
tpl.binding(TemplateVariable.VERSION_LIST.getVariable(), config.getRevisionLogs());
tpl.binding(TemplateVariable.VERSION.getVariable(),now);
tpl.binding(TemplateVariable.CREATE_TIME.getVariable(), strTime);
FileUtil.nioWriteFile(tpl.render(), outPath + FILE_SEPARATOR + outPutFileName);
}

View File

@ -3,8 +3,6 @@ package com.power.doc.builder;
import com.power.common.util.CollectionUtil;
import com.power.common.util.DateTimeUtil;
import com.power.common.util.FileUtil;
import com.power.common.util.StringUtil;
import com.power.doc.constants.DocGlobalConstants;
import com.power.doc.constants.DocLanguage;
import com.power.doc.constants.TemplateVariable;
import com.power.doc.model.ApiConfig;
@ -26,30 +24,30 @@ public class HtmlApiDocBuilder {
private static long now = System.currentTimeMillis();
private static String INDEX_HTML = "index.html";
/**
* build controller api
*
* @param config config
*/
public static void builderControllersApi(ApiConfig config) {
if (null == config) {
throw new NullPointerException("ApiConfig can't be null");
}
if (StringUtil.isEmpty(config.getOutPath())) {
throw new RuntimeException("doc output path can't be null or empty");
}
if (null != config.getLanguage()) {
System.setProperty(DocGlobalConstants.DOC_LANGUAGE, config.getLanguage().getCode());
} else {
//default is chinese
System.setProperty(DocGlobalConstants.DOC_LANGUAGE, DocLanguage.CHINESE.getCode());
}
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
builderTemplate.checkAndInit(config);
SourceBuilder sourceBuilder = new SourceBuilder(config);
List<ApiDoc> apiDocList = sourceBuilder.getControllerApiData();
buildIndex(apiDocList, config);
copyCss(config.getOutPath());
buildApiDoc(apiDocList, config.getOutPath());
buildErrorCodeDoc(config.getErrorCodes(), config.getOutPath());
if (config.isAllInOne()) {
Template indexCssTemplate = BeetlTemplateUtil.getByName(ALL_IN_ONE_CSS);
FileUtil.nioWriteFile(indexCssTemplate.render(), config.getOutPath() + FILE_SEPARATOR + ALL_IN_ONE_CSS);
builderTemplate.buildAllInOne(apiDocList, config, ALL_IN_ONE_HTML_TPL, INDEX_HTML);
} else {
buildIndex(apiDocList, config);
copyCss(config.getOutPath());
buildApiDoc(apiDocList, config.getOutPath());
buildErrorCodeDoc(config.getErrorCodes(), config.getOutPath());
}
}
private static void copyCss(String outPath) {
@ -75,17 +73,16 @@ public class HtmlApiDocBuilder {
indexTemplate.binding(TemplateVariable.VERSION.getVariable(), now);
if (null != config.getLanguage()) {
if (DocLanguage.CHINESE.code.equals(config.getLanguage().getCode())) {
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "A. 错误码列表");
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "错误码列表");
} else {
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "A. Error Code List");
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "Error Code List");
}
} else {
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "A. 错误码列表");
indexTemplate.binding(TemplateVariable.ERROR_LIST_TITLE.getVariable(), "错误码列表");
}
FileUtil.nioWriteFile(indexTemplate.render(), config.getOutPath() + FILE_SEPARATOR + "api.html");
}
/**
* build ever controller api
*

View File

@ -23,6 +23,8 @@ public class DocGlobalConstants {
public static final String ALL_IN_ONE_ADOC_TPL = "AllInOne.adoc";
public static final String ALL_IN_ONE_HTML_TPL = "AllInOne.html";
public static final String HTML_API_DOC_TPL = "HtmlApiDoc.btl";
public static final String ERROR_CODE_LIST_MD_TPL = "ErrorCodeList.btl";
@ -39,6 +41,8 @@ public class DocGlobalConstants {
public static final String MARKDOWN_CSS_TPL = "markdown.css";
public static final String ALL_IN_ONE_CSS = "AllInOne.css";
public static final String CONTROLLER_FULLY = "org.springframework.stereotype.Controller";

View File

@ -4,4 +4,4 @@ ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}.exampleblock>.content>:first-child{margin-top:0}.exampleblock>.content>:last-child{margin-bottom:0}.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}.sidebarblock>:first-child{margin-top:0}.sidebarblock>:last-child{margin-bottom:0}.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8}.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em}.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal}@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)}.listingblock pre.highlightjs{padding:0}.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}.listingblock pre.prettyprint{border-width:0}.listingblock>.content{position:relative}.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999}.listingblock:hover code[data-lang]:before{display:block}.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999}.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:0}table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45}table.pyhltable td.code{padding-left:.75em;padding-right:0}pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}pre.pygments .lineno{display:inline-block;margin-right:.25em}table.pyhltable .linenodiv{background:none!important;padding-right:0!important}.quoteblock{margin:0 1em 1.25em 1.5em;display:table}.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em}.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}.quoteblock blockquote{margin:0;padding:0;border:0}.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right}.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)}.quoteblock .quoteblock blockquote{padding:0 0 0 .75em}.quoteblock .quoteblock blockquote:before{display:none}.verseblock{margin:0 1em 1.25em 1em}.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}.verseblock pre strong{font-weight:400}.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}.quoteblock.abstract{margin:0 0 1.25em 0;display:block}.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}table.tableblock{max-width:100%;border-collapse:separate}table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0}table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0}table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0}table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px 0}table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0 0}table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0}table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0}table.frame-all{border-width:1px}table.frame-sides{border-width:0 1px}table.frame-topbot{border-width:1px 0}th.halign-left,td.halign-left{text-align:left}th.halign-right,td.halign-right{text-align:right}th.halign-center,td.halign-center{text-align:center}th.valign-top,td.valign-top{vertical-align:top}th.valign-bottom,td.valign-bottom{vertical-align:bottom}th.valign-middle,td.valign-middle{vertical-align:middle}table thead th,table tfoot th{font-weight:bold}tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}p.tableblock>code:only-child{background:0;padding:0}p.tableblock{font-size:1em}td>div.verse{white-space:pre}ol{margin-left:1.75em}ul li ol{margin-left:1.5em}dl dd{margin-left:1.125em}dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}ul.unstyled,ol.unstyled{margin-left:0}ul.checklist{margin-left:.625em}ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em}ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}ul.inline>li>*{display:block}.unstyled dl dt{font-weight:400;font-style:normal}ol.arabic{list-style-type:decimal}ol.decimal{list-style-type:decimal-leading-zero}ol.loweralpha{list-style-type:lower-alpha}ol.upperalpha{list-style-type:upper-alpha}ol.lowerroman{list-style-type:lower-roman}ol.upperroman{list-style-type:upper-roman}ol.lowergreek{list-style-type:lower-greek}.hdlist>table,.colist>table{border:0;background:0}.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:0}td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}td.hdlist1{font-weight:bold;padding-bottom:1.25em}.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}.colist>table tr>td:first-of-type{padding:.4em .75em 0 .75em;line-height:1;vertical-align:top}.colist>table tr>td:first-of-type img{max-width:initial}.colist>table tr>td:last-of-type{padding:.25em 0}.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em}.imageblock>.title{margin-bottom:0}.imageblock.thumb,.imageblock.th{border-width:6px}.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}.image.left{margin-right:.625em}.image.right{margin-left:.625em}a.image{text-decoration:none;display:inline-block}a.image object{pointer-events:none}sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}sup.footnote a,sup.footnoteref a{text-decoration:none}sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;text-indent:-1.05em;margin-bottom:.2em}#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}#footnotes .footnote:last-of-type{margin-bottom:0}#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}.gist .file-data>table td.line-data{width:99%}div.unbreakable{page-break-inside:avoid}.big{font-size:larger}.small{font-size:smaller}.underline{text-decoration:underline}.overline{text-decoration:overline}.line-through{text-decoration:line-through}.aqua{color:#00bfbf}.aqua-background{background-color:#00fafa}.black{color:#000}.black-background{background-color:#000}.blue{color:#0000bf}.blue-background{background-color:#0000fa}.fuchsia{color:#bf00bf}.fuchsia-background{background-color:#fa00fa}.gray{color:#606060}.gray-background{background-color:#7d7d7d}.green{color:#006000}.green-background{background-color:#007d00}.lime{color:#00bf00}.lime-background{background-color:#00fa00}.maroon{color:#600000}.maroon-background{background-color:#7d0000}.navy{color:#000060}.navy-background{background-color:#00007d}.olive{color:#606000}.olive-background{background-color:#7d7d00}.purple{color:#600060}.purple-background{background-color:#7d007d}.red{color:#bf0000}.red-background{background-color:#fa0000}.silver{color:#909090}.silver-background{background-color:#bcbcbc}.teal{color:#006060}.teal-background{background-color:#007d7d}.white{color:#bfbfbf}.white-background{background-color:#fafafa}.yellow{color:#bfbf00}.yellow-background{background-color:#fafa00}span.icon>.fa{cursor:default}a span.icon>.fa{cursor:inherit}.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}.conum[data-value] *{color:#fff!important}.conum[data-value]+b{display:none}.conum[data-value]:after{content:attr(data-value)}pre .conum[data-value]{position:relative;top:-.125em}b.conum *{color:inherit!important}.conum:not([data-value]):empty{display:none}dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}h1,h2,p,td.content,span.alt{letter-spacing:-.01em}p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}p,blockquote,dt,td.content,span.alt{font-size:1.0625rem}p{margin-bottom:1.25rem}.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}.print-only{display:none!important}@media print{@page{margin:1.25cm .75cm}*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}a{color:inherit!important;text-decoration:underline!important}a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}abbr[title]:after{content:" (" attr(title) ")"}pre,blockquote,tr,img,object,svg{page-break-inside:avoid}thead{display:table-header-group}svg{max-width:100%}p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}#toc,.sidebarblock,.exampleblock>.content{background:none!important}#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important}.sect1{padding-bottom:0!important}.sect1+.sect1{border:0!important}#header>h1:first-child{margin-top:1.25rem}body.book #header{text-align:center}body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0}body.book #header .details{border:0!important;display:block;padding:0!important}body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}body.book #header .details br+span:before{content:none!important}body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}.listingblock code[data-lang]:before{display:block}#footer{background:none!important;padding:0 .9375em}#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}.hide-on-print{display:none!important}.print-only{display:block!important}.hide-for-print{display:none!important}.show-for-print{display:inherit!important}}#content .page-footer{margin-top:50px;height:100px;border-top:1px solid #ccc;overflow:hidden;padding:10px 0;font-size:14px;color:gray}#content .footer-modification{float:right}#content .footer-modification a{text-decoration:none}
body.book #header .details br{display:block}body.book #header .details br+span:before{content:none!important}body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}.listingblock code[data-lang]:before{display:block}#footer{background:none!important;padding:0 .9375em}#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}.hide-on-print{display:none!important}.print-only{display:block!important}.hide-for-print{display:none!important}.show-for-print{display:inherit!important}}#content .page-footer{height:100px;border-top:1px solid #ccc;overflow:hidden;padding:10px 0;font-size:14px;color:gray}#content .footer-modification{float:right}#content .footer-modification a{text-decoration:none}

View File

@ -0,0 +1,271 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="smart-doc">
<title>API Reference</title>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<link rel="stylesheet" href="AllInOne.css?v=${version}"/>
</head>
<body class="book toc2 toc-left">
<div id="header">
<div id="toc" class="toc2">
<div id="toctitle">API Reference</div>
<ul class="sectlevel1">
<%
for(api in apiDocList){
%>
<li><a href="#_${api.desc}">${api.order}. ${api.desc}</a>
<%
for(doc in api.list){
%>
<ul class="sectlevel2">
<li><a href="#_${doc.desc}">${api.order}.${doc.order} ${doc.desc}</a></li>
</ul>
<%}%>
</li>
<%}%>
<%if(isNotEmpty(errorCodeList)){%>
<li><a href="#_error_code_list"> ${apiDocList.~size+1}. Error code list</a></li>
<%}%>
</ul>
</div>
</div>
<div id="content">
<%if(isNotEmpty(revisionLogList)){%>
<div id="preamble">
<div class="sectionbody">
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Version</th>
<th class="tableblock halign-left valign-top">Update Time</th>
<th class="tableblock halign-left valign-top">Status</th>
<th class="tableblock halign-left valign-top">Author</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<%
for(revisionLog in revisionLogList){
%>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">${revisionLog.version}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${revisionLog.revisionTime}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${revisionLog.status}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${revisionLog.author}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${revisionLog.remarks}</p></td>
</tr>
<%}%>
</tbody>
</table>
</div>
</div>
<%}%>
<%
for(api in apiDocList){
%>
<div class="sect1">
<h2 id="_${api.desc}"><a class="anchor" href="#_${api.desc}"></a><a class="link" href="#_${api.desc}">${api.order}. ${api.desc}</a>
</h2>
<div class="sectionbody">
<%
for(doc in api.list){
%>
<div class="sect2">
<h3 id="_${doc.desc}">
<a class="anchor" href="#_${doc.desc}"></a><a class="link" href="#_${doc.desc}">${api.order}.${doc.order} ${doc.desc}</a>
</h3>
<div class="paragraph">
<p><strong>URL:</strong> <a href="${doc.url}" class="bare">${doc.url}</a>
</p>
</div>
<div class="paragraph">
<p><strong>Type:</strong> ${doc.type}</p>
</div>
<div class="paragraph">
<p><strong>Content-Type:</strong> ${doc.contentType}</p>
</div>
<%if(isNotEmpty(doc.requestHeaders)){%>
<div class="paragraph">
<p><strong>Request-headers:</strong></p>
</div>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Header</th>
<th class="tableblock halign-left valign-top">Type</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Since</th>
</tr>
</thead>
<tbody>
<%
for(header in doc.requestHeaders){
%>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">${header.name}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${header.type}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${header.desc}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${header.required}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${header.since}</p></td>
</tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.requestParams)){%>
<div class="paragraph">
<p><strong>Request-parameters:</strong></p>
</div>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Parameter</th>
<th class="tableblock halign-left valign-top">Type</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Since</th>
</tr>
</thead>
<tbody>
<%
for(param in doc.requestParams){
%>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.field}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.type}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.desc}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.required}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.version}</p></td>
</tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
<div class="paragraph">
<p><strong>Request-example:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre>${doc.requestUsage}</pre>
</div>
</div>
<%}%>
<%if(isNotEmpty(doc.responseParams)){%>
<div class="paragraph">
<p><strong>Response-fields:</strong></p>
</div>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Field</th>
<th class="tableblock halign-left valign-top">Type</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Since</th>
</tr>
</thead>
<tbody>
<%
for(param in doc.responseParams){
%>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.field}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.type}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.desc}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${param.version}</p></td>
</tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
<div class="paragraph">
<p><strong>Response-example:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre>${doc.responseUsage}</pre>
</div>
</div>
<%}%>
</div>
<%}%>
</div>
</div>
<%}%>
<%if(isNotEmpty(errorCodeList)){%>
<div class="sect1">
<h2 id="_error_code_list"><a class="anchor" href="#_error_code_list"></a><a class="link" href="#_error_code_list">${apiDocList.~size+1}. Error code list</a></h2>
<div class="sectionbody">
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Error code</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<%
for(error in errorCodeList){
%>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">${error.value}</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${error.desc}</p></td>
</tr>
<%}%>
</tbody>
</table>
</div>
</div>
<%}%>
<footer class="page-footer">
<span class="copyright">Generated by smart-doc at ${createTime}</span>
<span class="footer-modification">Suggestions, contact, support and error reporting on
<a href="https://gitee.com/sunyurepository/smart-doc" target="_blank">Gitee</a> or
<a href="https://github.com/shalousun/smart-doc" target="_blank">Github</a>
</span>
</footer>
</div>
</body>
</html>

View File

@ -32,7 +32,7 @@
</li>
<%}%>
<li class="chapter " data-level="error_code" data-path="error_code.html">
<a href="error_code.html?v=${version}" target="book_iframe">${errorListTitle}</a>
<a href="error_code.html?v=${version}" target="book_iframe">${apiDocList.~size+1}. ${errorListTitle}</a>
</li>
<li class="divider"></li>
<li class="footer_link"><a href="https://github.com/shalousun/smart-doc" target="_blank" class="gitbook-link">Created by smart-doc</a>

View File

@ -0,0 +1,134 @@
<!doctype html>
<html>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width initial-scale=1'>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link rel="stylesheet" href="index.css?v=${version}"/>
<link rel="stylesheet" href="markdown.css?v=${version}"/>
<title>api doc</title>
</head>
<div class="book without-animation with-summary font-size-2 font-family-1">
<div class="book-summary">
<div id="book-search-input"><input type="text" placeholder="Type to search"></div>
<nav role="navigation">
<ul class="summary">
<li><ul id="reference">API Reference</ul></li>
<li class="divider"></li>
<%
for(api in apiDocList){
%>
<li class="chapter " data-level="${api.alias}" data-path="${api.alias}.html">
<a href="#_${api.desc}">${api.order}. ${api.desc}</a>
<ul class="articles">
<%
for(doc in api.list){
%>
<li class="chapter " data-level="${api.alias}" data-path="${api.alias}.html">
<a href="#_${doc.desc}">${api.order}.${doc.order} ${doc.desc}</a></li>
<%}%>
</ul>
</li>
<%}%>
<li class="chapter " data-level="error_code" data-path="error_code.html">
<a href="error_code.html?v=${version}" target="book_iframe">${errorListTitle}</a>
</li>
<li class="divider"></li>
<li class="footer_link"><a href="https://github.com/shalousun/smart-doc" target="_blank" class="gitbook-link">Created by smart-doc</a>
</li>
</ul>
</nav>
</div>
<div id="book-body" class="book-body" height="100%">
<div class="markdown-body">
<%
for(api in apiDocList){
%>
<h1 id="_${api.desc}">
<a class="anchor" href="#_${api.desc}"></a><a class="link" href="#_${api.desc}">${api.order}. ${api.desc}</a>
</h1>
<%
for(doc in api.list){
%>
<h2 id="_${doc.desc}">
<a class="anchor" href="#_${doc.desc}"></a><a class="link" href="#_${doc.desc}">${api.order}.${doc.order} ${doc.desc}</a>
</h2>
<p><strong>URL:</strong>${doc.url}</p>
<p><strong>Type:</strong>${doc.type}</p>
<p><strong>Content-Type:</strong> ${doc.contentType}</p>
<%if(isNotEmpty(doc.requestHeaders)){%>
<p><strong>Request-headers:</strong></p>
<table>
<thead>
<tr><th>Header</th><th>Type</th><th>Description</th><th>Required</th><th>Since</th></tr>
</thead>
<tbody>
<%
for(header in doc.requestHeaders){
%>
<tr><td>${header.name}</td><td>${header.type}</td><td>${header.desc}</td><td>${header.required}</td><td>${header.since}</td></tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.requestParams)){%>
<p><strong>Request-parameters:</strong></p>
<table>
<thead>
<tr><th>Parameter</th><th>Type</th><th>Description</th><th>Required</th><th>Since</th></tr>
</thead>
<tbody>
<%
for(param in doc.requestParams){
%>
<tr><td>${param.field}</td><td>${param.type}</td><td>${param.desc}</td><td>${param.required}</td><td>${param.version}</td></tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
<p><strong>Request-example:</strong></p>
<pre><code>${doc.requestUsage}
</code></pre>
<%}%>
<%if(isNotEmpty(doc.responseParams)){%>
<p><strong>Response-fields:</strong></p>
<table>
<thead>
<tr><th>Field</th><th>Type</th><th>Description</th><th>Since</th></tr>
</thead>
<tbody>
<%
for(param in doc.responseParams){
%>
<tr><td> ${param.field}</td><td>${param.type}</td><td>${param.desc}</td><td>${param.version}</td></tr>
<%}%>
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
<p><strong>Response-example:</strong></p>
<pre><code>${doc.responseUsage}
</code></pre>
<%}%>
<%}%>
<%}%>
<footer class="page-footer">
<span class="copyright">Generated by smart-doc at ${createTime}</span>
<span class="footer-modification">Suggestions, contact, support and error reporting on
<a href="https://gitee.com/sunyurepository/smart-doc" target="_blank">Gitee</a> or
<a href="https://github.com/shalousun/smart-doc" target="_blank">Github</a>
</span>
</footer>
</div>
</div>
</div>
</body>
</html>

View File

@ -14,9 +14,9 @@ public class MarkDownUtilTest {
@Test
public void testToHtml() {
System.out.println(Md5Crypt.md5Crypt("XssController".getBytes()));
// String file = FileUtil.getFileContent("D:\\md\\XssControllerApi.md");
// String html = MarkDownUtil.toHtml(file);
// System.out.println(html);
String file = FileUtil.getFileContent("D:\\md\\AllInOne-V201909272232.md");
String html = MarkDownUtil.toHtml(file);
System.out.println(html);
}
}