Sandwich markup /…/…

Sandwich markup is a shorthand syntax. Use it to say that each line within its range shall be prefixed with the same symbols so that you don’t actually have to add the same symbols to the start of each line yourself. Sandwich markup enables you to comment a hundred lines out at once for example.

How to

Sandwich markup begins with a slash / at the start of a line and requires a second slash in the same line. Let’s call that which is between the two slashes prefix and whatever comes after the second slash delimiter.

The Aneamal Translator automatically adds the prefix to the start of any line between the sandwich’s initial line and a line that contains just the delimiter. The initial line and the delimiter line are automatically removed then.

Note that the prefix itself can not contain a slash /.

Examples

Bulleted list

/<> /BREAD
tomatoes
mayo
salad
cheese
horseradish
BREAD

In this example, the initial line /<> /BREAD says that <> shall be added to the start of every subsequent line until the delimiter line BREAD is reached. It is equivalent to:

<> tomatoes
<> mayo
<> salad
<> cheese
<> horseradish

Comment

This example uses an emoji as delimiter. Emojis are convenient because they are easy to spot when glancing over a text. So,

/%/🙊
Auferstanden aus Ruinen
und der Zukunft zugewandt,
laß uns dir zum Guten dienen,
Deutschland, einig Vaterland.
🙊

is equivalent to

%Auferstanden aus Ruinen
%und der Zukunft zugewandt,
%laß uns dir zum Guten dienen,
%Deutschland, einig Vaterland.

since /%/🙊 tells the Aneamal Translator to start subsequent lines with % until 🙊 is reached.

Options

This example illustrates that sandwich markup does not need to be placed at the start of a whole block. It may occur inside blocks, provided that it is placed on a new line.

Now, your Majesty, what is my name?
/{ } /🦋
Tom
Dick
Rumpelstiltskin
🦋

is equivalent to

Now, your Majesty, what is my name?
{ } Tom
{ } Dick
{ } Rumpelstiltskin

because /{ } /🦋 instructs the Aneamal Translator to prefix each line with { } until the delimiter line 🦋 is found.

Text

Sandwich markup can also prefix lines with simple text. In this case, all the lines within the sandwich markup’s range are initially empty and a simple dot is used as delimiter.

/I will not waste chalk./.




.

That is of course equivalent to:

I will not waste chalk.
I will not waste chalk.
I will not waste chalk.
I will not waste chalk.

Code block

In this example the prefix and delimiter are the same. That’s fine.

/|/|
function strip_slashes (string $str): string
{
	$len = strlen ($str);
	$out = '';
	for ($i = 0; $i < $len; ++$i):
		if ($str[$i] !== '\\' or ++$i !== $len):
			$out .= $str[$i];
		endif;
	endfor;
	return $out;
}
|

is equivalent to

|function strip_slashes (string $str): string
|{
|	$len = strlen ($str);
|	$out = '';
|	for ($i = 0; $i < $len; ++$i):
|		if ($str[$i] !== '\\' or ++$i !== $len):
|			$out .= $str[$i];
|		endif;
|	endfor;
|	return $out;
|}

since /|/| says that | shall be prepended to every line until a line that is just | is reached.

Double-tagged list

The last example uses empty stops again:

/<City>/
<A> Addis Abeba
<B> Berlin
<C> Canberra

/<Country>/
<A> Armenia
<B> Bhutan
<C> Costa Rica

/<River>/
<A> Amazon
<B> Brahmaputra
<C> Colorado

It is equivalent to this double-tagged list:

<City><A> Addis Abeba
<City><B> Berlin
<City><C> Canberra
<Country><A> Armenia
<Country><B> Bhutan
<Country><C> Costa Rica
<River><A> Amazon
<River><B> Brahmaputra
<River><C> Colorado