Versum Syntax and Object Representation

Versum is a narrative scripting language derived from Markdown, having narrative structures inspired in Ink.

This document describes the Versum Syntax and the respective translation of each expression to the respective Versum Object Representation, which is a Javascript representation of a Versum document, produced by the Harena Translator.

The Versum Object Representation is used by the Harena Authoring and Player environments to edit and interpret the scripts. The translator also uses this representation to generate HTML rendered in the browser.

Reference to build regular expressions: MDN Regular Expressions. Regular expressions checked through RegExr. Regular expression images generated by Regulex.

Case

Layer

Markdown to Object

Knot

Markdown to Object

## [title] ([category],..,[category]): [inheritance] ##

or

=====
[title] ([category],..,[category]): [inheritance]
=====

Annotations

Context

Context Close

Annotation

Elements

Text

Object to HTML

<unprocessed content in markdown>

This content is further converted to HTML by the compiler.

Blockquote

Markdown to Object

Object to HTML

If it is not subordinated, it is transformed into an HTML blockquote.

Image

Markdown to Object

Object to HTML

<img src="[path]" alt="[title]">

Media

Markdown to Object

Object to HTML

<video><source src="[path]"></video>
<audio><source src="[path]"></audio>

Option

Markdown to Object

Object to HTML

<dcc-button id='dcc[seq]'[author] type='[subtype]' topic='knot/[target]/navigate' label='[display]'[message][image]></dcc-button>

Item

Markdown to Object

If one item succeeds a field and the field has an aggregator item, the item is embedded to the field.

Field

Markdown to Object

Fields are grouped according to the subordination, i.e., if one field B succeeds another field B and B has a level of subordination greater than A, B becomes a field of the value of A.

Object to HTML

<unprocessed content in markdown>

This content is further converted to HTML by the compiler.

Divert

Markdown to Object

Object to HTML

<dcc-button id='dcc[seq]' topic='knot/[target]/navigate' label='[display]'></dcc-button>

Divert Script

Markdown to Object

Object to HTML

-> [target] "[parameter]"

Entity

Markdown to Object

Object to HTML

<dcc-entity id='dcc[seq]' entity='[entity]' image='[path]' alternative='[alternative]' title='[title]'>
  [speech]
</dcc-entity>

Mention

Markdown to Object

Object to HTML

<b>[character]</b>

Input

Markdown to Object

Object to HTML

Standard

<dcc-input id='dcc[seq]' variable='[variable]'[rows][vocabularies]>
</dcc-input>

Group Select subtype

<dcc-group-select id='dcc[seq]' [author] context='[context]' input='[input]''>
<dcc-group-select id='dcc[seq]' [author] variable='[variable]' states='[state],...,[state]' labels='[label],...,[label]'>
</dcc-group-select>

Output

Markdown to Object

Object to HTML

<dcc-expression expression='[variable]'></dcc-expression>

Compute

Markdown to Object

Object to HTML

<dcc-compute expression='[expression]'></dcc-compute>

Select Context

– Open

Markdown to Object

Object to HTML

no HTML

– Close

Markdown to Object

Select

Object to HTML

<dcc-state-select id='dcc[seq]'>[expression]</dcc-state-select>

Line feed

Object to HTML

Each line feed is converted to <br>

Component

Defines a component (Digital Content Component - DCC). Besides the DCC type and id, the sentence can specify attributes and/or content inside it. Id and attributes/content are optional, but it must have one of them.

[type | id][[
  * attribute: value
  * attribute: value
  ...
  content
]]

or

[type | id][["content";attribute:value;attribute:value;...]]

If the format is horizontal, the content must be between quotation marks.

Expression to recognize attributes and distinguish them from content.

Vertical: ^[ \t]*[\+\*][ \t]+([\w-]+)[ \t]*(?::[ \t]*([^\n\r\f]+))?$

Horizontal: (?:^|;)[ \t]*([\w-]+)[ \t]*(?::[ \t]*(?:"([^"]*)"|([^"][^;]*)))?

Object to HTML

<[DCC type] id="[id]" [attribute name]="[attribute value]"...>
  [content]
</[DCC type]>

Connection

A connection between two components (DCCs), specifying which is the triggering event and the topic sent to the target.

[id source] =trigger|topic=> [id target]

or

=trigger|topic=> [id target]

Object to HTML

<connect-dcc from="[from]" trigger="[trigger]" to="[to]" topic="[topic]">
</connect-dcc>
<subscribe-dcc target="[to]" topic="[trigger]" map="[topic]">
</subscribe-dcc>