🍄Rejected FeaturesTransclusion Syntax 2

Note: this syntax will not be implemented after all. See ../new syntax 2

This is the new syntax for transclusion that is planned to be implemented in release/1.2. It is a breaking change.

Transclusion lines start with a reverse-rocket symbol (<=) followed by any amount of spaces (possibly zero). The text on the line before a line break or a pipe character (|) is called target. If there is a pipe, the text after it is called selector. If there is no pipe, the selector is empty. Both target and selector are stripped of left-side and right-side whitespace before further processing.

<= target hypha
<= target hypha | selector

Target rules

If the target is empty, the transclusion is considered invalid. A text like below is returned:

No transclusion target specified.

For the time being, a special case for targets with a colon (:) in them:

This transclusion is using the old syntax. Please update it to the new one. A link to documentation

The target is a hypha's name. If such hypha does not exist, this is returned:

Cannot transclude hypha abc because it does not exist.

Now, the hypha should be loaded and lexed.

Selector rules

If the selector is empty, we think of it as of selector start..end and try again.

If there is no .. in the selector, we find a block in the target hypha with an id equal selector or, if there is no such id, a block with an id starting with selector. If there is none, we consider the selector to be empty and process it as one.

If there is a .. in selector, there are two bounds: left and right. Both bounds are ids with the same aforementioned logic.

Special bounds:

  • attachment: hypha's attachment.

  • start: hypha's text's first block.

  • description: hypha's text's first paragraph.

  • end: hypha's last block.

If the left bound is empty, it is set to start. If the right bound is empty, it is set to end.


And then we transclude.