Include the contents of an external manuscript

include

The "include" pragma is used to insert the contents of an external BLUEPHRASE file into the manuscript.

Syntax

The syntax for the include pragma consists of:

  • An exclamation point !
  • The keyword include
  • A sourceref containing the name of the external manuscript to include.
!include `target` *type=mime-type *tag=semantax
include pragma syntax

The target may be an absolute path specifying the target from the file system's root, or a relative path, specifying the target using dot notation (.\filename.blue) or dot-dot notation (..\other-dir\filename.blue).

The *type attribute is the MIME-type of the file being included. It is optional. It determines how the included file is parsed and encoded. The possible values are:

MIME-type Interpreter
application/blue Parse as BLUEPHRASE and include using the parent document's vocabulary
application/html+blue Parse as BLUEPHRASE and include as escaped HTML
application/svg+blue Parse as BLUEPHRASE and include as SVG
application/mathml+blue Parse as BLUEPHRASE and include as MathML
application/xml+blue Parse as BLUEPHRASE and include as XML
text/plain Parse as plain text and include as plain text
text/css Parse as plain text and include as CSS
text/javascript Parse as plain text and include as JavaScript
text/markup Parse as plain text and include as unescaped XML/HTML

If the *type attribute is not specified, the filename extension is used to determine how to parse and encode the file.

Filename extension Interpreter
blue Parse as BLUEPHRASE and include using the parent document's vocabulary
html+blue Parse as BLUEPHRASE and include as escaped HTML
svg+blue Parse as BLUEPHRASE and include as SVG
mathml+blue Parse as BLUEPHRASE and include as MathML
xml+blue Parse as BLUEPHRASE and include as XML
txt Parse as plain text and include as plain text
text Parse as plain text and include as plain text
css Parse as plain text and include as CSS
js Parse as plain text and include as JavaScript
html Parse as plain text and include as unescaped HTML
xml Parse as plain text and include as unescaped XML
svg Parse as plain text and include as unescaped SVG
mathml Parse as plain text and include as unescaped MathML

The *tag attribute is used to specify a wrapper for the included contents. It is optional. When omitted, no wrapper will be added. Typically this attribute is used to wrap a CSS file in a <style> tag or to wrap a JavaScript file in a <script> tag.

Examples

Here is what an include pragma looks like within the body of a manuscript.

!blue 2.0            
html {
head {
meta *charset=UTF-8
meta *name=viewport *content='width=device-width, initial-scale=1'
link `/css/std-styles.css` *rel=stylesheet *type=text/css
title Predicting Weather
}
body {
!include `header.blue`
h1 Predicting Weather
p Surface temperature differences in turn cause pressure
differences. Higher altitudes are cooler than lower altitudes,
as most atmospheric heating is due to contact with the Earth's
surface while radiative losses to space are mostly constant.
p Weather forecasting is the application of science and
technology to predict the state of the atmosphere for a
future time and a given location. The Earth's weather system
is a chaotic system; as a result, small changes to one part
of the system can grow to have large effects on the system as
a whole.
p Human attempts to control the weather have occurred throughout
history, and there is evidence that human activities such as
agriculture and industry have modified weather patterns.
!include `footer.blue`
}
script `/js/std-script.js`
}
Sample include pragma
0

syntax > pragmas > includeInclude the contents of an external manuscript

🔗 🔎