Add support for AsciiDoc include directive
What does this MR do?
Adds complete support for AsciiDoc include directive,
include::path/to/file[attributes]. This is a standard AsciiDoc’s feature that allows the author to declaratively insert content into the document from other files (AsciiDoc documents, source files, …). See Asciidoctor’s user manual for more information.
This MR implements Asciidoctor include processor for resolving includes inside a single repository. It’s intentionally limited to allow include only local (i.e. not on external storage) textual (non-binary) files accessible from the same git reference (i.e. cannot include file from another branch or older/newer revision of the file), so it should not cause any problems.
It does not support selecting only portions of the document to include using tags or line ranges, because Asciidoctor implements it in a (poor) way that disallows code reuse and I didn’t want to reimplement it in GitLab (at least for now). [UPDATED: It’s supported now!]
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
AsciiDoc include directive does not work in GitLab, because the Asciidoctor’s built-in implementation resolves file on a file system (and also it’s disallowed by safe_level). Include directive is very useful (I’d even say essential), it allows to reduce unnecessary duplications.
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
- Changelog entry added, if necessary
API support added(N/A)
- Tests added for this feature/bug
- Has been reviewed by UX
Has been reviewed by Frontend(N/A)
- Has been reviewed by Backend
Has been reviewed by Database(N/A)
- Conform by the merge request performance guides
- Conform by the style guides
- Squashed related commits together
What are the relevant issue numbers?