README.adoc in asciidoctor-reducer-1.0.0.alpha.2 vs README.adoc in asciidoctor-reducer-1.0.0.alpha.3
- old
+ new
@@ -1,8 +1,8 @@
= {project-name}
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
-v1.0.0.alpha.2, 2022-01-27
+v1.0.0.alpha.3, 2022-02-02
:idprefix:
:idseparator: -
ifndef::env-github[:icons: font]
ifdef::env-github[]
:caution-caption: :fire:
@@ -78,20 +78,20 @@
To use the command, pass the AsciiDoc file as the sole argument:
$ asciidoctor-reducer input.adoc
By default, the command will output the reduced AsciiDoc document to the terminal (via stdout).
-To write the output to a file, specify an output file using the `-o` option.
+To write the output to a file, specify an output file using the `-o` option:
$ asciidoctor-reducer -o output.adoc input.adoc
The command can also read the input document from stdin instead of a file.
To use the command in this way, pass `-` as the first argument:
$ cat input.adoc | asciidoctor-reducer -
-To write the output to a file, also specify the `-o` option:
+To write the output to a file instead of stdout, also specify an output file using the `-o` option:
$ cat input.adoc | asciidoctor-reducer -o output.adoc -
Note that top-level include files in the input AsciiDoc document are resolved relative to current working directory.
@@ -134,9 +134,17 @@
It does so by working from the end of the stack and inserting the lines into the parent until the stack has been flattened.
As it goes, it also removes lines that have been excluded by the preprocessor conditionals as well as the directive lines themselves (unless the option to preserve conditionals has been specified).
Finally, it loads the document again and returns it.
The reduced source is available on the reconstructed document (via `Document#source` or `Document#source_lines`).
+
+=== Impact on Extensions
+
+If the sourcemap is enabled, and the reducer finds lines to replace or filter, the reducer will load the document again using `Asciidoctor.load`.
+This step is necessary to synchronize the sourcemap with the reduced source.
+This call will cause extensions that run during the load phase to be invoked again.
+An extension can check for this secondary load by checking for the `:reduced` option in the `Document#options` hash.
+If this option is set (the value of which will be `true`), then Asciidoctor is loading the reduced document.
== Development
Follow the instructions below to learn how to help develop the project or test-drive the development version.