forked from loafle/openapi-generator-original
Minor improvement to asciidoc doc generator (#3889)
* minor improvement to asciidoc geneator * remove empty line
This commit is contained in:
parent
8055231400
commit
e0b56502a3
0
bin/asciidoc-documentation-petstore.sh
Normal file → Executable file
0
bin/asciidoc-documentation-petstore.sh
Normal file → Executable file
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
@ -21,7 +37,7 @@ import io.swagger.v3.oas.models.OpenAPI;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* basic asciidoc markup generator.
|
* basic asciidoc markup generator.
|
||||||
*
|
*
|
||||||
* @see <a href="https://asciidoctor.org">asciidoctor</a>
|
* @see <a href="https://asciidoctor.org">asciidoctor</a>
|
||||||
*/
|
*/
|
||||||
public class AsciidocDocumentationCodegen extends DefaultCodegen implements CodegenConfig {
|
public class AsciidocDocumentationCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@ -34,7 +50,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
/**
|
/**
|
||||||
* Lambda emitting an asciidoc "include::filename.adoc[]" if file is found in
|
* Lambda emitting an asciidoc "include::filename.adoc[]" if file is found in
|
||||||
* path. Use:
|
* path. Use:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {{#includemarkup}}{{name}}/description.adoc{{/includemarkup}}
|
* {{#includemarkup}}{{name}}/description.adoc{{/includemarkup}}
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -75,7 +91,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lambda emitting an asciidoc "http link" if file is found in path. Use:
|
* Lambda emitting an asciidoc "http link" if file is found in path. Use:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {{#snippetLink}}markup until koma, /{{name}}.json{{/snippetLink}}
|
* {{#snippetLink}}markup until koma, /{{name}}.json{{/snippetLink}}
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -136,7 +152,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
/**
|
/**
|
||||||
* extracted filter value should be relative to be of use as link or include
|
* extracted filter value should be relative to be of use as link or include
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
* @param name filename to sanitize
|
* @param name filename to sanitize
|
||||||
* @return trimmed and striped path part or empty string.
|
* @return trimmed and striped path part or empty string.
|
||||||
*/
|
*/
|
||||||
@ -184,10 +200,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
cliOptions.add(new CliOption(SNIPPET_DIR,
|
cliOptions.add(new CliOption(SNIPPET_DIR,
|
||||||
"path with includable markup snippets (e.g. test output generated by restdoc, default: .")
|
"path with includable markup snippets (e.g. test output generated by restdoc, default: .")
|
||||||
.defaultValue("."));
|
.defaultValue("."));
|
||||||
cliOptions.add(new CliOption(SPEC_DIR,
|
cliOptions.add(new CliOption(SPEC_DIR,
|
||||||
"path with includable markup spec files (e.g. handwritten additional docs, default: .")
|
"path with includable markup spec files (e.g. handwritten additional docs, default: .")
|
||||||
.defaultValue(".."));
|
.defaultValue(".."));
|
||||||
|
|
||||||
additionalProperties.put("appName", "OpenAPI Sample description");
|
additionalProperties.put("appName", "OpenAPI Sample description");
|
||||||
additionalProperties.put("appDescription", "A sample OpenAPI documentation");
|
additionalProperties.put("appDescription", "A sample OpenAPI documentation");
|
||||||
@ -227,7 +243,6 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
LOGGER.warn("base part for include markup lambda not found: " + specDir + " as "
|
LOGGER.warn("base part for include markup lambda not found: " + specDir + " as "
|
||||||
+ Paths.get(specDir).toAbsolutePath());
|
+ Paths.get(specDir).toAbsolutePath());
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
this.includeSpecMarkupLambda = new IncludeMarkupLambda(specDir);
|
this.includeSpecMarkupLambda = new IncludeMarkupLambda(specDir);
|
||||||
additionalProperties.put("specinclude", this.includeSpecMarkupLambda);
|
additionalProperties.put("specinclude", this.includeSpecMarkupLambda);
|
||||||
@ -237,7 +252,6 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
LOGGER.warn("base part for include markup lambda not found: " + snippetDir + " as "
|
LOGGER.warn("base part for include markup lambda not found: " + snippetDir + " as "
|
||||||
+ Paths.get(snippetDir).toAbsolutePath());
|
+ Paths.get(snippetDir).toAbsolutePath());
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
this.includeSnippetMarkupLambda = new IncludeMarkupLambda(snippetDir);
|
this.includeSnippetMarkupLambda = new IncludeMarkupLambda(snippetDir);
|
||||||
additionalProperties.put("snippetinclude", this.includeSnippetMarkupLambda);
|
additionalProperties.put("snippetinclude", this.includeSnippetMarkupLambda);
|
||||||
@ -249,10 +263,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
@Override
|
@Override
|
||||||
public void processOpenAPI(OpenAPI openAPI) {
|
public void processOpenAPI(OpenAPI openAPI) {
|
||||||
if (this.includeSpecMarkupLambda != null) {
|
if (this.includeSpecMarkupLambda != null) {
|
||||||
LOGGER.info("specs: " + ": " + this.includeSpecMarkupLambda.resetCounter());
|
LOGGER.debug("specs: " + ": " + this.includeSpecMarkupLambda.resetCounter());
|
||||||
}
|
}
|
||||||
if (this.includeSnippetMarkupLambda != null) {
|
if (this.includeSnippetMarkupLambda != null) {
|
||||||
LOGGER.info("snippets: " + ": " + this.includeSnippetMarkupLambda.resetCounter());
|
LOGGER.debug("snippets: " + ": " + this.includeSnippetMarkupLambda.resetCounter());
|
||||||
}
|
}
|
||||||
super.processOpenAPI(openAPI);
|
super.processOpenAPI(openAPI);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
unset
|
4.1.3-SNAPSHOT
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user