You can create custom templates for exporting ReqView projects or documents into HTML, CSV, XML or any other structured text format.
To export a text file using a custom template, click File, mouseover Export and click Custom Template. In the Export Using Custom Template dialog, choose exported documents and other options. After confirmation of the dialog, select a destination for storing the exported files.
The exported files are named according to the project or document ID with the same extension as the template file (for example, SRS.html).
Note: In the WebApp, the exported files are saved in the browser download folder.
Documents:
Table View:
The last used view or the default table view is used for documents that do not define the selected table view. For more information see Table Views.
Layout:
Chose an custom export template file specifying the layout and styling of exported data.
Options:
exportParam
below.You can export ReqView documents to HTML, CSV, XML files using reqview export custom
command, see Command Line > Export Documents.
The exported data model describes the project, documents and traceability links. ReqView passed the data model to the selected export template which describes how to convert the data model into a text output by means of a text markup and export helpers.
Exported documents contains the following properties at the top level:
eachDocumentObject
You can iterate exported documents by helper eachDocument
or output a given document by helper withDocument
.
Exported document objects contains information about attributes, template columns, file attachments, discussion, and traceability links:
eachDisplayedCustomAttribute
eachColumn
eachAttachment
eachInlinkType
/ eachOutlinkType
and eachInlinkWith
/ eachOutlinkWith
You can iterate exported document objects by helper eachDocumentObject
.
Export templates describe how to convert the exported data model into a text output using Handlebars syntax with {{
moustache }}
form. You can customize templates using expressions or template helpers. Expressions are some contents enclosed by double curly braces – e.g. {{<expression>}}
. Expressions in this form produce HTML escaped output. If you don’t want to escape the expression value, use the “triple-stash” form: {{{<expression>}}}
.
For example, {{text}}
outputs object text description with HTML escaped tags <p>User shall …</p>
while {{{text}}}
outputs the object text description with the original HTML tags <p>User shall …</p>
.
Whitespace (for example, line endings) in the template is preserved into the output text. If you want to trim whitespace from either side use a tilde (~
) by the braces. For example, {{~expression}}
removes all whitespace before the expression up to the first handlebars expression or non-whitespace character.
Handlebars define a rich set of built-in template helpers allowing you to conveniently iterate through an object structure and output object properties using expressions. The most useful of them is the predefined conditional block helper allowing you to render block content based on the result of the given expression:
… …
To pass values to a helper with parameters, list the parameters after the helper name:
Unlike the if
helper mentioned above, most custom block helpers (usually named each…
or with…
) change the current evaluation context. Sometimes it is necessary to reach into parent context when nesting such helpers – this is done using the {{../<property>}}
syntax, similar to how directory paths work.
You can reuse template code through Handlebars inline partials, see HTML Table and Book Layouts. See also HTML Traceability Matrix for an example template using inline partials recursively to output a traceability coverage across several levels.
You can use also the following ReqView template helpers that simplify access to the exported data model.
Project Helpers: projectId
• eachDocument
• eachOpenDocument
• withDocument
• exportOption
• exportParam
Document Helpers: docName
• eachDocumentObject
• isRTL
Document Object Helpers: docObjId
• shortDescription
• sectionNumber
• isSection
• section
• indentation
• attributeValue
• lastChangedOn
• eachChild
• hasChild
• eachAttachment
• hasInlinks/hasOutlinks
• ifHasInlinks/ifHasOutlinks
• countInlinks/countOutlinks
• eachInlinkType/eachOutlinkType
• eachInlinkWith/eachOutlinkWith
• withParent
• withParentLink
• hasOriginInlink/hasOriginOutlink
• eachOriginInlink
• withOriginOutlink
Attachment Helpers: imageSize
Link Helpers: linkTypeName
• eachLink
• hyperlink
• ifSuspect
Column Helpers: eachColumn
• eachDisplayedCustomAttribute
• columnId
• columnName
• columnProperty
• isColumn
• isAttributeColumn
• isTemplateColumn
• attributeColumnValue
• columnAttributeValue
• attributeColumnType
• templateColumnValue
Formatting Helpers: formatString
• formatJSONString
• formatXHTML
• formatPrefixedXHTML
• formatDateTime
• formatDate
• formatTime
• formatURIComponent
CSV Output Helpers: csvSeparator
• formatCSVColumn
• formatBlockCSVColumn
• formatAttributeCSVColumn
• formatSystemAttributeCSVColumn
• formatCustomAttributeCSVColumn
Expression Helpers: eval
• and
• or
• not
• ifEqual
• var
• set
• get
• incr
• decr
Array & Map Helpers: array
• map
• setElement
• getElement
• deleteElement
• push
• pop
• size
• clear
• includes
• sort
• eachOfMap
Search & Replace Helpers: searchString
• searchRegexp
• replaceString
• replaceRegexp
Other Helpers: debug
• user
• repeat
Syntax: {{projectId}}
Description: Outputs the project ID for the exported document.
Syntax: {{#eachDocument [separator=<string>]}}
… {{/eachDocument}}
Description: Iterates all exported documents. You can optionally specify a custom separator string by separator
parameter.
Example: Output list of all exported document names separated by a comma:
Syntax: {{#eachOpenDocument [separator=<string>]}}
… {{/eachOpenDocument}}
Description: Iterates all open documents when exporting into a single file. You can optionally specify a custom separator string by separator
parameter.
Example: Output list of all open document names separated by a comma:
eachDocument
helper instead.Syntax: {{#withDocument <docId>}}
… {{/withDocument}}
Description: Sets the child context to the document with the given ID when exporting into a single file.
Example: Output document name for ID "NEEDS":
Syntax: {{exportOption <option>}}
Description:
{{exportOption "mergeDocuments"}}
— outputs a non-empty string if export option Export into a single file is checked{{exportOption "exportSection"}}
— outputs the name of a MS Word DOCX export section, see Export SectionsSyntax: {{exportParam <propertyPath>}}
Description: Gets a value from the custom export parameters JSON file provided in the Export Options dialog or via CLI. The propertyPath
argument can refer to any top-level property or a property in nested objects using the dot path notation.
Example Params File:
{ "textParam": "foobar", "number": 12345, "boolean": true, "nested": { "abc": "foo", "deep": { "def": "bar" } }, "array": [1, 2, "baz"]}
Example: Get value of textParam
property (“foobar“):
Example: Get value of deeply nested def
property (“bar“):
Example: Get value of array
property at index 2 (“baz“):
Example: Iterate over the array
property using the Handlebars built-in #each
helper:
<ul> <li></li></ul>
Syntax: {{docName [docId=<string>]}}
Description: Outputs document name of the current document or a document with the given document ID.
Example: Output name of SRS document:
Syntax: {{#eachDocumentObject [separator=<string>]}}
… {{/eachDocumentObject}}
Description: Iterates all document objects in the exported document. You can optionally specify a custom separator string by separator
parameter.
Example: Output list of document object IDs separated by a comma:
Syntax: {{isRTL}}
Description: Checks if the default text direction for the current document is RTL (right-to-left).
Example: Add appropriate dir
attribute and text-align
style to a heading tag containing the document name:
<h1 dir="rtl" style="text-align: start;"></h1>
Syntax: {{docObjId}}
Description: Outputs the object ID prefixed by the document ID.
Example: Display links as object IDs (strip document IDs using a regular expression).
Syntax: {{shortDescription [attribute=<attrId>] [maxLength=<number>]}}
Description: Outputs short text description (with stripped HTML) of the object attribute given by parameter attribute
. If attribute
parameter is not present then it outputs value of system attribute heading / text. You can specify the maximum number of characters by optional maxLength
parameter.
Example: Output object description from heading and text attributes shortened to 80 characters:
Syntax: {{sectionNumber}}
Description: Outputs section number as a plain text, for example “1.2.3”.
Syntax: {{isSection}}
Description: Returns true if the current document object has section, i.e. has the sectionNumber
.
Example:
Section:
Syntax: {{#section [numbering=<bool>] [shiftLevel=<number>]}}
… {{/section}}
Description: Generates a section heading block with proper style. If its optional parameter numbering
is true, then it also outputs the section number. Optional parameter shiftLevel
denotes the number of heading level shift.
Example: Output the section number followed by section heading and shift level by 1 to use <h2>
tag for the top level:
Syntax: {{indentation <number>}}
Description: Calculates indentation space from the object level in the document hierarchy. The argument provides the number of pixels per level.
Example: Indent a div
HTML tag by 10px per level:
<div style="padding-left:"></div>
Syntax: {{attributeValue <attrId> [format="string"|"xhtml"] [inherit=true]}}
Description: Formats the value of the given document object attribute. You can optionally provide output format (default is "xhtml") and enable inheritance of attribute value from its nearest parent if it is not set.
Example: Output the text value (for example, “Implemented”) of the status custom enumeration attribute:
Example: Output value of the text attribute converted to a plain string:
Tip: To check if an enumeration attribute (both single- and multi-valued) value matches, use the includes
helper.
Syntax: {{lastChangedOn [attrId]}}
Description: Returns the date and time of the last change of any of the document object’s attributes, or of a specified attribute when attrId
is present.
Example: Output the date and time of the last attribute change of a document object:
Example: Mark an object whose status attribute was last changed on or after 18 June 2019:
<b>Changed</b>
Syntax: {{#eachChild [separator=<string>]}}
… {{/eachChild}}
Description: Iterates the immediate children of the current document object.
Example: Output a comma separated list of child object IDs:
Syntax: {{hasChild}}
Description: Checks if the current document object has any child.
Example: Output IDs of all child objects:
<span></span>
Syntax: {{#eachAttachment}}
… {{/eachAttachment}}
Description: Iterates the attachments of the current document object. The child context contains the following properties:
Example:
<img src=""> <div><em>Image attachment:</em> </div> <div><em>File attachment:</em> </div>
Syntax: {{hasInlinks [linkTypeId]}}
Description: Returns true if the current document object has an inlink (resp. outlink). You can optionally provide a link type ID.
Example:
<span>OK.</span> <span>Missing satisfaction link!</span>
Syntax: {{#ifHasInlinks <linkTypeId>}}
… {{/ifHasInlinks}}
Description: Outputs the given block if the current document object has an inlink (resp. outlink) of the given link type ID. An else block can be optionally provided.
Example:
<span>OK.</span> <span>Missing satisfaction link!</span>
if
, hasInLinks
/ hasOutLinks
helpers instead.Syntax: {{countInlinks [linkTypeId]}}
Description: Returns the number of inlinks (resp. outlinks) of the current document object. You can optionally provide a link type ID.
Example:
Syntax: {{#eachInlinkType}}
… {{/eachInlinkType}}
Description: Iterates incoming (resp. outgoing) traceability link types for the current document object.
Example:
<div>:</div> <div> </div>
Syntax: {{#eachInlinkWith type=<typeId> [separator=<string>]}}
… {{/eachInlinkWith}}
Description: Iterates incoming (resp. outgoing) traceability links of type given by type
parameter. You can optionally specify a custom separator string by separator
parameter. Links are sorted the same way as in the displayed table view.
Example:
<span></span>
Syntax: {{#withParent}}
… {{/withParent}}
Description: Renders the given block with the parent document object context. The parent context is accessed even if the parent or the link to it is not visible.
Example: Get the ID of the object’s parent:
<div><em>Parent ID:</em> </div>
Example: Get IDs of parents of linked objects:
<div><em>Parent ID of linked object:</em> </div>
Syntax: {{#withParentLink}}
… {{/withParentLink}}
Description: Renders the given block with the parent document object context if parent links are displayed (Edit > Preferences > Show parent links).
Example:
<div><em>Parent:</em> </div>
Syntax: {{hasOriginInlink}}
Description: Returns true if origin links are displayed (Edit > Preferences > Show origin and inherited links) and if the given document object has an incoming (resp. outgoing) origin link.
Example:
Has CopiesIs Copy
Syntax: {{#eachOriginInlink}}
… {{/eachOriginInlink}}
Description: If origin links are displayed (Edit > Preferences > Show origin and inherited links), it iterates object’s copies.
Example:
<div><em>Copy:</em> </div>
Syntax: {{#withOriginOutlink}}
… {{/withOriginOutlink}}
Description: If origin links are displayed (Edit > Preferences > Show origin and inherited links) and the given document object is a copy, it sets child context to the original object.
Example:
<div><em>Origin:</em> </div>
Syntax: {{imageSize [maxWidth=<number>] [maxHeight=<number>]}}
Description: Outputs width
and height
attributes of <img>
HTML tag describing current attachment image size. You can optionally provide maxWidth
or maxHeight
parameters to rescale the image.
Example:
<img alt="" src="" />
Syntax: {{linkTypeName}}
Description: Outputs the name string of the current link type, for example “Satisfies”.
Syntax: {{#eachInlink}}
… {{/eachInlink}}
Description: Iterates traceability links of the current traceability link type for the current document object. Links are sorted the same way as in the displayed table view.
Example:
<div>:</div> <div> </div>
Syntax: {{#hyperlink}}
… {{/hyperlink}}
Description: If the link source (resp. target) document is included in the HTML export, then it creates an HTML a
tag around the inner block pointing to the link source (resp. target) object.
Example:
Syntax: {{#ifSuspect}}
… {{/ifSuspect}}
Description: Outputs the given block if the link is suspect.
Example:
!
Syntax: {{#eachColumn}}
… {{/eachColumn}}
Description: Iterates displayed columns of the table view.
Syntax: {{#eachDisplayedCustomAttribute}}
… {{/eachDisplayedCustomAttribute}}
Description: Iterates attributes displayed in the Custom Attributes column and sets context id, name, value, and rawValue properties to attribute ID, name, and formatted (resp. unformatted) value.
Example:
<div class="attribute"> <span>:</span> <span></span> </div>
Syntax: {{columnId}}
Description: Outputs column ID, for example “description”.
Example:
<tr> <th></th></tr>
Syntax: {{columnName [<colId>]}}
Description: Outputs column name of the current column in eachColumn
context or name of the given column if colId
argument is provided.
Example:
<tr> <th><strong>▲▼</strong></th></tr>
Syntax: {{columnProperty <propertyName>}}
Description: Gets a column property by its name.
Example: Output values in all columns:
<tr> <td></td> <td></td> </tr>
Syntax: {{isColumn <colId>}}
Description: Returns true if the current column matches the given column ID.
Example:
<tr> <td><a id=""></a></td> </tr>
if
, eval
, and columnId
helpers instead.Syntax: {{isAttributeColumn [type="custom"|"system"]}}
Description: Returns true if the current column is an attribute column. You can optionally check if it is a custom or a system attribute.
Syntax: {{isTemplateColumn}}
Description: Returns true if the current column is a template column.
Syntax: {{attributeColumnValue [format="string"|"xhtml"]}}
Description: Outputs value of the attribute corresponding to the current column. You can optionally provide output format (default is "xhtml").
Example: Output the value of the current attribute in XHTML format:
Example: Output the value of the current attribute converted to a plain string:
Syntax: {{columnAttributeValue [format="string"|"xhtml"]}}
Description: Outputs value of the attribute corresponding to the current column. You can optionally provide output format (default is "xhtml").
Example: Output the value of the current attribute in XHTML format:
Example: Output the value of the current attribute converted to a plain string:
attributeColumnValue
helpers instead.Syntax: {{attributeColumnType}}
Description: Outputs type of the attribute.
Example: Output the value of the current attribute in proper format with respect to its type:
Syntax: {{templateColumnValue}}
Description: Outputs value of the current template column.
Note: Scope of variables declared inside the template column is limited to this helper.
Example:
<tr> <td></td> </tr>
Syntax: {{formatString <string> [maxLength=<number>] [newlines=<bool>] [case="firstLower"|"allLower"|"firstUpper"|"allUpper"] [locale=<string>]}}
Description: Formats a value as a string (strips HTML tags). You can optionally provide the maxLength
parameter with a maximum number of string characters. If the optional parameter newlines
is true, then all p
, li
and br
end tags are replaced by line feed (\n
, 0x0A
) characters. The optional case
parameter allows case conversion of the first or all characters in the string to lower or upper case. To get the correct lower or upper case of language-specific characters, you can optionally use a IETF BCP 47 language tag as the locale
argument.
Example: Strip HTML from the text attribute and limit the result’s length to 20 characters:
Example: Convert the first letter of “istanbul” to upper case, passing in the Turkish locale to get the correct output “İstanbul”:
Syntax: {{formatJSONString <string>}}
Description: Formats a string value as a JSON string.
Syntax: {{formatXHTML <string> [paragraphClass=<string>] [charClass=<string>]}}
Description: Formats a value as XHTML. You can optionally provide paragraphClass
parameter with a paragraph class name for p
or div
tags or charClass
parameter with an inline class name for span
tag.
Example:
<div><b>Description</b>:</div><div></div>
Syntax: {{#formatPrefixedXHTML <string> [paragraphClass=<string>] [charClass=<string>]}}
… {{/formatPrefixedXHTML}}
Description: Formats a value as XHTML with a custom prefix given by the child block. You can optionally provide paragraphClass
parameter with a paragraph class name for p
or div
tags or charClass
parameter with an inline class name for span
tag.
Example: Output value of text attribute of the current document object. If heading attribute is not set, then insert the document object ID at the start of the first paragraph.
<span>[]</span>
Syntax: {{formatDateTime [<date>] [format=<format>]}}
Description: Formats a given date/time value (ISO 8601) or the current date and time if the value is not provided.
Use format
parameter to specify a custom date/time format according to ECMA-376 — Office Open XML file formats — Date and time formatting standard. ReqView supports the following formatting options:
d
— formats the day of the week or day of the month as a number without a leading zero for single-digit days,dd
— formats the day of the month as a two-digit number with a leading zero for single-digit days,M
— formats the month as a number without a leading zero for single-digit months,MM
— formats the month as a number with a leading zero for single-digit months,yy
— formats the year as a 2-digit number,yyyy
— formats the year as a 4-digit number,H
— formats the hour on a 24-hour clock without a leading zero for single-digit hours,HH
— formats the hour on a 24-hour clock with a leading zero for single-digit hours,h
— formats the hour on a 12-hour clock without a leading zero for single-digit hours,hh
— formats the hour on a 12-hour clock with a leading zero for single-digit hours,m
— formats the minutes without a leading zero for single-digit minutes,mm
— formats the minutes with a leading zero for single-digit minutes,s
— formats the seconds without a leading zero for single-digit minutes,ss
— formats the seconds as a two-digit number with a leading zero for single-digit seconds,am/pm
— formats the uppercase 12-hour clock indicator.The default is ISO date time format “yyyy-MM-dd HH:mm”, for example “2015-09-01 16:00”.
Example: Output the value of custom attribute createdOn in the common European format, for example “13.8.2015 14:20”.
Syntax: {{formatDate [<date>]}}
Description: Formats a date value (ISO 8601) as “yyyy-MM-dd”, for example “2015-09-01”. Outputs the current date if no parameter is provided.
Syntax: {{formatTime [<date>]}}
Description: Formats a time value (ISO 8601) as “hh:mm”, for example “16:00”. Outputs the current time if no parameter is provided.
Syntax: {{formatURIComponent <string>}}
Description: Formats a URI by escaping reserved characters their UTF-8 encoding.
Syntax: {{csvSeparator}}
Description: Outputs CSV separator set in the Preferences dialog.
Syntax: {{formatCSVColumn <value>}}
Description: Formats given value as a CSV column (escapes double quotes, line ends, etc.).
Example:
Syntax: {{#formatBlockCSVColumn}}
… {{/formatBlockCSVColumn}}
Description: Formats given value as a CSV column (escapes double quotes, line ends, etc.).
Example: Output IDs of all document objects linked to the current document object with verification link type.
Syntax: {{formatAttributeCSVColumn <attrId>}}
Description: Formats value of the given document object attribute as a CSV column.
Example: Output CSV value of heading system attribute:
Syntax: {{formatSystemAttributeCSVColumn <attrId>}}
Description: Formats value of the given document object system attribute as a CSV column.
formatAttributeCSVColumn
instead.Syntax: {{formatCustomAttributeCSVColumn <attrId>}}
Description: Formats value of the given document object custom attribute as a CSV column.
formatAttributeCSVColumn
instead.Syntax: {{eval <lvalue> <operator> <rvalue>}}
Description: Evaluates an expression given by three arguments — left value, binary operator and right value. The binary operator can be +
(add), -
(subtract),
*
(multiply), /
(divide), ==
(equal), !=
(not equal), <
(less), <=
(less or equal), >
(greater), >=
(greater or equal), &&
(logical and), ||
(logical or).
Example: Multiply value of severity, probability and detectability attributes in project risks document:
Example: Display warning if document object type attribute is set to “Req” and the document object has no incoming link:
<div><b>Warning:</b> Missing incoming link!</div>
Syntax: {{and <value 1> <value 2> … }}
Description: Evaluates logical and for two or more given arguments.
Example: Display names of all document object attachments. For each image attachments with href
property set display also the image.
<p><em>Attachment:</em> </p> <img src="" >
Syntax: {{or <value 1> <value 2> … }}
Description: Evaluates logical or for two or more given arguments.
Example: Output the full user story text created from asAn, iWant and soThat custom attributes for all document objects, which are user stories or constraints.
<p> <strong>[]</strong> <em>As a(n)</em> <em>I want to</em> <em>so that</em> .</p>
Syntax: {{not <value>}}
Description: Evaluates logical not for the given argument.
Example: Output the document object ID as the prefix of the text description for all document objects with text attribute set or without any children.
[]
Syntax: {{#ifEqual <value> <value>}}
… {{/ifEqual}}
Description: Compares two arguments and outputs the block only if both arguments are equal.
Example: Output document object ID only if value of type attribute equals to “Req” string:
<span></span>
if
and eval
helpers instead.Syntax: {{var <varId> <value>}}
Description: Declares a variable with the given ID and sets its initial value.
Example:
Syntax: {{set <varId> <value>}}
Description: Sets the given variable to the given value. The value should be of the same type as the initial value.
Example: Set value of variable x to the value of custom attribute estimate:
Syntax: {{get <varId>}}
Description: Outputs value of the variable with the given name. The helper can also be used to retrieve array contents when using the #each
block helper, see push
helper for an example.
Example: Output the initial value of variable x which is 0:
<div>x=</div>
Syntax: {{incr <varId>}}
Description: Increments value of the given number variable.
Example: Count number of document objects in c variable:
<div><b>Count:</b> </div>
Syntax: {{decr <varId>}}
Description: Decrements value of the given number variable.
Syntax: {{array <arrayId>}}
Description: Declares an array with the given ID.
Example:
Syntax: {{map <mapId>}}
Description: Declares a map (key-value store) with the given ID. Maps can also be used to emulate sets (collections of unique elements).
Example:
Syntax: {{setElement <arrayOrMapId> <element> <value>}}
Description: Sets the value of an element of an array or a map with the given name to the given value; element must be a string or a number and arrayOrMapId must be an array or map variable.
Example: Add/set the value of map x element with the key given by output of docObjId
helper (e.g. "SRS-123") to the value of document object attribute text:
Note that docObjId
is a template helper and must be enclosed in brackets.
Example: Add/set the element at index 0 of array x to the value of document object attribute text:
Syntax: {{getElement <arrayOrMapId> <element>}}
Description: Outputs the value of an element of an array or a map with the given name; element must be a string or a number and arrayOrMapId must be an array or map variable.
Example: Set the element of map x with key “id” to string “NEEDS-123” and then output the formatted value string:
<div>x.id=</div>
Example: Set the element of array x at index 0 to string “NEEDS-123” and then output the formatted value string:
<div>x[0]=</div>
Syntax: {{deleteElement <arrayOrMapId> <element>}}
Description: Deletes the given element of the given array or map. When used with a map, the element must be a valid key of the map. When used with an array, the element can also be negative to allow indexing from the end of the array (the last element is at index -1).
Example: Delete the element with key docObjId from map x:
Example: Delete the first element from array x:
Example: Delete the last element from array x:
Syntax: {{push <arrayId> <value>}}
Description: Adds the given value to the end of the given array.
Example: Output all elements of array x together with their indices:
<div>: <br /></div>
Syntax: {{pop <arrayId>}}
Description: Removes the last element from an array and returns that element.
Example: Remove and output the last element from array x:
Tip: To delete the last element without output, use the deleteElement
helper with -1 as the element parameter.
Syntax: {{size <arrayOrMapId>}}
Description: Retrieves the size of the given array or map variable.
Example: Output the length of array or map x:
Syntax: {{clear <arrayOrMapId>}}
Description: Clears the contents of the given array or map variable.
Example: Clear map or array x:
Syntax: {{includes <name> <value>}}
Description: Checks if an array includes a value, a map has a key or if an enumeration attribute (both single- and multi-valued) value matches. The name argument must be a name of an array or a map variable, or a name of an enum attribute in the current context.
Example: Print a note if multi-valued enumeration attribute components value includes “Server” component:
Server component supported
Example: Output a warning if map verLinks does not contain an element with the key given by output of docObjId
helper:
<div><b>Warning:</b> Missing verification link!</div>
Syntax: {{sort <arrayOrMapId> [sortByValue=<bool>] [locale=<string>]}}
Description: Returns a sorted copy of an array or map. The sorting algorithm is case-insensitive, diacritics-sensitive and sorts by numerical values of integers (decimal numbers must have fixed precision for the sorting to work). Maps are sorted by element keys unless sortByValue=true
parameter is provided. Optionally, to get the correct sort order of a specific language, you can use a IETF BCP 47 language tag as the locale argument.
Example: Output sorted elements stored in array x:
<div>: <br /></div>
Example: Output key-value pairs stored in map x sorted by key:
: ;
Example: Output key-value pairs stored in map x sorted by value:
: ;
Example: Sort array x using the Swedish locale, where “ä” sorts after “z”:
<div>: <br /></div>
Syntax: {{#eachOfMap <mapId>}}
… {{@key}}
… {{@value}}
… {{/eachOfMap}}
Description: Iterates all elements of the given map in the original insertion order of the keys.
Example: Output all elements of map x in “<key>: <value>” format:
: ;
Example: List 3rd level requirements (e.g. software requirements) associated with the current 1st level requirement (e.g. a stakeholder need) while preventing duplicate entries:
<div><em>:</em> </div>
Note that you may need to clear the satLinks map by {{clear "satLinks"}}
before it is reused in the context of another document object.
Syntax: {{searchString <string> <string>}}
Description: Searches a string given by the first argument if it contains a substring given by the second argument.
Example: Returns true if text attribute of a document object contains “shall” substring:
Syntax: {{searchRegexp <string> <pattern> [flags=<string>]}}
Description: Searches a string given by the first argument if it matches a regular expression pattern given by the second argument. You can optionally provide flags parameter for the regular expression.
Example: Returns true if text attribute of a document object matches “shall” keyword with ignoring case:
Syntax: {{replaceString <string> <string> <string>}}
Description: Returns a string given by the first argument with replaced substring given by the second argument by a string given by the third argument.
Example: Output a string with replaced “shall” substring in text document object attribute by "<b>shall</b>":
<div></div>
Syntax: {{replaceRegexp <string> <pattern> <string> [flags=<string>]}}
Description: Returns a string given by the first argument with pattern given by the second argument replaced by a string given by the third argument. You can optionally provide flags parameter for the regular expression.
Example: Output a string with replaced all occurrences of the keyword “shall” in text document object attribute content by "<b>shall</b>":
<div></div>
Syntax: {{debug}}
Description: Outputs information about properties available in the current context.
Example: Output debug information about all set document object attributes (heading, text, …):
<!-- -->
Syntax: {{#user}}
… {{/user}}
Description: Outputs the name, email or company of the current user.
Example:
<a href="mailto:">, </a>
Syntax: {{#repeat <number>}}
… {{/repeat}}
Description: Repeats the block content a specified number of times. Provides @index
, @first
and @last
variables.
Example: Output all array elements in reverse order:
Example: Output sequence [1, 2, …, 5] using @…
variables:
[ ] ,
Example: Iterate across two dimensions using parent context:
X: , Y:
This section provides some examples of complete custom export templates. To get started, download the sample export templates from the Download Export Templates section.
The following template outputs the current document as an HTML table with Id, Description and Status columns:
<table id="reqsTable"><thead><tr> <th>ID</th><th>Description</th><th>Status</th> </tr></thead>
<tbody><tr> <td></td> <td> <div> <img src=""></br> <em>Image attachment:</em> <span></span> <em>File attachment:</em> <span></span> </div> </td> <td></td></tr></tbody></table>
The following template outputs a combination of section headings and informative paragraphs using a HTML book layout, and a list of requirements using a HTML table layout with "ID" and "Requirement" columns.
HTML report: Example output of the template for the SRS document of the Example Project.
HTML template:
</tbody> </table>
<table> <thead><tr><th style="width:8em">ID</th><th style="width:40em">Requirement</th></tr></thead> <tbody> <tr> <td><a id="" name=""></a>.</td> <td></td> </tr>
Note: The template demonstrates how to use Handlebars inline partials to reuse template code.
The following template outputs a traceability matrix for satisfaction links as an HTML table with two columns ID and Links.
<ul> <li>
</li> </ul>
<table id="reqsTable"> <thead><tr> <th>ID</th><th>Links</th> </tr></thead> <tbody> <tr> <td></td> <td></td> </tr> </tbody></table>
Note: The template demonstrates how to use Handlebars inline partials recursively to output a traceability coverage across several levels.
You can easily create a HTML export template generating a traceability report with a custom layout, for example exploring which functionality has missing tests and which functionality has been verified by passed tests.
Let’s check a concrete example of a top-down traceability report displaying the highest-level business needs (NEEDS) satisfied by detailed functional requirements (SRS) verified by test cases (TESTS) for the Example Project.
HTML report:
Preview of the HTML template:
HTML template snippet rendering the Traceability column:
<ul> <li> <span>-: </span> <span></span> <ul> <li> <span>-: </span> <span></span> </li> </ul> </li> </ul>
The snippet first uses eachInlinkWith
block helper to iterate all incoming satisfaction traceability links of the given NEEDS user story. For each such link, it renders a SRS requirement ID, a short description (heading or text attributes) and the value of the status custom attribute.
Still in the context of the linked SRS requirement, the snippet analogically uses eachInlinkWith
helper to iterate all incoming verification links. For each TEST object it renders a test ID, a short description, and the value of the status custom attribute.
You can filter requirements and export a traceability report displaying their context in the V-model using a table layout.
HTML report:
The template output for the Example Project with filtered functional requirements (SRS) "ID: 53".
HTML template snippet:
<table> <tbody> <tr> <td> <p><strong>User Needs</strong>:</p> <p>: </p> </td> </tr> <tr> <td class="table-primary"> <h3>SW Requirement</h3> <p><strong>ID:</strong> </p> <p><strong>Description:</strong> </p> </td> <td> <p><strong>Tests</strong>:</p> <p>: </p> </td> </tr><tr> <td> <p><strong>Design Elements</strong>:</p> <p>: </p> </td> </tr> </tbody> </table>
The following template outputs HTML to be easily imported into MS Word with book layout containing id, heading, text system attributes, displayed custom attributes and attachments.
<!DOCTYPE html><html lang="en-US"><head> <meta charset="utf-8"> <title></title></head><body> <a name="" id=""></a> <span class="id">[]</span> <p class="attachment"> <span class="attachmentInfo">Attachment:</span> <a href=""></a> <br><img src="" > </p> <div class="attribute"> <span class="attributeInfo">:</span> </div> </div></body>
Note: The HTML template contains the document content marked with HTML tags containing class names without any CSS styling.
This allows easy customization using predefined Word styles in a MS Word template in which the exported HTML is inserted. For more information, see Import Into MS Word.
The following template outputs a single HTML file containing id, heading and text attributes of document objects from all exported documents.
<!DOCTYPE html><html lang="en-US"><head> <meta charset="utf-8"> <title></title></head><body><h1></h1><hr><hr> <h1></h1> <hr> <a name="" id=""></a> <span class="id">[]</span> </body>
If you wish to output only specific documents, have a different layout for each document or change the order of documents, use multiple {{#withDocument docId}}
blocks within the same template file.
The following sample template outputs a CSV file with values of id, heading, text, and status document object attributes. The tildes (~
) are used for trimming whitespace in order to not break CSV format.
"id""heading""text""status" }} }} }} }
The following sample template outputs a JSON file with values of id, section, heading, and text document object attributes.
[ { "id": , "section": , "heading": , "text": }]
An XML file structured as below:
<doc id="D"> <section id="1" title="Heading 1"> <section id="1.1" title="Heading 2"> <clause text="Text 1"/> <clause text="Text 2"/> </section> <section id="1.2" title="Heading 3"/> <section id="1.3" title="Heading 4"/> <clause text="Text 3"/> </section> <section id="2" title="Heading 5"/> ...</doc>
can be produced by the following sample template. An array is used as a stack to ensure that all tags are closed correctly. Post-processing by an XML formatting tool is recommended.
<doc id=""> <section id="" title=""> <clause text=""/> </doc>
Predefined HTML Templates:
You can download and reuse predefined templates for Export Documents to HTML:
Predefined PDF Templates:
You can download and reuse predefined templates for Export Documents to PDF:
Example Traceability Templates:
You can download and reuse custom export templates for traceability reports designed for the Example Project: