Tinderbox Icon

^indent( [data][, N] )^


Code Type: 

Code Scope of Action: 

Code First Added: 

Code Altered: 

 Export Mark-up   [other codes of this type]

 item   [codes with similar scope]

 Already in v5.0.0

 format"


^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); from v5.6.0, for aliases this is the alias' value and not that of the original.

N. From v5.5.0 this 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 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 isn't indented as tabs aren't interpreted as white space mark-up in HTML:

Text indented with ^indent^ (i.e. a tab)

Text indented with tabs to outline level plus 4 (i.e. 8 tabs)

However, if you view the HTML source for the page, you'll see first of the two examples immediately above has output 4 tabs non-breaking space HTML entities. For the example following it, you'll 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'll see it jump from tab to tab.

Root level notes are not indented.


Possible relevant notes (via "Similar Notes" feature):

Previous: ^include( item|group[, template] )^  Next: ^linkTo( item [, data] [,css class] )^ 


A Tinderbox Reference File : Export Codes : Export Codes - Full Listing : ^indent( [data][, N] )^ aTbRef Site Map