Commit Graph

8 Commits

Author SHA1 Message Date
Alexander Schwartz
2cf5919632 Provide context when logging warnings in operation macro
See gh-699
2020-11-13 14:50:29 +00:00
Andy Wilkinson
ed5921fe83 Ensure that UTF-8 is used to read and write snippets in operation macro
Fixes gh-696
2020-09-14 14:40:56 +01:00
Andy Wilkinson
bb7aecbfe5 Fix problem with operation block macro when using leveloffset
Previously, when a document had a leveloffset attribute this was
included in the attributes used when loading a snippet in the
operation block macro. This could lead to warnings about section
titles being out of sequence as the level used for the title did not
take the leveloffset into consideration.

This commit clones the documents attributes and removes any
leveloffset attribute before loading a snippet. This removes the
need for the leveloffset to be considered when loading a snippet
fragment. As before, the level of each block in the fragment loaded
from snippet is then set prior to adding the block to the main
document. This takes the leveloffset into consideration.

Closes gh-649
2019-10-17 15:40:52 +01:00
Alexander Schwartz
1d911367d6 Prevent unwanted incrementing of section number in operation macro
See gh-638
2019-09-19 10:45:43 +01:00
Alexander Schwartz
b66c8b4594 Avoid warnings when parsing AsciiDoc sub-content in Asciidoctor.load
Renderings with standard section depth first to avoid warnings that
document starts with level 3 headings. Adjust block level when
adding the content to the parent.

See gh-628
2019-08-30 12:30:36 +01:00
Andy Wilkinson
cc22dbfe26 Merge branch '1.2.x' 2019-08-30 11:20:34 +01:00
Andy Wilkinson
619847582a Reuse document's attributes when loading snippet content
Previously, when adding blocks for the snippets' content, the
operation macro would call Asciidoctor to load the content with
attributes that only included the projectdir. This resulted in a
failure in environments that did not set the projectdir and instead
relied on another attribute, such as gradle-projectdir as used by
the latest versions of the Asciidoctor Gradle plugin.

This commit updates the macro to reuse all of the main document's
attributes when loading the snippets' content, thereby ensuring that
any attributes available in the main document are also available
during snipppet processing.

Closes gh-624
2019-06-20 10:35:33 +01:00
Andy Wilkinson
ff18f8034d Add AsciidoctorJ 1.6 and 2.0 compatibility
AsciidoctorJ 1.6 is not backwards compatible with AsciidoctorJ 1.5
and AsciidoctorJ 2.0 is not backwards compatible with AsciidoctorJ 1.6
or 1.5. The backwards incompatibilities are such that they cannot be
worked around using reflection so code needs to be compiled against
each of the three versions. To this end, this commit splits
spring-restdocs-asciidoctor into several separate modules:

1. spring-restdocs-asciidoctor-support
2. spring-restdocs-asciidoctor-1.5
3. spring-restdocs-asciidoctor-1.6
4. spring-restdocs-asciidoctor-2.0

spring-restdocs-asciidoctor-support contains support code that is not
tied to a specific version of AsciidoctorJ and can be used with
1.5, 1.6 and 2.0. The other three modules contain code that is
specific to a particular version of AsciidoctorJ. Each
version-specific module uses class names that are unique across all
three modules and is written in such a way that they will back off
when used in an environment with a different version of AsciidoctorJ.
The existing spring-restdocs-asciidoctor module has been modified to
merge the version specific jars and the support jar together into a
single jar that supports AsciidoctorJ 1.5, 1.6, and 2.0.

The above-described changes should allow users to depend upon
spring-restdocs-asciidoctor as before and to now be able to use
AsciidoctorJ 1.5, 1.6, or 2.0.

Closes gh-581
2019-06-18 12:28:36 +01:00