Skip to content

Add basic support for AsciiDoc include directive

What does this MR do?

Adds basic 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).

Are there points in the code the reviewer needs to double check?

No.

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)

Not relevant.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

#18045 (moved)

/cc @mojavelinux

Edited by username-removed-522587

Merge request reports

Loading