-
-
Notifications
You must be signed in to change notification settings - Fork 2
RIPL Reference Manual
break | continue | else | elseif | for-each | if | repeat | while
a | advance | body | br | div | footer | header | image | li | link | list | p | page | svg | use
call | debug | editdef | focus | include | index | inject | let | parse | print | script | template | trigger
button | checkbox | combobox | input
RIPL exposes XQuery functionality in its parser. The current implementation supports the following surfaces:
-
if,elseif, andwhileusetest="...". -
data,for-each,let,parse, andprintuseselect="...". - Most other attributes may use attribute value templates (AVTs) with
{...}fragments. Use{{and}}to emit literal braces.
Relative paths are evaluated against the active XML context. Inside for-each, . and relative paths are rebound to the current selected item. $page always refers to the active source page, and $doc refers to the parser-local data tree loaded by data.
The following runtime bindings are available to XQuery expressions and AVTs:
| Binding | Type | Description |
|---|---|---|
$args |
map | Attributes from the current template call. |
$doc |
node sequence | The current parser-local data tree loaded by data. |
$layout |
map | Layout metrics such as view-width, view-height, page-width, and page-height. |
$loop |
map | The active loop frame. Exposes index, iteration, start, step, and, when known, count and end. |
$meta |
map | Document metadata such as title, author, description, copyright, keywords, path, line-no, current-page, next-page, and prev-page. |
$page |
node sequence | The active source page node. |
$params |
map | Document parameters, as set by the user through the URL. |
$state |
map | Lexical bindings created by let. |
$style |
map | The current parser font style: font-face, font-style, font-fill, and font-size. |
$vars |
map | Access to document key-values, as set by the client through SetKey(). |
The following helper functions are registered automatically for document-side XQuery:
| Function | Description |
|---|---|
kt:object-exists(Name) |
Returns true if a named document-visible object currently exists. |
kt:object-id(Name) |
Returns the matching object's ID as a string. |
kt:self-id() |
Returns the current object ID, or the document ID when no narrower context exists. |
kt:uid() |
Returns a refresh-local generated identifier for the document. |
kt:platform() |
Returns the host platform string. |
kt:field(Object, Field) |
Returns an object field as a string value. |
kt:key(Object, Key) |
Returns an object key-value as a string (via GetKey()). |
kt:template-content() |
Returns the current template caller content as a node sequence. In AVTs this stringifies the caller text; in parse@select it re-injects the caller markup. |
RIPL exposes regex support through its XQuery integration. When you are working in an XQuery-aware surface such as test="...", select="...", or an AVT fragment like {...}, the following XQuery regex functions are available:
| Function | Description |
|---|---|
matches(Input, Pattern[, Flags]) |
Returns true when the input matches the supplied regex. Use this for conditional logic. |
replace(Input, Pattern, Replacement[, Flags]) |
Applies a regex replacement and returns the resulting string. |
tokenize(Input, Pattern[, Flags]) |
Splits a string by regex and returns the resulting sequence of tokens. |
This means regex is currently a document-side text-processing tool inside XQuery:
- use
if test="matches(...)"andelseif test="matches(...)"for regex-based conditions - use
print select="replace(...)"for regex-based text rewriting - use
tokenize()withstring-join()or sequence processing when a document needs regex-driven splitting
Examples:
<if test="matches($state?email, '^[^@]+@[^@]+\.[^@]+$')">
<print value="Email address accepted."/>
</if>
<print select="replace('Alpha Beta', '\s+', ' ')"/>
<print select="string-join(tokenize('A,B,C', ','), ' | ')"/>Breaks out of the innermost active repeat, while, or for-each loop.
Skips the remainder of the current iteration of the innermost active repeat, while, or for-each loop.
Pair with the if element to execute a branch if former if and elseif branches haven't executed.
If not declared in series with a previous if statement, the element is ignored by the parser.
Pair with the if element to evaluate an XQuery condition and execute a branch, but only if former if and elseif branches haven't executed.
| Attrib | Type | Description |
|---|---|---|
| test | string | Evaluates an XQuery expression. The branch executes when the expression's effective boolean value is true. |
The elseif element is paired with the if element to evaluate a conditional and execute its branch, but only if former if and elseif branches haven't executed.
Please refer to the if element for further documentation.
| Attrib | Type | Description |
|---|---|---|
| select | string | Required. Evaluates an XQuery expression that must resolve to a node sequence. |
The for-each element iterates over an XQuery node sequence. The select expression is evaluated once, then the child content is parsed once for each selected node.
Inside the loop body, the current item becomes the active XQuery context item. This means that ., relative paths, and attribute lookups such as @code resolve against the current node. The active loop frame is also exposed through $loop, with index and iteration starting at 0, and count fixed to the total number of selected items.
for-each only accepts node sequences. Atomic sequences are rejected. Both real XML nodes and constructed nodes are supported. break and continue apply to the innermost active for-each.
Evaluates an XQuery condition and executes the encapsulated code if the expression is true.
| Attrib | Type | Description |
|---|---|---|
| test | string | Evaluates an XQuery expression. The branch executes when the expression's effective boolean value is true. |
The if element is used to evaluate a condition and then act on the result. It can be paired with the elseif and else elements to create complex decision trees during document processing.
The following example illustrates the construction of a complete if statement and alternative branches:
<if test="1 lt 2">
<debug msg="if branch executed."/>
</if>
<elseif test="starts-with('warning', 'warn')">
<debug msg="elseif branch executed."/>
</elseif>
<else>
<debug msg="else branch executed."/>
</else>
Full XQuery expressions are supported here, including functions such as exists(), empty(), not(), matches(), and the document helper functions listed in XQuery Support.
Repeats a section of code for a specific number of times.
| Attrib | Type | Description |
|---|---|---|
| count | integer | Defines a fixed number of times for the repeat loop to execute. Overrides the end attribute. |
| end | integer | Defines an exclusive end-point for the loop. Ignored if the count attribute has been set. |
| index | string | Declares a legacy alias name for the current repeat index while the loop is active. |
| start | integer | A starting value for the repeat loop may be set with this attribute. The default is 0. |
| step | integer | Sets a stepping value other than the default inferred direction. |
The repeat element is used to repeatedly execute sections of document code for a fixed number of times. It is useful for data processing and compacting repeated areas of document content. At a minimum, the count or end attributes must be defined so that the required number of executions is known to the parser.
During execution, the active loop frame is available through $loop. This exposes index, iteration, start, step, and, when known, count and end.
A loop can be broken at any time with the break element, and specific iterations can be skipped with continue.
If step is omitted, the parser chooses 1 for ascending loops and -1 for descending loops. Descending loops are therefore supported. Sequence iteration is not supported in repeat; use for-each for XQuery node sequences.
This simple example prints the numbers 0 through 9:
<repeat count="10">
<p><print value="{$loop?index}"/></p>
</repeat>
| Attrib | Type | Description |
|---|---|---|
| test | string | Evaluates an XQuery expression. The loop continues while the expression's effective boolean value is true. |
The while element is used to repeatedly execute sections of document code for as long as a condition is satisfied. When the condition is no longer true, the loop is broken.
During execution, the active loop frame is available through $loop. index and iteration both start at 0 for the first pass. Unlike repeat, the while element does not support a named index attribute.
A while loop can be broken at any time with the break element, and portions of the code can be skipped by using continue.
| Attrib | Type | Description |
|---|---|---|
| select | string | Evaluates an XQuery expression and replaces the parser-local data scope with the resulting XML/RIPL fragment or concrete XML node sequence. |
The data element loads parser-local XML data without emitting it directly into the output stream. The resulting tree becomes visible to XQuery as $doc.
Each data element replaces the previous $doc tree; it does not append to it. The selected result must resolve to parseable XML/RIPL markup with at least one top-level tag, or to a concrete XML node sequence that can be serialised back into such markup.
The info element declares document metadata in child elements. The following elements are supported:
|Element|Description| |:-|:-|:-| |author|The author(s) of the document.| |copyright|Copyright and licensing information.| |description|Custom description for the document| |keywords|Relevant keywords in CSV format.| |title|The title of the document (can be displayed in the browser window).|
This HTML compatible element is used as a short-form for defining a hyperlink. Please refer to the link element for further details.
| Attrib | Type | Description |
|---|---|---|
| x | unit | Increases the cursor's horizontal position. |
| y | unit | Increases the cursor's vertical position. |
The advance element controls the position of the cursor during the parsing of a document page.
When the parser encounters an advance element, it will move the cursor by the number of pixels indicated by the x and y attribute values. The provided values must be positive, as it is not possible to move the cursor to an earlier point in the document.
| Attrib | Type | Description |
|---|---|---|
| clip-path | uri | Refer to an SVG clip definition to mask graphics outside of the clipping path. |
| cursor-stroke | painter | Defines an SVG stroke operation for the text cursor. |
| fill | painter | Defines the fill operation for the background. Set to 'none' to disable the background and make the document transparent. |
| font-face | string | Defines the default font face. |
| font-size | unit | Defines the default font size. |
| font-fill | painter | Defines the default font fill. |
| link | painter | The default fill for hyperlinked text can be defined here. Applies to URI-based hyperlinks only. |
| select-fill | painter | The default fill operation to use for a hyperlink when it has been selected (e.g. via tab key). |
| margins | string | The default size of all four page margins can be defined here. Specify four unit values in clockwise order, Left Top Right Bottom. |
| v-link | painter | The default fill operation for previously visited hyperlinks. |
| width | dimension | Declares the width of the page, either as a fixed pixel value or as a percentage of the available viewing area. page-width is accepted as a synonym. |
The body element defines page body attributes and the default text style.
If a root-level body contains user defined content, it will be used as a template through which page content is displayed. For instance, one might want to create a graphical frame for the borders of a page and display content within it. This can be achieved by creating a table in the body and then using an inject element in the cell where the page content is to be displayed.
A body element may also appear inside a page to adjust attributes for that page while it is being processed. In that form it is not treated as a page wrapper template.
Use div to structure the document in a similar way to paragraphs. Its main difference is that it avoids the insertion of paragraph start and end points and can be used to alter the active paragraph style for a particular section of content.
Please refer to p for the full list of available attributes.
The footer is a special template that is processed after the current page content. The footer is a root-level element that will be applied to all pages in the file. It can be manually turned off for any given page by using the no-footer attribute in the page element.
The header is a special template that is processed before the current page content. The header is a root-level element that will be applied to all pages in the file. It can be manually turned off for any given page by using the no-header attribute in the page element.
| Attrib | Type | Description |
|---|---|---|
| align | lookup | Set to left, right, or center/middle to float the image horizontally. |
| fill | painter | A painter or pattern reference to render. src is accepted as a synonym. |
| height | unit | Requested height. If omitted or set to 0, the parser auto-sizes the image. |
| padding | string | Outer padding in clockwise order. |
| src | painter | A painter or pattern reference to render. |
| v-align | lookup | For inline images, set to top, center/middle, or bottom. |
| width | unit | Requested width. If omitted or set to 0, the parser auto-sizes the image. |
Images are inline by default. Setting align turns the image into a floating object positioned relative to the available page width. Inline images are treated as part of the text flow, and v-align controls their position when the line height exceeds the image height.
The image element renders any named painter or pattern reference, not just bitmap images. In practice it is commonly used with resources loaded in an svg section.
| Attrib | Type | Description |
|---|---|---|
| fill | painter | The default fill operation applied to the link's text can be overridden by this attribute. |
| href | uri | The link will load the referenced URI in-place when activated. That is if the URI refers to a RIPL page, the document will load the new page and unload the current one. |
| hint | string | Attaches a hint to the hyperlink. This hint may be displayed to the user when the mouse pointer rests above the hyperlink. |
| on-click | function | The link will execute the referenced function when it is clicked by the user. |
| on-crossing | function | The link will execute the referenced function when the mouse cursor crosses in or out of its boundary. |
| on-motion | function | The link will execute the referenced function when the user moves the mouse cursor over it. |
| select | boolean | The link will be selected (given the focus) when the document is displayed. |
The link element defines a hyperlink that is attached to encapsulated content. The content may be in the form of text and/or visual object. When the user interacts with the hyperlink, it is activated. Hyperlinks can either activate a new URI location in-place, or execute a script function.
If both the href and on-click attributes have been defined in the element, the first definition will take precedence. It is not possible to have both a function and URI attached to one hyperlink for execution.
Parameters can be forwarded to a referenced function by attaching them to the link. All parameters must be listed inside the element and identified with the @ prefix. Parameters will be passed to the function in the order in which they are given. For example: <link on-click="function" @arg1="hello" @arg2="world"/>
It is also possible to set global variables when the hyperlink is activated. To set a global variable, use an underscore as a prefix to the variable name.
| Attrib | Type | Description |
|---|---|---|
| fill | painter | The fill operation to use for the bullet in bullet point lists. |
| indent | unit | When embedding lists, the indent value determines the amount of indentation the child list has from the parent. |
| type | lookup | Defines the type of the list, which affects the style of bullet points that are used for list items. Valid types are bullet, custom and ordered. |
| v-spacing | unit | Defines the amount of whitespace between list items. The default value is 1.0 and is used as a multiplier of the page's default line height. |
The list element defines a grouping of paragraphs that are accompanied with a bullet point for each item in the list.
| Attrib | Type | Description |
|---|---|---|
| aggregate | bool | For ordered lists only. If true, parent numbering prefixes are added to this item. |
| indent | unit | Indent the list item content. |
| line-height | unit | Declares the line-height multiplier used when the item wraps. |
| no-wrap | boolean | Deactivates word-wrapping for the item. |
| trim | boolean | Eliminates any leading whitespace found at the start of the content. |
| v-align | string |
top, center, bottom
|
| value | string | For custom lists, specify the bullet text here. |
The li element is used to declare a new list item with encapsulated content. It behaves like a paragraph with automatic list marker handling, but it does not support the full p attribute set.
If the element belongs to a custom style list, the value attribute must be set with customised bullet point text. If not, the bullet point will remain empty.
| Attrib | Type | Description |
|---|---|---|
| align | string | Determines the alignment of content within the paragraph. The default is left. Valid values are left, center and right
|
| font-size | unit | The size of the font for this paragraph. |
| font-face | string | The name of a font face for this paragraph. |
| font-fill | painter | The fill operation to use when rendering text. |
| font-style | string | Sets the font style to bold, italic or bold italic. |
| indent | unit | Indent the paragraph by this amount of whitespace. |
| leading | unit | The leading ratio adjusts the amount of vertical white space that is inserted prior to the paragraph content. If no content precedes the paragraph, the leading value is ignored. This makes the leading ratio ideal for headlines, where no space is desirable at the top of the page, but is needed to clearly separate a headline from preceding content. |
| line-height | unit | Declares the vertical advance from one line to the next when a wordwrap occurs. Expressed as a multiplier, 1.0 is the default. |
| no-wrap | boolean | Deactivates word-wrapping. |
| trim | boolean | Eliminates any leading whitespace found at the start of the content. |
| v-align | string |
top, center, bottom
|
Paragraphs are used to encapsulate content. Vertical whitespace is controlled primarily by the paragraph's own layout behaviour and the leading attribute, which applies to the first line of the paragraph.
If a paragraph is embedded within another paragraph element, a new line is inserted at the start of the opening element. The amount of whitespace is controlled by the newly declared paragraph.
Note: The RIPL parser treats li elements as paragraphs, making the two elements somewhat interchangeable when used within a list.
| Attrib | Type | Description |
|---|---|---|
| name | string | A page name should be specified here for identification purposes. |
| no-footer | boolean | Turns off the default footer if one is specified in the document. |
| no-header | boolean | Turns off the default header if one is specified in the document. |
The page element is used to encapsulate an entire page of content that can be displayed to the user. In most cases a document file should consist of at least one page of viewable content. If multiple pages are defined, they should all be given names so that they can be referenced individually.
Pages can be defined anywhere within a document - they don't have to be at the root level. Pages can be nested, but the parser will ignore the content of any nested page that is encountered during the processing of another page.
To view a page other than the default, the document location needs to be set with the new page name. Most commonly this is achieved through hyperlinks - an href value of #PageName in a link element is sufficient. Specific pages can also be manually requested by setting the document URI correctly.
| Attrib | Type | Description |
|---|---|---|
| placement | string | Set to foreground (default) or background to target the inner page or viewing window respectively. |
This element can only be used once per document.
Use svg to process an SVG document, targeting either the document's page or view according to placement. Inline placement is not possible.
The inclusion of SVG support is not intended for direct graphics rendering as such. Use it to create named resources that can then be referred to in the document (e.g. for fill operations), or via the use element for symbols. For inline rendering of embedded SVG graphics, the image element is suitable for this purpose.
The use element allows SVG <symbol> declarations to be injected directly into the parent viewport (e.g. table cells). SVG graphics that are created in this way are treated as dynamically rendered background graphics. Regular content will be laid directly over the top, with no clipping considerations.
If more sophisticated inline or float embedding is required, consider using the image element.
| Attrib | Type | Description |
|---|---|---|
| function | function | Required. Refers to the function that will be called. |
Use this element to call a function during the parsing of the document. All attributes other than function are treated as parameters, and will be passed to the function in order of appearance.
For convenience, it is possible to set variables for the target script by prefixing attribute names with an underscore. These will not be passed to the function.
To call a function that isn't in the default script, use the naming convention script.function.
| Attrib | Type | Description |
|---|---|---|
| msg | string | A message to be logged. |
The debug element sends messages to the application log during parsing of the document.
| Attrib | Type | Description |
|---|---|---|
| edit-fonts | bool | If true, allow the font style and face information to be changed. |
| edit-images | bool | If true, allow images to be edited, inserted or removed. |
| edit-tables | bool | If true, allow tables to be edited, inserted or removed. |
| edit-all | bool | If true, allow the user to perform all forms of editing, without restriction. |
| line-breaks | bool | If true, allow the user to add line breaks with the enter key. |
| max-chars | integer | Limit the number of characters to this value. |
| name | string | A unique name for the editing area. |
| on-change | function | Function to call whenever content changes. |
| on-enter | function | Function to call when the user activates the editing area (gains focus). |
| on-exit | function | Function to call when the user leaves the editing area (lost focus). |
| @... / _... | string | Additional arguments that are stored with the edit definition. |
Defines an area that the user can edit with the text cursor. For use by editable table cells only.
At present, edit-fonts, edit-images, edit-tables, edit-all, and select-fill are accepted by the parser but are not applied by the current implementation.
This element tells the parser that the next viable element that can receive the user's focus will do so when the document is activated. This feature is commonly used as a precursor to widgets such as input boxes.
Any encapsulated content is ignored.
Note that for hyperlinks, the select attribute can also be used as a convenient means to assign focus.
| Attrib | Type | Description |
|---|---|---|
| src | uri | Required. Refers to the source file for loading. |
| volatile | boolean | Marks the src as volatile and forces the cache engine to always check if it has changed on document refreshes. |
Use the include element to load external RIPL files into your document. Bear in mind that parsing of the document will stop while the file is retrieved from its source.
| Attrib | Type | Description |
|---|---|---|
| hide | boolean | If present, the indexed content is processed but marked invisible. |
| name | string | The name of the index. |
Indexes are used to create bookmarks in a page. These bookmarks can be used for quickly advancing to a specific point on the page via hyperlinks. Another usage is to mark areas in the document that your scripts need to access for content modification purposes (the FindIndex() method is used for this purpose).
If name is omitted, the parser will try to derive it from the first immediate text node inside the element.
For use in templates only. Injects content from the caller into a specific area in the template.
When the caller content needs to be consumed from a template attribute instead of at element position, use kt:template-content() in an XQuery expression or AVT.
| Attrib | Type | Description |
|---|---|---|
| name | string | Required. Declares the binding name that will be exposed through $state. |
| select | string | Required. Evaluates an XQuery expression and stores the resulting value for the duration of the element's child scope. |
The let element creates a lexical binding that is visible only to its child content. Bindings are exposed as entries in $state, so name="label" is read back as $state?label.
Bindings may contain scalar values or preserved node sequences. Nested let elements may shadow earlier bindings, and the outer value is restored automatically when the nested scope ends.
| Attrib | Type | Description |
|---|---|---|
| select | string | Evaluates an XQuery expression. Node results are serialised as XML fragments and reparsed; scalar results must resolve to parseable XML/RIPL markup. |
| value | string | An XML compliant string value to insert into the document stream. AVTs may be used to build this value dynamically. |
The parse element injects RIPL code into the document stream while it is being processed by the interpreter. This allows RIPL code to be dynamically generated or retrieved from an external source for inclusion in the document.
Use parse when you want markup or node insertion. parse@select is the node-aware surface: selected XML nodes are
serialised and reparsed into the document stream. For the insertion of plain text, please use the print
element.
If both select and value are present, select takes precedence.
| Attrib | Type | Description |
|---|---|---|
| select | string | Evaluates an XQuery expression and inserts its string value. Node results are stringified; they are not emitted as markup. |
| src | string | Load plain text from a file. This is only available when the document is running in unrestricted mode. |
| value | string | String value to insert into the document stream. AVTs may be used to build this value dynamically. |
The print element is used to inject raw text into the document stream during parsing. This feature is typically used to create or retrieve dynamically generated content that is not constant.
Use print for text only. If an XQuery expression yields nodes, print@select inserts their string value rather than
their markup. For the insertion of RIPL markup or node content, please use the parse element.
If both select and value are present, select takes precedence.
| Attrib | Type | Description |
|---|---|---|
| cache-file | string | This attribute may be used in trusting environments only. It allows the script to specify a file path to which the compiled script will be saved. The next time that the document is processed, the pre-compiled script will be loaded in order to skip the entire compilation process. |
| default | boolean | If true, sets this script as the default for the entire document (all function names will be directed to it unless fully qualified). |
| external | object | Refer to a script that already exists outside of the document, by name or UID. This attribute may be used in trusting environments only. |
| name | string | Defines a name for the script. |
| persistent | boolean | Declares that the script is persistent. In this mode, the script will survive refreshes. |
| src | string | Allows script code to be loaded from an external file source. |
| type | string | Declares the type of scripting language that is used for the code. The default is Tiri. |
| @... | string | Pass key/value pairs into the script before activation. |
By default, scripts are automatically compiled and activated when the parser encounters them in the document. If the script returns a result string, that result is assumed to be valid XML and is processed by the parser as such.
If the script contains functions, those functions can be called at any time, either during the parsing process or when the document is displayed.
The first script encountered by the parser will serve as the default source for all function calls. If you need to call functions in other scripts then you need to access them by name - e.g. myscript.function().
Please refer to the script programming section of the official RIPL reference guide for further information on programming with scripts.
| Attrib | Type | Description |
|---|---|---|
| name | string | The name of the template. |
Templates provide a powerful means of creating customised elements in your documents. Repetitive code sequences are excellent candidates for templating to write cleaner code. An additional benefit of doing this is that any modifications that you need to make to your code can now be made at a single location, rather than through the entire document. Templates are commonly used for managing document aesthetics, for instance headlines and other forms of styling are often implemented as templates. In cases where you might use CSS in HTML, you'll want to use templates in RIPL.
This template example emulates HTML's H1 element.
<template name="h1">
<p leading="2.0"><font face="Noto Sans" size="18pt" fill="#404050" style="bold"><inject/></font>
</template>
The following code demonstrates how this template would be used:
<h1>Big Headline Here</>
Notice the use of the inject element in the template source. This tells the parser to inject the content that the user has encapsulated within the h1 opening and closing elements.
If the same caller content needs to feed an attribute instead of a child position, kt:template-content() provides the injected content as an XQuery node sequence. For example, parse select="kt:template-content()" mirrors the markup behaviour of <inject/>, while value="{kt:template-content()}" injects the caller's text value into an AVT.
Any attributes that the user includes when referencing a template can be accessed via XQuery $args, e.g. {$args?argname}.
| Attrib | Type | Description |
|---|---|---|
| event | lookup | Must refer to an event that will be monitored. |
| function | function | The function that will be called when the trigger is activated. |
The trigger element allows you to devise custom responses to events that occur during document processing and in real-time document usage. It works by specifying the event that will be monitored and a reference to an existing function that will be called when the event occurs. Triggers are persistent, so they can be executed multiple times if the event frequently occurs.
The trigger must be declared after the script containing the function you wish to execute. We recommend that triggers are specified immediately after the script definition to which they are attached, or at the very end of the document file.
The following table illustrates the events that you may monitor:
| Event | Parameters | Description |
|---|---|---|
| after-layout | ViewWidth, ViewHeight, PageWidth, PageHeight | Executes just after the layout engine has arranged all the content on the page. It will re-execute whenever the layout needs to be re-calculated, e.g. when content is changed dynamically or the page is resized. |
| before-layout | ViewWidth, ViewHeight | Triggers just before the layout engine is going to arrange all content on the page. |
| focus | N/A | Triggered when the document receives the focus, i.e. the user has clicked on the document window. |
| focus-lost | N/A | Triggered when the document loses the focus, i.e. the user has clicked away from the document window. |
| leaving-page | OldURI, NewURI | Triggered when the document is about to move to a new page or document source. |
| on-click | X, Y, Type | Triggered whenever the mouse pointer is clicked on the document. The coordinates are indicated in X and Y. The type of clicks are LMB, RMB, MMB for the three most common mouse buttons. Additonal buttons are named from BUTTON4 onwards. |
| on-motion | X, Y | Triggers whenever the mouse pointer moves within the document. |
| on-release | X, Y, Type | Triggers whenever a clicked button is released over the document. |
| page-processed | N/A | Triggers after a document page has been processed by the parser. |
| refresh | N/A | Triggered when the document content is refreshed, whether that is automated or manually requested by the user. |
| Event | Args | Description |
|---|---|---|
| border | string | Defines the borders that will be painted for the cell. Can consist of any variation of the following values, in CSV format: all, top, left, bottom, right. Styling utilises the table stroke-width and stroke if the cell equivalents are not specified. |
| col-span | integer | Allows the cell to span multiple columns. Minimum value is 1. |
| fill | painter | The fill operation to apply to the cell's background. If not defined, the cell is transparent. |
| edit | string | Enables user editing mode within the cell if this value refers to a named editdef. |
| no-wrap | boolean | Disables word-wrapping if true. |
| on-click | function | The referenced function is called if the cell is clicked by the user. |
| on-crossing | function | The referenced function is called when the mouse cursor crosses in or out of the cell boundary. |
| on-motion | function | The referenced function is called when the user moves the mouse cursor over the cell. |
| row-span | integer | Allows the cell to span multiple rows. Minimum value is 1. |
| select | boolean | Give the cell the user focus (only valid if the cell has editing enabled). |
| stroke | painter | A stroke operation to apply when drawing the border of the cell. Overrides the table stroke. |
| stroke-width | float | The width of the stroke. Overrides the table stroke-width. |
The cell defines a table cell that can encapsulate content. The cell must be a child of a row element. Each cell is processed as if it were an independent page within the table.
Tip
The use element can inject vector graphics into the background of table cells.
| Event | Args | Description |
|---|---|---|
| fill | painter | The fill operation to apply to the row's background. If not defined, the row is transparent. |
| height | float | Minimum height of the row. |
| stroke | painter | A stroke operation to apply when drawing the row border. |
Declares a table row for containing cell elements. The row must be a child of a table element.
| Event | Args | Description |
|---|---|---|
| align | string | Defines the position of the table within its page area. Valid values are left (default), center and right
|
| cell-padding | unit | Defines the spacing (margins) inside each cell. margins is accepted as a synonym. |
| collapsed | bool | If true, all spacing is disabled around the edges of the table. |
| columns | string | A CSV string of column widths, measured in pixels and/or percentages. When using percentages, the total of all values must not exceed 100%. Negative numbers are an error. |
| fill | painter | The fill operation to apply to the table's background. If not defined, the table is transparent. |
| h-spacing | unit | Horizontal spacing between cells. |
| spacing | unit | Defines v-spacing and h-spacing with one value. |
| stroke | painter | A stroke operation to apply when drawing the border of the table. |
| stroke-width | float | The width of the stroke. |
| v-spacing | unit | Vertical spacing between cells. |
| width, height | unit | Define minimum values for the table's width and height. |
Declares a table for arranging content into rows and cells.
Synonym for the cell element, provided to assist HTML compatibility only.
Synonym for the row element, provided to assist HTML compatibility only.
Activates bold styling for all text encapsulated by the element.
Forces a new line. Encapsulated content is not expected and will be ignored.
| Attrib | Type | Description |
|---|---|---|
| fill | painter | Defines the SVG-style fill operation to apply to font text. |
| face | string | The name of a recognised font. |
| preformat | boolean | Enables preformatting. In this mode, all whitespace is acknowledged by the parser and will not be automatically compacted. |
| size | unit | Requests a specific font point size. For fixed-size fonts, the nearest matching point size will be selected by the font server. |
| style | lookup | Valid font styles are bold, italic, bold italic. |
The font element applies a new font style to encapsulated text. This may result in the height of the current line increasing if the new font size exceeds that of the previous font style. The style is reversed to the previous one when the font element is terminated.
Adds italic styling to the current font and reverses this effect when the end of the element is encountered. If the font is already using italic styling, this element will do nothing.
The preformat element tells the parser to fully account for all whitespace that is within the encapsulated area. This means that multiple spaces will be treated as such, rather than being compacted to a single space.
Adds underlining to the current font style and reverses this effect when the end of the element is encountered. If the font style is already using underlining, this element will do nothing.
| Attrib | Type | Description |
|---|---|---|
| alt-fill | painter | The widget's alternative graphics can be customised by this fill operation, which should refer to a pattern named in an svg section. The alternative graphics state is activated when the button is depressed. |
| cell-padding | string | Set cell inner-padding values in clockwise order. If using percentages, the value is calculated from the diagonal of the parent. |
| fill | painter | The widget's graphics can be customised by this fill operation, which should refer to a pattern named in an svg section. |
| name | string | A unique name to identify the widget. |
| padding | string | Set cell outer-padding values in clockwise order. If using percentages, the value is calculated from the diagonal of the parent. |
| width, height | unit | The minimum width and height of the widget. |
The button widget allows for interactable buttons to be presented in a RIPL document. An unusual feature of this implementation is that the button text is defined as encapsulated content, allowing RIPL markup to be used to full advantage. For example:
<button width="400" height="60"><font size="30">Preset <i>400w<br/>60h</i></font> Size</button>
| Attrib | Type | Description |
|---|---|---|
| fill | painter | The widget's graphics can be customised by this fill operation, which should refer to a pattern named in an svg section. |
| label | string | Gives the widget a text label. |
| label-pos | string | Set to left or right to define the side that the label will appear on. |
| name | string | A unique name to identify the widget. |
| value | string | Set to 1 or true to set the checkbox to an active state on its creation. |
| width | unit | The minimum width of the widget. |
The checkbox widget allows for interactable checkboxes to be presented in a RIPL document.
| Attrib | Type | Description |
|---|---|---|
| fill | painter | The widget's graphics can be customised by this fill operation, which should refer to a pattern named in an svg section. |
| font-fill | painter | The fill operation to use for the combobox text. |
| label | string | Gives the widget a text label. |
| label-pos | string | Set to left or right to define the side that the label will appear on. |
| name | string | A unique name to identify the widget. |
| value | string | Preset the combobox text to this string value. |
| width | unit | The minimum width of the widget. |
The combobox acts as an enhanced input widget that features a drop-down menu, allowing the user to select text from a list of predefined items.
The drop-down menu items are defined with a series of <option> elements in the <combobox> tag. Each option may feature an icon and define an identity value that differs to the presented content. The following example illustrates:
<combobox width="200" value="pre-defined content">
<option icon="icons:items/add" value="volvo">Volvo</option>
<option icon="icons:items/find" value="saab">Saab</option>
<option icon="icons:items/cancel" value="mercedes">Mercedes</option>
<option icon="icons:items/start" value="audi">Audi</option>
</combobox>
It is valid for option elements to contain RIPL markup, if desired.
It is possible to change the style of the drop-down menu by adding a <style> tag that contains a separate RIPL document just for the menu. This should be achieved with the inclusion of an <svg placement="background"> tag and possibly a body. The following example illustrates:
<combobox ...>
<style>
<svg placement="background">
<rect rx="1%" ry="1%" x="1" y="1" xOffset="1" yOffset="1" fill="rgb(255,0,0)" stroke="white" stroke-width="2"/>
<defs>
<pattern id="Highlight">
<rect width="100%" height="100%" fill="rgb(128,64,64)"/>
</pattern>
<image id="cancel" xlink:href="icons:items/cancel" width="32" height="32"/>
</defs>
</svg>
<body font-fill="rgb(255,255,255)" link="rgb(255,255,255)" v-link="rgb(255,255,255)"/>
</style>
<option value="volvo">This option includes an <image src="url(#cancel)"/> image.</option>
<option .../>
</combobox>
Notice how an image is included in the style that can then be referenced from the option. This is the only way to achieve this design pattern, as the drop-down menu has a distinctive RIPL state that is not shared with the main document.
| Attrib | Type | Description |
|---|---|---|
| fill | painter | The widget's graphics can be customised by this fill operation, which should refer to a pattern named in an svg section. |
| font-fill | painter | The fill operation to use for the input text. |
| label | string | Gives the widget a text label. |
| label-pos | string | Set to left or right to define the side that the label will appear on. |
| name | string | A unique name to identify the widget. |
| secret | boolean | If true, the widget stores its value as secret input. |
| value | string | Preset the input text to this string value. |
| width | unit | The minimum width of the widget. |
The input widget provides a space for the user to type text into a reserved entry box.