Content Modifications and Previews (cont)
This chapter will contain the following task descriptions:
- create TOC in assembly tool, save, add it, see it
- add an applet, see it rendered
Task cont-1: Add first content and see it
The goal of this task is to perform a first content modification and see the content updated in one’s ActiveMath. This is half a sanity test.
Prerequisite
create-a-collection
Applications That Should be Running
jEditOQMath, ActiveMath, web-browser
Task description
- go to jEditOQMath, in the file first.oqmath
- find a CMP element, for example the hello-world axiom
- inside this element, between and type a rare word or two
(say, Möbius)
- let us add a few a exotic characters as well: type the sequence of
letters D e l t a followed by C-; (edit > expand-abbreviation). You
should see a capital delta letter, a triangle.
- save (press C-S or press the pencil toolbar-button)
- validation happens, verify there’s nothing to complain about in the
status bar (“XML parsing complete, 0 error(s)”).
- if not, you have introduced illegal characters or at illegal
places, undo a few times then re-insert without “<”, “&” and “>”.
- open the AntFarm tab (the top tab on the left-side-bar of the jEdit
window)
- inside there, find an item called “fancy-surfaces collection,
ActiveMath build file”
- double click this item, or click it once then click the running man
- (we are compiling and publishing, more about this in build-process)
- see the operation happening in the “console”, ensure it says “build
successful”
- go to your browser, open / http://localhost:8080/
- see your collection’s automatic book, open it, see your text and the
Delta there
- click the search link in the top tool menu
- type one of the rare words.
- see the title of the hello-world axiom, click it and see the same
Task cont-2: add-search-see: add an item, find it, see it
This task is about adding a new item, finding it in the search tools and previewing in different ways.
Prerequisite:
Task steps
- go to jEditOQMath, in the file first.oqmath
- place the cursor just before the line indicating
</theory>
- open the Templates Tree tab (see it on the left of the window, will
replace AntFarm)
- insert an axiom:
- your selection should now be the id, put there
my-first-axiom
- press C-S-g (control-shift-G on Windows, command-shit-G on MacOSX)
- (or click the find next button on the right of the toolbar, or
invoke OQMath > Go to next template zone)
- your selection should now be thte title, type
my first axiom
- remove the whole part between
<extradata> and </extradata>
- press C-S-g again
- your selection should be the text, insert
We have decided all
graphs are trees
- now save the file (C-S, pencil button, File > Save)
- wait a bit to see if it indeed says XML parsing complete, 0
error(s)
- if you have some errors, please open the “Error List” tab on the
top and try to fix them
- click the AntFarm tab on the left
- select collection, ActiveMath Publishing build file
- press the running man
- wait till it says
BUILD SUCCESSFUL (really do! using the browser
aside may corrupt ActiveMath to the point that it needs to be
restarted)
- go to your browser
- open the book Complete Recbook
- see your axiom there
- click the search tool (on the top list of tools)
- type in
decided lang:en
- (you are searching for the word decided in english)
- you should find your axiom
- type in
decided lang:fr
- you should not find anything
- request more display
- request appears in
- click the book it appears in
Task cont-3: new-OQMath-new-page: create a new document, see second page
This task is about adding a items in a new document, and seeing it appear in the automatically generated book.
Prerequisite:
Task steps
- applications on: jEditOQMath, ActiveMath, web-browser
- in jEditOQMath, having first.oqmath opened, invoke File > New
(C-N)
- activate the templates tab (on the left)
- click (once) the new OMDoc or OQMath
- save it right-away, let’s call it second.oqmath, it should be in
the same directory as
first.oqmath
- syntax coloring should appear after having saved
- now navigate between the template zones and complete the individual
zones as good seems you
- save the document (File > Save) and verify that XML parsing
complete, 0 error(s) appears in the status bar, fix the errors
otherwise
- open the Ant-Farm tab on the left, and double click
collection, ActiveMath Publishing build file
- maybe ignore the errors for now
- go to ActiveMath in the browser
- simply do a reload of the page of the book, pressing the reload
button of the browser
- the second page should appear as a link in the table of contents,
… and should be openable
Task cont-4: add a picture in OQMath, see it rendered
This task is about adding, within an item of an OQMath document, a picture and its declaration.
Prerequisite:
Task steps
TO BE COMPLETED
- download a picture of your choice into the directory
pics of the collection you created, name it appropriately. If unsure, download the picture the logo file and name it logo.jpg
- open the file
first.oqmath resulting of the collection creation
- move your cursor into a space between
<CMP> and </CMP> (and not between two dollar signs)
- make sure the templates tab (on the left) is opened
- click once Image Declaration to insert the
<private/> element
- insert id
logo in the first template zone
- correct the path before the next template zone from
MinePics to mycollectionPics (if mycollection was the collection name (this path is a web-path, relative to the URL/ActiveMath2/main/book.cmd)
- similarly change the
mine to mycollection (or so) and put logo.jpg as file name.
the result should like:
<private id="logo">
<data format="html" href="../mycollectionPics/logo.jpg"/>
<data format="pdf" href="./content/mycollection/pics/logo.jpg"/>
</private>
<omlet argstr="logo" type="image" action="display">
the activemath logo
</omlet>
then invoke the template Image Use and fill the ID as logo and the caption to the appropriate text
- now open the tab
Ant Farm select the document _mycollection All Documents` then click the running man
- make sure this process is terminated, saying “BUILD SUCCESSFUL”
- go to the first page of the book we created
- see the picture.
Comments and variations
- we have put the picture declaration (the
<private> element) at the same place as the <omlet/> element. It is possible to relax this and put the private anywhere else as long as it can be referenced
Task cont-5: create a table-of-contents in assembly tool, configure it, see it
The goal of this task is to create a table-of-contents, configure it in one’s own collection, and see it.
Prerequisite
Applications That Should be Running
jEditOQMath, ActiveMath, web-browser,
assembly tool (started here)
Task description
- go to ActiveMath with the web-browser
- login as a user (registering if need be)
- invoke the menu Tools > Assembly Tool
- this will download a JNLP file which will start the application Assembly Tool first requesting your trust
- you are now in front of a blank table-of-contents, free for you to edit
- invoke _Edit > Add section _
- now use your browser to go with ActiveMath to see some content from books
- having found an item drag-and-drop the link of their title from the browser till the assembly tool within the section
- repeat this for a few items
- make sure that the items appear below the section you just created (you can double click them to view them)
- the book can be seen within your books:
- invoke File > upload book
- go to the ActiveMath main menu
- click the book with the title [Title]
- the book can also be saved into your collection:
- in the assembly tool, invoke _File > Save _
- navigate to the directory
oqmath you created in the new collection
- name the file assembled-book.oqmath
- saving them in oqmath directory and naming it with the suffix .oqmath ensures that this file is part of the sources
- go to jEditOQMath, open the file assembled-book.oqmath
- you obtain, after some time, a validation error indicating it cannot find the declaration of the element omd:omdoc, for a good reason, this file is without document-type hence cannot be validated
- you can keep working with this file or, to make it more readable, invoke, OQMath > Clean up OMDoc
- depending on the elements you dragged (any URLs can be dragged inside the assembly tool), you might obtain a few validation errors, removing the guilty elements is a way to live in peace, alternatively you ignore these errors (but… not the others!)
- spot the first
omgroup element, it will have an id attribute that is dynamically generated, adapt its value for you to remember it, e.g., assembled-book.
- now open the collection’s content-descriptor (e.g.
ContentDescr_my-collections.properties) which is in the directory containing the oqmath directory
- find a few lines which start with RecBooks is, below them insert the following line:
RecBooks.my-assembled-grouping.ID = mbase://<my-collection>/assembled-book
having replaced <my-collection> with the identifier of your collection. If you are not sure it may be worth to use the searchable-item-list to check it before.
- open the AntFarm tab on the left, select the build-file of your collection and press the running man
- shut-down ActiveMath
- recopy the content-descriptor into the
conf directory inside ActiveMath (unless it was linked)
- start ActiveMath
- you should see your new recorded-book as any user (even anonymous)
- note: the assembly tool can further edit the file
assembled-book.oqmath (make it accept all files) but it will revert to namespace-full, using clean-up-omdoc again might be worth it.