gpt4 book ai didi

asciidoc - 有条件地包含在 asciidoc 中

转载 作者:行者123 更新时间:2023-12-04 13:48:05 24 4
gpt4 key购买 nike

我正在使用 Spring RestDoc 和 AsciiDoc 来描述我的 rest api。 RestDoc 根据是否有描述的请求参数/响应字段等生成不同的文件。我希望有一个模板有条件地包括任何存在的文件。

像这样:

Request:

include::{reqresPath}/http-request.adoc[]

Response:
include::{reqresPath}/http-response.adoc[]

Parameters:
ifeval::[{{reqresPath}/request-parameters.adoc}.exists]
include::{reqresPath}/request-parameters.adoc[]
endif::[]
ifeval::[{{reqresPath}/request-parameters.adoc}.exists]
include::{reqresPath}/request-parameters.adoc[]
endif::[]

或者至少在丢失文件的情况下排除警告。但我不知道如何抑制这些。

最佳答案

截至今天,no operator在哪里?为 ifeval可用,可用于检查文件是否存在。
我要走的路是写一个 extension for Asciidoctor ,这也可以通过使用 Java 来完成。如果您的项目足够大,我建议您采用此解决方案。

关于asciidoc - 有条件地包含在 asciidoc 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41159343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com