Writing Your First Obojobo Document
Structure Concepts
The OboXML Document structure has certain concepts that are valuable to know before you get started.
Conceptually, the document’s structure follows a certain pattern looking something like this:
Module
Sections
Pages
Chunks
ObojoboDraftDoc
All OboXML documents should have a singular outer <ObojoboDraftDoc>
element.
<ObojoboDraftDoc>
<!-- Insert Imagination here -->
</ObojoboDraftDoc>
Module Tag
Within our ObojoboDraftDoc, there is always a <Module>
element. You can define the title
attribute for your entire module.
<ObojoboDraftDoc>
<Module title="My Module">
</Module>
</ObojoboDraftDoc>
Content and Text
Add some text to the Content section. A <Content>
, <Page>
, <p>
(paragraph), and the text itself will be added into the Module
Notice the <p>
paragraph tag has been adopted from standard HTML. Obojobo supports a number of regular HTML tags for text described in the Text Content Conventions.
<ObojoboDraftDoc>
<Module title="My Module">
<Content>
<Page>
<p>Hello World!</p>
</Page>
</Content>
</Module>
</ObojoboDraftDoc>
Id Attributes
All OboNodes support an id
attribute, though they can usually be omitted.
You’ll only need to manually define an id for use in custom actions or triggers. Below we’ll add an id
to our page so we can link to it later.
<ObojoboDraftDoc>
<Module title="My Module">
<Content>
<Page id="my-special-page-1">
<p>Hello World!</p>
</Page>
</Content>
</Module>
</ObojoboDraftDoc>
Navigation Menu
Obojobo will automatically generate the navigation based on content. You can control the contents of the menu using the following values and attributes.
-
Page uses the
title
attribute. - Heading uses the tag’s contents.
-
Assessment gets a default value of “Assessment”, but can be changed using the
title
attribute.
As an exception any Heading OboNodes which are the first child in a Page are omitted. This allows you to include a level 1 heading at the top of the page and avoid having duplicate entries in the nav (one for the page title and another for the contents of the heading)
The following menu will be generated by the XML below it. Note that the sub-page navigation items are only expanded when that page is being viewed.
<ObojoboDraftDoc>
<Module title="My Module">
<Content>
<Page title="Page 1">
<h1>Page 1</h1>
<h2>H2 Title</h2>
<p>...</p>
<h2>Another H2 Title </h2>
<p>...</p>
</Page>
<Page title="Page 2">
<h1>H1 Title</h1>
<h2>H2 Title</h2>
<p>...</p>
</Page>
</Content>
<Assessment>
<Page></Page>
<QuestionBank></QuestionBank>
</Assessment>
</Module>
</ObojoboDraftDoc>
Short and Long Node Names
It’s worth noting this article shows short node names in the examples.
Obojobo is built to be extended, which could potentially leading to naming conflicts. In the rare case where one would need to avoid naming collisions, the fully qualified longer version of their names may be used.
Here’s an example of the Hello World! document with fully qualified node names:
<ObojoboDraftDoc>
<ObojoboDraft.Modules.Module title="My Module">
<ObojoboDraft.Sections.Content>
<ObojoboDraft.Pages.Page id="my-special-page-1">
<p>Hello World!</p>
</ObojoboDraft.Pages.Page>
</ObojoboDraft.Sections.Content>
</ObojoboDraft.Modules.Module>
</ObojoboDraftDoc>