asciidoctor-foodogsquared-e.../lib/asciidoctor/git-blob-include-processor
Gabriel Arazas a95b09a81f
Remove preprocessor extension for git blob include processor
It's pretty useless for outside of the custom setup I've had.
2023-11-01 17:30:56 +08:00
..
extension.rb Remove preprocessor extension for git blob include processor 2023-11-01 17:30:56 +08:00
README.adoc Remove preprocessor extension for git blob include processor 2023-11-01 17:30:56 +08:00

Table of Contents

An include processor that includes content from the current Git repo. The use case for this is specifically for creating dedicated branches for certain content.

Synopsis

link:git:$REVSPEC[role=include]

Where $REVSPEC is a revision as specified in gitrevisions.7. Take note this include processor only accepts a blob objects content to be extracted. This is meant to be used with other attributes. See Attributes for more details.

If the resulting operation ends in an error (i.e., non-existing revision, file, something went wrong), it should log a warning and transclude an error.

Attributes

  • gitrepo is the path to the Git repo. By default, it is the base directory of the document.

  • path is the filepath to be retrieved from the revision. When used with diff, it changes into a semicolon-delimited (;) list of files to make diffs with multiple files.

  • context-lines is the number of surrounding lines for the diff. This is only effective if diff option is given.

  • other is the other commit to be compared with. This is only effective if diff option is given.

  • lines get the specified lines from the path. It uses the same parser as the line specifier from highlighting select lines so the syntax is the same.

Theres also a couple of options for this component. You can give the following options through opts attribute (i.e., opts="diff,reverse").

  • diff will show the difference in diff format.

  • reverse reverses the sides to be compared.

Example usage

  • include::git:HEAD[path=shell.nix] should transclude the current iteration of shell.nix.

  • include::git:v1.0.0[opts="diff", path=Gemfile] should include a diff of the Gemfile from content/posts/sample branch (assuming that Gemfile has changed).

  • include::git:non-existing-rev[opts="diff"] should result in a warning with the non-existing revision.

  • include::git:{doccontentref}[path=README, lines=2..5] should transclude the README file from lines 2-5.