File inclusions
If you’re authoring a user manual, a long article, or a book, writing everything inside a single
document.glyph
file may not be optimal. For this reason, Glyph provides an include
macro that can be used to include
the contents of any file within the text/
directory:
include[general/introduction.textile]
The macro call above loads the contents of the introduction.textile
file, within the
text/general
directory.
When including a text file, an input filter macro is applied to its contents by default, based on the file extension used:
You can override this behavior by setting the filters.by_file_extensions
configuration setting to
false
. If no extension is specified, .glyph
is assumed.
Remarks
Snippets
While including the context of an entire file is definitely a useful feature for content reuse, sometimes it can be an overkill. What if, for example, you just want to reuse a short procedure or even a sentence or a single word? In this case, you may want to consider using a snippet instead.
Snippets can be defined using the snippet:
macro (aliased by
&:
) and called by using the snippet
macro (aliased by
&
). Consider the following simple example:
You can use &[markups]
anywhere in your document instead of having to type "Textile or Markdown"
every time. Additionally, later on you can change the value of the markups
to change it everywhere else
in the document.