8. Including external text (include)

8.1. Purpose

Provide a way to include files and parts of files as escaped text. This is very useful for code listings since you can keep a single copy of the code file and have any changes synchronized in the document.

An entire file can be included or a range can be specified. You can mark the range in several file types within the comments for that language.

Tip: this document itself makes heavily use of include for all examples.

8.2. Elements

tag
attributes
include
href - name of the local file
range - optional range as demarcated in the file.

The range is specified as and derived from file extension

Java (.java) and C++ (.cpp): //{rangeId . . //}rangeId XML: see example

8.3. Example

8.3.1. Construct

552: <listing> 553: <include href="authoring-text.xml" range="show.text.include" /> 554: </listing> 555:

8.3.2. Result

551: <!--{text.include --> 552: <listing> 553: <include href="authoring-text.xml" range="show.text.include" /> 554: </listing> 555: 556: <!--}text.include -->