Parse the contents of an external file

use

The "use" pragma is for declaring variables and defining clone templates in an external BLUEPHRASE file.

Syntax

The syntax for the use pragma consists of:

  • An exclamation point !
  • The keyword use
  • A sourceref containing the name of the external file to use.

The contents of the external file are parsed and placed in memory for use by the BLUEPROCESSOR, but are never emitted to the final document.

!use `target`
use 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).

Examples

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

!blue 2.0
!use `std-stuff.blue
html {
head {
meta *name=description *content='$DESCRIPTION'
meta *name=keywords *content='$KEYWORDS'
meta *name='dcterms.rightsHolder' *content='Copyright © 2019 Read Write Tools'
meta *name='twitter:card' *content='summary_large_image'
meta *name='twitter:site' *content='@ReadWriteTools'
meta *name='twitter:title' *content='$TITLE'
meta *name='twitter:description' *content='$DESCRIPTION'
meta *name='twitter:image' *content='https://bluephrase.com/$IMAGE'
meta *name='twitter:image:alt' *content='$TITLE'
title $TITLE
}
body {
h1 $TITLE
. . .
}
}
Sample use pragma
!blue 2.0
$TITLE="Predicting Weather"
$DESCRIPTION="Weather forecasting is the application of science and technology to predict the state of the atmosphere for a future time and a given location."
$KEYWORDS="weather forecasting, predicting, atmosphere"
$IMAGE= "img/cumulus.jpeg"
std-stuff.blue
0

syntax > pragmas > useParse the contents of an external file

🔗 🔎