2017-04-06 09:15:22 +00:00
caption: insertbefore
created: 20170406090122441
2022-02-24 11:08:06 +00:00
modified: 20220223004441865
2017-04-06 09:15:22 +00:00
op-input: a [[selection of titles|Title Selection]]
op-output: the input tiddler list with the new entry inserted
2022-02-24 11:08:06 +00:00
op-parameter: <<.from-version "5.2.2">> the <<.op insertbefore>> operator accepts 1 or 2 parameters, see below for details
2017-04-06 09:15:22 +00:00
op-purpose: insert an item <<.place T>> into a list immediately before an item <<.place B>>
2022-02-24 11:08:06 +00:00
op-suffix: (optional) the name of a variable containing the title of the tiddler before which this one should be inserted
2017-04-06 09:15:22 +00:00
tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]]
title: insertbefore Operator
type: text/vnd.tiddlywiki
2022-02-24 11:08:06 +00:00
<<.from-version "5.2.2">>
The <<.op insertbefore>> operator requires at least one parameter which specifies the title to insert into the input list. A second parameter can be used to specify the title before which the new title should be inserted.
```
insertbefore:<before-title-variable>[<title>],[<before-title>]
```
* ''title'' : a title <<.place T>> to insert in the input list.
* ''before-title'' : (optional). Insert <<.place T>> before this title <<.place B>> in the input list.
* ''before-title-variable'' : (optional). The name of a variable specifying <<.place B>> instead of the `before-title` parameter.
2017-04-06 09:15:22 +00:00
If the item <<.place B>> isn't present in the input list then the new item is inserted at the end of the list.
2022-02-24 11:08:06 +00:00
<<.tip "Either [[parameter|Filter Parameter]] can be a string, a text reference or a variable">>
<<.tip "If <<.place B>> is specified as both a suffix and a parameter, the parameter takes precedence">>
<<.operator-examples "insertbefore">>