Integrating plain-text files [t]

Plain-text files are the most simple human readable computer files. They are just letters, punctuation and other characters without any formating besides line breaks and no metadata. A plain-text file is like a roll of paper which you wrote on with a classical mechanical typewriter. Plain text can be embedded in Aneamal files or integrated from a linked file.

You can also integrate more complex text formats into an Aneamal file as if they were plain text. This is useful to demonstrate the basic structure of a complex text format, for example if you want to reveal the anatomy of an HTML file to your readers.

How to

Start a block with the [t] file token to integrate a plain-text file in an Aneamal document. Plain-text files can be linked as in the examples below or directly embedded. See integrating files for more information.

A linked plain-text file must be UTF-8 encoded. ASCII is fine, too, since any ASCII encoded file is automatically valid UTF-8 as well due to the backwards compatibility of the latter, newer encoding.

Examples

The first example integrates a linked plain-text file assignment.txt:

[t]->/stuff/assignment.txt
You are given the number 1.

Create new numbers from those that you've already got by the following two methods. First method: check whether one less than your number divided by three results in an odd integer. If it does, accept the result as a new number. Second method: multiply your number by two.

Do all positive integers get created this way eventually?

The second example integrates another linked plain-text file, collatz-graph.txt. This file contains Unicode box drawing characters to compose a graph which is related to the mathematical task from the previous example:

[t]->/stuff/collatz-graph.txt
┌───────────┐
└─ 1        │
   └─ 2     │
      └─ 4  │
         ├──┘
         └─ 8
            └─ 16
               ├─ 5
               │  └─ 10
               │     ├─ 3
               │     │  └─ 6
               │     │     └─ 12
               │     │        └─ 24
               │     │           └─ …
               │     └─ 20
               │        └─ 40
               │           ├─ 13
               │           │  └─ 26
               │           │     └─ …
               │           └─ 80
               │              └─ 160
               │                 └─ …
               └─ 32
                  └─ 64
                     ├─ 21
                     │  └─ 42
                     │     └─ 84
                     │        └─ 168
                     │           └─ …
                     └─ 128
                        └─ 256
                           ├─ 85
                           │  └─ 170
                           │     └─ …
                           └─ 512
                              └─ 1024
                                 └─ …

Mind that a graph made of plain text such as the one above may not be intelligible to visually impaired users that rely on a screenreader. This is also something to be aware of when integrating ASCII art as plain text.

For developers

When Aneamal is turned into a webpage, integrated plain text is wrapped in an HTML pre element with a class _plain. The first example is translated to:

<pre class='_plain'>You are given the number 1.

Create new numbers from those that you&#039;ve already got by the following two methods. First method: check whether one less than your number divided by three results in an odd integer. If it does, accept the result as a new number. Second method: multiply your number by two.

Do all positive integers get created this way eventually?</pre>

In an HTML pre element, browsers normally only wrap text onto the next line where the text includes actual line break characters. Lines of text that are too long to fit into the browser window continue in the writing direction anyway, expanding the whole webpage horizontally, and a scrollbar is added to the browser window so that readers can scroll to the parts that would otherwise be out of sight.

You can change the default behaviour with CSS. The following stylesheet makes lines wrap automatically when the horizontally available space runs out. It is applied in the first example:

._plain {
	white-space: pre-wrap;
}

Automatically wrapping text is not always desirable, however. For instance, the graph in the second example would be severely broken on small screens by such behavior. So the following CSS code forbids to wrap lines automatically there. It also causes the HTML pre element itself to get a horizontal scrollbar in case of a lack of available space so that it does not push the whole webpage beyond the width of the browser window.

._plain {
	overflow: auto hidden;
	white-space: pre;
}