Include Inline

Posted by ErichSteinboeck on 21 Mar 2009 11:57, last edited by James Kanjo on 09 May 2010 05:50

Tags: include inline

rating: +9+x

As implemented, the [[include]] tag allows to include a block of text as separate lines or paragraphs, but does not allow to include text “inline,” i. e. within a single line.

There have been quite some discussions if and how such an “inline include” could be done. Here is a workaround how to do it.

Step by Step

Step 1

Create your included page with

  1. a leading comment ([!----]) and
  2. a trailing backslash (\)

e. g.

[!----]included //inline// and **may** contain formatting\

Step 2

Create your include statement with

  1. a trailing backslash (\) added to the text that goes before the inline include, and
  2. a leading comment ([!----]) before the text that goes after the inline include

e. g.

Text can be \
[[include inc]]
[!----] tags as you like

Examples

What you type … What you get …

Text can be \
[[include inc]]
[!----] tags as you like

Text can be included inline and may contain formatting tags as you like

How it Works

As an [[include]] introduces two consecutive line breaks both before and after the include, a way to remove those two line breaks is:

  1. remove the first line break by appending a trailing backslash (“\”) to the line preceding the two line breaks, and
  2. remove the second line break by prepending a leading Wikidot comment ([!----]) to the line following the two line breaks (similar to how a trailing “\” removes the following line break, a leading comment will remove the previous line break).

Backlinks

Author

ErichSteinboeckErichSteinboeck. Please visit his/her userPage.


Related articles

Comments

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.