Code Type:
Code Scope of Action:
Code First Added:
Code Altered:
^indent( [data][, N] )^
Exports the data as a string, repeated once for each ancestor of the currently exported note (i.e. the equivalent of $OutlineDepth-1 times), or N times if the latter is specified.
^indent^
Exports a tab character for each ancestor of the currently exported note except root level, i.e. a tab is the default indent if no data parameter is supplied.
data. The number of times data or a tab is emitted is ($OutlineDepth-1); for aliases this is the alias' value and not that of the original.
By original intent, this code applied to the (HTML) source of the exported note, but depending on string used for data, this might affect the visual render. Whereas the default \t
only affects the HTML, a data value of
would insert two non-breaking spaced per tab that would render in the output.
N. The default can be superseded by supplying an optional second parameter N. N is evaluated so may either be a number or an expression, e.g. $OutlineDepth+3
. This kind of thing is useful if trying to correctly indent source code and when the export 'base' is at a level other than the root of the TBX.
If the N parameter is used, the data parameter must also be supplied. To explicitly specify a tab, as in the normal default, use "\t", e.g. ^indent("\t",6)^
.
For web use, tabs are ignored for white space so consider using one or more " " space HTML entities as the data value.
Examples
In the source TBX document this note is at Outline Depth 4, so ^indent(data)^
will emit the data value 3 times. Thus, if we use a hyphen as the indent's data value, you see:
---Text indented with ^indent(-)^
.
In the next example the on-screen text should be visibly indented three (non-proportional) spaces:
Text indented with ^indent( )^
.
Note how the visual HTML output of the next two examples is not visibly indented as tabs are not interpreted as white space mark-up in HTML, but are present in the HTML source:
Text indented with ^indent^
(i.e. a tab).
Text indented with tabs to outline level plus 4 (i.e. ^value(eval($OutlineDepth+4))^ tabs, thus 8 tabs)
Thus, if you view the HTML source for the page, you will see first of the two examples immediately above has output 4
tabs. For the example following it, you will see 8
tabs have been output; depending on the program viewing the source you may be able to 'see' these as tabs by moving the cursor through the source code with the arrow keys: you will see it jump from tab to tab.
Root level notes are not indented.