Reputation: 1442
I'm generating asciidoc snippets using spring rest docs.
I can include the generated snippets in my doc page. However, I want to define the structure of each secion once in a seperate adoc file, and have a single line for each of those in my index file.
Currently my index.adoc file looks like this:
= My Http Api Docs
= GET /units/:id
== Path Parameters
include::{snippets}/units/get/path-parameters.adoc[]
== Response Fields
include::{snippets}/units/get/response-fields.adoc[]
I want it to be like this instead
index.adoc
= My Http Api Docs
usemytemplates::mytemplate.adoc[method='get', url='units', desc='/units/:id']
mytemplate.adoc
= {method} {desc}
== Path Parameters
include::{snippets}/{url}/{method}/path-parameters.adoc[]
== Response Fields
include::{snippets}/{url}/{method}/response-fields.adoc[]
Anyone know how something like this can be done?
Upvotes: 7
Views: 3164
Reputation: 1442
I was able to solve this by using the substitution syntax before each include statement.
My index.adoc file looks like this and it works:
:method: get
:url: units
:desc: /utils/:id
include::mytemplate.adoc[]
:method: get
:url: members
:desc: /members/:id
include::mytemplate.adoc[]
Upvotes: 11