Allow snippet section titles to be customized using document attributes

Closes gh-363
This commit is contained in:
Andy Wilkinson
2017-03-08 10:41:54 +00:00
parent 86f6dbab9c
commit a4d2fc39d8
9 changed files with 159 additions and 43 deletions

View File

@@ -45,6 +45,58 @@ operation::index[]
[[working-with-asciidoctor-including-snippets-operation-titles]]
===== Section titles
For each snippet that's including using `operation` a section with a title will be
created. Default titles are provided for the built-in snippets:
|===
| Snippet | Title
| curl-request
| Curl Request
| http-request
| HTTP request
| http-response
| HTTP response
| httpie-request
| HTTPie request
| links
| Links
| request-body
| Request body
| request-fields
| Request fields
| response-body
| Response body
| response-fields
| Response fields
|===
For snippets not listed in the table above, a default title will be generated by replacing
`-` characters with spaces and capitalising the first letter. For example, the title for a
snippet named `custom-snippet` will be "Custom snippet".
The default titles can be customized using document attributes. The name of the attribute
should be `operation-{snippet}-title`. For example, to customize the title of the
`curl-request` snippet to be "Example request", use the following attribute:
[source,indent=0]
----
:operation-curl-request-title: Example request
----
[[working-with-asciidoctor-including-snippets-individual]]
==== Including individual snippets