The PDF version of this tutorial is available at: http://downloads.syntext.com/serna-docs/serna-tutorial.pdf
Table of Contents
Table of Contents
This tutorial is for anyone who wishes to grasp the main functionality of Syntext Serna to be able to create, edit and maintain XML documents using this WYSIWYG XML content editor. Whether you are a technical writer, a project manager or a developer facing the need of XML authoring, you are welcome to discover what Serna has to offer.
Don't just read the tutorial but actually try the stuff, put the things into practice.
Before going any further, make sure you do understand:
What Serna is. A WYSIWYG editor, almost like a conventional word processor. Serna was designed for WYSIWYG document presentation: XML documents can be viewed in print-like appearance without even XML markup tags, if you wish. So when you find yourself desiring to switch to the tag mode or to pure XML code mode, please be aware that there should be an easy way of handling the same use-case in the WYSIWYG mode.
What Serna is not. Not an XML development environment. You will not find it convenient for coding, say, XSL stylesheets or XML schemas. The nice appearance of XML documents like DITA, Docbook and TEI is exactly what Serna was written for.
Let's run Serna and open an XML document in it:
Once you install Serna and run it for the first time, you'll see the Examples Dialog.
The examples are XML documents. Double click, say, Simple Docbook Example and this Docbook document will be opened in a second.
Serna has guessed the type of the document and opened it with an appropriate XSL stylesheet, XML schema, and encoding. We have avoided the common tiresome procedure of manual assigning of XML stylesheet and XML schema to apply. This is so helpful, isn't it?
Let's create our own simple document:
Choose -> to call the New Document Dialog.
Choose one of the offered categories for the new document. Let it be Docbook V4.5 . Click on it and then select a template. Let it be Article . Click .
Here is what you see:
We've just chosen article
as the root element and it has been inserted automatically. Note that root elements can't be renamed, our article will stay the article. Give it some title:
Click right after
"Title:"
to move the cursor there.
Type the title, say, "
My Article
".
Now we can add more and more elements. Before we do this, it should be mentioned that thanks to the on-the-fly XML Schema validation in Serna, you constantly work with valid, consistent documents. This means you are offered and allowed to insert only valid elements at valid positions not to spoil the structure of the document.
You must have noticed the green Choose
element , don't be shy to click it. These green
Choose
elements appear whenever the insertion of an element is required.
What you see now is the Insert Element Dialog offering you a list of possible elements one of which you must choose. Scroll the list, the elements are in alphabetical order. Select section
.
Click one more green Choose
element that appears. In the Insert Element Dialog, select the title
element from the list.
The cursor is blinking inside the newly inserted title
element. Type "
My Section
" there.
Click one more green Choose
element that appears. In the Insert Element Dialog, select the para
(paragraph) element from the list.
The cursor is blinking inside the newly inserted para
element. Let's type there the lines from a popular British nursery rhyme:
This is the cow with the crumpled horn That tossed the dog that worried the cat That killed the rat that ate the malt That lay in the house that Jack built.
Para
element allows only one consecutive blank, so we'll have to make a separate para
for each line of the rhyme: when you have typed a line and need a new para
, simply press the Enter key.
You can see that no more Choose
elements appear. This means you are free to decide whether to insert more elements or not.
Let's add an image to our document right after the poem:
Look at the
ContentMap
pane in the left part of Serna window: you can see the current tree structure of the document. The
ContentMap
shows elements as well as places where you can insert more elements. Click the empty branch right after the last para
.
This is where we'll insert the image. Let's do it using the
button. Find the button on the toolbar, it looks like this
. Actually, many commands can be executed through associated hot keys. So if you like, to insert an image you can just hit Ctrl+Alt+G.
Now browse for an image and open it.
In this example, we used the ContentMap to indicate the position for the image. Actually, you can position the cursor in the editing window as well.
This is what we've got by now:
Let's experiment now a little. The elements can have attributes and you can edit them. For example, let's align the image to the left:
Right-click on the image and select the item from the context menu.
In the Attributes Dialog, find the align
attribute, change its value to left
and press Enter. The image will be aligned to the left.
To continue our experiment, let's change the language of the article
from English to German:
Right-click on the article
element in the ContentMap and select the
item from the context menu.
In the Attributes Dialog, click the
Add Attribute
button and select the
lang
attribute.
Type the de
value and press Enter.
Here is what we have as the result of the experiment:
Now let's undo the last two operations: the image alignment and change of the language. Hit Ctrl+Z twice. To save the document, hit Ctrl+S.
So, what have we got now? We have the para
s and the graphic
inside the section
of the article
. This is the house that Jack built. But that's not all!
Let's publish our document with Serna out-of-the-box:
Choose -> .
In the Publish Dialog we can specify the output format - HTML or PDF, and some other parameters. Let's generate an HTML file.
Click and wait until the script ends.
If you view the generated file in a browser, it will look like this:
It was a piece of cake, wasn't it? You have learnt to create a document in Serna from scratch, perform basic editing and publish documents for final presentation. Further chapters of the tutorial will deal with different aspects of XML authoring in Serna in greater detail.
Table of Contents
Let's consider the main parts of Serna GUI. If you have taken the steps of the the section called “Quick Start”, you must already be more or less acquainted with it. If you've just run Serna, open some XML document in it.
The main parts of Serna GUI are:
Menus. The menus are located at the top of the program window. They contain all the commands necessary for creating, editing and publishing documents.
Toolbars. The toolbars are normally located under the menus. However, they can be moved to other positions or even hidden. All the commands performed through the toolbar buttons can also be performed through the menus.
ContentMap Pane. The ContentMap is the pane at the left side of the program window. It displays the tree structure of a document: the elements and positions between them. You can navigate a document and perform editing right in the ContentMap. To hide/show the ContentMap, click the button at the bottom of the program window.
Editing Window. The Editing Window is the part of the program window where you can edit your document and actually see it with all the changes in real time.
Document Tabs. The document tabs are located at the bottom of the program window. Click them to switch between several opened documents.
To see how navigation, cursor positioning and selection work in Serna, we'll use Quick Start Interactive Example :
Choose -> .
In the Examples Dialog, double-click Quick Start Interactive Example .
You can navigate the document through both the Editing Window and the ContentMap using mouse clicks, arrow keys, hot keys and command menus.
Let's navigate our document in the Editing Window. Meanwhile, please note that the ContentMap is going to be in sync with the cursor position in the Editing Window.
When you open the document, the cursor is at the very beginning of the document. If it is not so, click there or use Ctrl+PageUp.
Next/Previous Position.
Let's move a position to the right. Press the RightArrow key.
To move to the next/previous position, press the RightArrow/LeftArrow key.
Next/Previous Word.
Let's move to the next word. Press Ctrl+RightArrow.
To move to the next/previous word, press Ctrl+RightArrow/Ctrl+LeftArrow.
Next/Previous Line.
Let's move a line down. Press the DownArrow key.
To move to the next/previous line, press the DownArrow/UpArrow key.
Line Start/End.
Click the line with "1. Preface
" text.
Let's move to the beginning of the line. Press Ctrl+A.
Let's move to the end of the line. Press Ctrl+E.
To move to the start/end of the current line, press Ctrl+A/Ctrl+E.
Next/Previous Element.
Let's move to the next element. Press Ctrl+DownArrow.
We have moved from the title
element to the position between title
and para
.
To move to the next/previous element, press Ctrl+DownArrow/Ctrl+UpArrow.
Element Start/End.
Since we are between the title
and para
of a sect
(section), the sect
is the current element. Let's move to the end of the sect
. Press Ctrl+End.
We have moved to the end of the sect
(section).
Click the para
element.
Let's move to the end of the para
element. Press Ctrl+End.
To move to the start/end of the current element, press Ctrl+Home/Ctrl+End.
Page Up/Down.
To move a page up/down, press the PageUp/PageDown key.
Document Start/End.
To move to the start of the document, press Ctrl+PageUp.
To move to the end of the document, press Ctrl+PageDown.
Next Choice.
If your document has green Choose
elements, you can go to all occurrences of such elements pressing Ctrl+Alt+Enter. Since there are no such elements in our document now, let's add a Choose
element at the end of the document:
Press Ctrl+PageDown to go to the end of the document.
Press Ctrl+Enter to call the Insert Element Dialog.
In the Insert Element Dialog, you are offered just one element - sect
. Press Enter.
The sect
with the green Choose
element will be inserted.
Now let's see how moving to the next choice works:
Press Ctrl+Alt+Enter.
The cursor moves to the next Choose
occurrence and the Insert Element Dialog is called.
Generally, if there are more Choose
elements in your document, press Ctrl+Alt+Enter to go to the next Choose
element, and so on.
Above, we used hot keys to navigate the document. However, in some cases you can use the
menu, namely:To move to the next/previous element, select
-> / .To move to the start/end of the element, select
-> / .To move to the next Choose
element, select -> .
Let's navigate the document via the ContentMap.
Click the doc
root element in the ContentMap. The cursor in the Editing Window will be moved to the corresponding place.
Click any other element or an empty branch in the ContentMap, and the cursor in the Editing Window will be moved to the corresponding place.
Next/Previous Item.
Press the DownArrow key and see the highlight travel down the tree structure.
Press the UpArrow key and see the highlight travel up the tree structure.
When an element is highlighted in the ContentMap, to move the cursor to the same element in the Editing Window press Enter.
Element Start/End.
To move to the start/end of the current element, press Ctrl+Home/Ctrl+End.
Particular Element Occurrences.
Let's go to all occurrences of the "Preface" title
element:
Find the "Preface" title
element in the ContentMap and click it.
The cursor will be moved to the first occurrence of the element in the Table of Contents.
Click the "Preface" title
element in the ContentMap once more.
The cursor will be moved to the second occurrence of the element in the document.
To go through all occurrences of a particular element in the document, find the element in the ContentMap and keep clicking it.
Page Up/Down.
To move a page up/down in the ContentMap, press the PageUp/PageDown key.
Document Start/End.
To move to the start/end of the document in the ContentMap, press the Home/End key.
Focus Shift. Generally, when you navigate the document via the ContentMap, the focus stays in the ContentMap and you can't enter text in the Editing Window.
You can switch the input focus from the ContentMap to the Editing Window explicitly:
To move the focus from the ContentMap to the Editing Window, press F3.
To move the focus back from the Editing Window to the ContentMap, press F2.
You can also enable the automatic input focus shift from the ContentMap to the Editing Window:
Click the button in the ContentMap pane to enable the automatic focus shift.
Click some element in the ContentMap. The input focus is set to the Editing Window automatically so that you can enter text there.
The Content Map can also be used for document editing. We'll talk about it in more detail in the section called “Selection in ContentMap” and the section called “Working with Elements and Attributes in ContentMap”.
As you navigated through the document, you must have noticed the context hints, the yellow and green tags with frames that appear for some time and disappear. These tags and frames tell you where the elements close to the position of the cursor start and end.
The context hints usually last for a couple of seconds but you can make them persistent:
Choose
-> .In the Preferences Dialog, choose the General Tab.
On the Context Hints pane, check the Persistent checkbox.
To disable the context hints, uncheck the Enabled checkbox.
Click
. Click .Let's navigate the document again paying attention to the context hints:
In the ContentMap, click the first sect
element.
Press F3 to move the focus to the Editing Window.
The yellow opening tag tells you that the cursor is before the title
element.
Press the RightArrow key to move to the next position.
The green rectangular tag tells you that the cursor is inside the title
element.
Press the DownArrow key to move to the next line.
The two yellow tags tell you that the cursor is between the title
and para
of a sect
(section). The sect
is the current element.
Press Ctrl+End to move to the end of the current element (sect
).
The yellow closing tag tells you that the cursor is after the para
element, which is the end of the sect
element.
Put the cursor in the text of the para
with the em
child element.
Although the em
element is not immediately next to the cursor, you can see the yellow opening tag with the frame showing you the beginning and the end of the em
.
When you place the cursor inside an element that has child elements and the cursor doesn't immediately precede or follow any of them, the context hints appear to show the beginning and the end of the nearest child element that goes before or after the cursor, or both.
Selection can be done in both the Editing Window and the ContentMap.
Let's see how selection works in the Editing Window.
Element Selection. Here you can learn to select elements using the fact that they reside in a tree-like XML structure.
Put the cursor in the "Editing text" title
element.
Press Ctrl+Alt+UpArrow. The current element (title
) will be selected.
Press Ctrl+Alt+UpArrow again. The parent (sect
) of the current element (title
) will be selected.
Press Ctrl+Alt+UpArrow again. The parent (sect
) of the parent (sect
) of the title
will be selected.
Press Ctrl+Alt+DownArrow. The parent (sect
) of the parent (sect
) of the title
will be unselected.
To select/deselect the current element, press Ctrl+Alt+UpArrow/Ctrl+Alt+DownArrow. Each consecutive Ctrl+Alt+UpArrow/Ctrl+Alt+DownArrow selects/deselects the parent (the parent of the parent,...) of the current element.
Now triple click inside the para
(paragraph) element. The para
will be selected.
To select an element in the Editing Window, triple click it.
Let's copy/paste the selected para
element:
Press Ctrl+C to copy the selected para
.
Press Ctrl+DownArrow to move to the next element.
Press Ctrl+V to paste the para
.
We've learnt to select elements in the Editing Window.
Content Selection.
Let's learn to select just the content of a particular element.
Put the cursor in the "Editing text" title
element.
Press Ctrl+Alt+S. The content of the title
will be selected.
To select the content of the current element, press Ctrl+Alt+S.
Let's copy/paste the selected content:
Press Ctrl+C to copy the selected content.
Press Ctrl+V to paste the content.
We've learnt to select the content of elements in the Editing Window.
Portion Selection.
Let's learn to select a portion of the document:
Click the beginning of the portion you want to select.
Hold down the Shift key and click the end of the portion.
You can also click the beginning of the portion and holding down the left mouse button drag the mouse till the end of the portion.
Elements Cross-Selection.
Click any point inside the first para
.
Hold down the Shift key and click any point inside the second para
.
Both para
elements are selected completely regardless of the points you clicked. This is so because the balance selection mode is on.
To turn on/off the balance selection mode, press Ctrl+[ or choose -> .
Exact Selection.
Let's turn off the balance selection mode. Press Ctrl+[.
Click any point inside the first para
.
Hold down the Shift key and click any point inside the second para
.
The selection is made exactly from one point to another.
You can try cutting/copying/pasting the exact and cross-selections to see how Serna deals with them.
Above, we used hot keys to perform selection. However, in some cases you can use the
menu, namely:To select/deselect the element or parent, choose
-> / .To select the content of an element, choose
-> .To turn on/off the balance selection mode, choose
-> .Let's see how selection works in the ContentMap.
Element Selection.
Click the first sect
element and press the Space key. The sect
will be selected.
Hold down the Ctrl key and click the para
element. The para
will be selected.
To select an element in the ContentMap, click the element and press the Space key or hold down the Ctrl key and click the element.
Now click the em
(emphasis) element.
Press Ctrl+Alt+UpArrow. The current element (em
) will be selected.
Press Ctrl+Alt+UpArrow again. The parent (para
) of the current element (em
) will be selected.
Press Ctrl+Alt+UpArrow again. The parent (sect
) of the parent (para
) of the em
will be selected.
Press Ctrl+Alt+DownArrow. The parent (sect
) of the parent (para
) of the em
will be unselected.
To select/deselect the current element, press Ctrl+Alt+UpArrow/Ctrl+Alt+DownArrow. Each consecutive Ctrl+Alt+UpArrow/Ctrl+Alt+DownArrow selects/deselects the parent (the parent of the parent,...) of the current element.
Content selection.
Click the first sect
element in the ContentMap.
Press Ctrl+Alt+S. The content of the sect
(title
and para
elements) will be selected.
To select the content of the current element, press Ctrl+Alt+S.
Portion Selection.
Click the first sect
element in the ContentMap.
Hold down the Shift key and click the second sect
element. Both sect
elements will be selected.
To select a portion of document in the ContentMap, click one item and holding down the Shift key click another item.
You can also click some element in the Content Map and use Shift+UpArrow/Shift+DownArrow.
You've learnt about document navigation, cursor positioning and selection in Serna. If you've followed the steps above, you must have made some changes to the Quick Start Interactive Example . If you do not intend to keep them, close the document without saving.
Abstract
In this section, we'll run through several simple examples to learn various easy ways of inserting and editing elements and attributes, and the content of XML documents. You'll be able to use a method which is more to your taste.
Let's create an itemized list of big cats:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click . A new document will be created.
Click the Choose
element.
Clicking the Choose
element calls the Insert Element Dialog.
Pressing Ctrl+Alt+Enter moves the cursor to the next Choose
element and calls the Insert Element Dialog.
In the Insert Element Dialog, double-click title
.
The title
element is inserted.
Type "Cats" in the title
. Click Choose
.
In the Insert Element Dialog, type "it
" and the itemizedlist
will be offered. Click .
In the dialogs, the elements are in alphabetical order. If you know exactly which element you need, you can start typing its name and it will be offered automatically.
The itemizedlist
element is inserted. Click Choose
.
Some people find pop-up dialogs tiresome as they come and clutter the document view. In Serna, you can dock some dialogs (marked as dockable), so you constantly see them: right-click the Insert Element Dialog and select the
item from the menu.The Insert Element Dialog is docked to the right side of the program window. In the Insert Element Dialog , double-click listitem
.
The listitem
element is inserted. In the Insert Element Dialog , double-click para
.
To call/move the focus to the Insert Element Dialog, press Ctrl+Enter, or choose -> , or click the Insert Element button on the toolbar.
To call/move the focus to the Insert Element Dialog when the cursor is already on the Choose
element, it is enough to press Enter. Or click the Choose
element.
The para
element is inserted.
Type "Leopard" in the para
.
It's convenient to create more list items using the advanced split method:
Press Enter. The current element para
will be split (a new para
will be inserted).
Press Enter immediately again. This will split the parent of the para
- the first listitem
.
To split the current element, press Enter, or choose -> , or click the Split Element button on the toolbar.
To split the parent (the parent of the parent,...) of the current element, press Enter multiple times in a row. This is called advanced element split.
Type "Lion" in the para
. Press Enter twice to split the listitem
.
Type "Zebra" in the para
. Press Enter twice to split the listitem
.
Type "Tiger" in the para
. Press Enter once to split the para
.
Oops. Let's join the last two para
s:
Put the cursor in the last para
and press Ctrl+Alt+UpArrow to select the para
.
Click the Join Elements button on the toolbar. The
para
s will be joined.
To join two elements of the same type going in a row, select the latter element and choose Join Elements button on the toolbar.
We've created an itemized list of cats with a weird "Zebra" item.
Let's emphasize the "Zebra" text which looks weird on the list of cats:
Click "Zebra" text and press Ctrl+Alt+S to select content.
When you make a selection, the Insert Element Dialog is replaced with the Wrap Into Element Dialog. Press Ctrl+Enter to move the focus to the Wrap Into Element Dialog.
To call/move the focus to the Wrap Into Element Dialog, select the content and press Ctrl+Enter or Ctrl+T, or choose > .
In the Wrap Into Element Dialog, double-click emphasis
.
The selected region is wrapped into the emphasis
element.
If you need to untag an element, put the cursor in the element and press Ctrl+U or choose -> .
Let's make the emphasized italic "Zebra" even more prominent, say, bold. To do so, we need to change the role
attribute of the emphasis
element:
Click the emphasis
element.
Press Alt+Enter to call the Attributes Dialog.
To call the Attributes Dialog, put the cursor in the element and press Alt+Enter, or choose -> , or click the Element Attributes button on the toolbar.
In the Attributes Dialog, click the
Add Attribute
button and select the
role
attribute.
Type the bold
value and click .
You can also dock this dialog to a side of the Serna window just as you did with the Insert Element Dialog.
The emphasis
is now bold.
Let's delete the "Zebra" item from the list of cats to prove our high IQ:
Click the emphasis
element.
Press Ctrl+Alt+UpArrow three times to select the listitem
element.
The first Ctrl+Alt+UpArrow selects the current element (emphasis
), the second selects the parent of the current element (para
) , and the third selects the parent of the parent of the current element (listitem
).
If we had just text without the emphasis
element in the para
of the listitem
, we would press Ctrl+Alt+UpArrow twice to select the listitem
.
Press the Delete key. The "Zebra" listitem
will be deleted.
To delete a selected element, press the Delete key or Backspace key.
To delete an element when the cursor is before the element, press the Delete key.
To delete an element when the cursor is inside the element, press Ctrl+Delete.
To delete an element when the cursor is after the element, press the Backspace key.
Let's rename the itemized list into the ordered list to see the number of cats we have:
Click the first para
.
Press Ctrl+UpArrow twice to move from the para
element to the itemizedlist
element.
Press Ctrl+R to call the Rename Element Dialog.
To call the Rename Element Dialog, put the cursor in the element and press Ctrl+R, or choose -> , or click the Rename Element button on the toolbar.
In the Rename Element Dialog, select orderedlist
and click .
The itemizedlist
has been turned into the orderedlist
.
Now we know for sure there are three cats on the list.
Let's cut the first item and paste it at the end of the list:
Put the cursor into the "Leopard
" text and press Ctrl+Alt+UpArrow twice to select the listitem
.
The first Ctrl+Alt+UpArrow selects the current element (para
), and the second selects the parent of the current element (listitem
).
Press Ctrl+X to cut the listitem
.
To cut the selected element, press Ctrl+X, or choose -> , or click the Cut button on the toolbar.
Press Ctrl+End to move to the end of the orderedlist
.
Press Ctrl+V to paste the listitem
.
To paste the element, press Ctrl+V, or choose -> , or click the Paste button on the toolbar.
Let's now drag&drop the first item to the end of the list:
Put the cursor into the "Lion
" text and press Ctrl+Alt+UpArrow twice to select the listitem
.
Drag the selection over the document.
Where the dropping of the listitem
is not allowed, you see a crossed circle.
Where the dropping of the listitem
is allowed, you see the Insert Element icon.
Drop the item at the end of the list.
To drag&drop a selection, click it and drag to the desired place. Validator shows places where dropping of the current selection is allowed.
You can also try other manipulations:
To copy the selected element, press Ctrl+C, or choose -> , or click the Copy button on the toolbar. To copy the selected element, press Ctrl-C, or choose Edit->Copy, or click the Copy
button on the toolbar.
To copy just the text of the selection, press Ctrl+Alt+C or choose -> .
To paste the selection, press Ctrl+V, or choose -> , or click the Paste button on the toolbar.
To paste the selection as text, press Ctrl+Alt+V or choose -> .
Above, we worked with elements in the Editing Window. Actually, you can perform some manipulations with elements in the ContentMap as well.
The ContentMap tree shows the elements of the document as well as empty branches where you can insert, paste and drop elements.
Sometimes when you want to insert an element, it may be difficult to find the right cursor position in the Editing Window. For example, when you want to add a list item to the middle of the list, it can be hard to determine the exact position for insertion. In such cases, the ContentMap comes in handy.
Let's insert a new list item in the middle of the list in the ContentMap:
Click the empty branch between the first two listitem
elements. This is the position for inserting a new listitem
clearly seen in the ContentMap.
Press Ctrl+Enter to call the Insert Element Dialog.
In the Insert Element Dialog, double-click the listitem
element. The listitem
will be inserted.
The cursor is on the Choose
element. Press Enter to call the Insert Element Dialog.
In the Insert Element Dialog, double-click the para
element.
The para
is inserted. Type "Panther" in the para
.
Let's move the first list item to the end of the list. It is convenient to use the drag&drop function:
Click the first listitem
in the ContentMap.
Drag the listitem
over the tree structure.
You see a crossed circle where the dropping of the listitem
is not allowed and a pointer cursor with the tag of the listitem
where it is allowed.
Drop the listitem
after the last listitem
. Now the "Tiger
" listitem
is the last.
You can also try other operations with elements in the ContentMap, which is analogous to performing the same operations in the Editing Window in most cases.
To cut/copy an element in the ContentMap, select the element and press Ctrl+X/Ctrl+C. To copy just the text of the selection, press Ctrl+Alt+C.
Clicking an element in the ContentMap does NOT select it. To select an element, click it AND press Ctrl+Alt+UpArrow. To learn more about selection in ContentMap, see the section called “Selection in ContentMap”.
To paste an element, press Ctrl+V. To paste an element as text, press Ctrl+Alt+V.
To delete an element in the ContentMap, click either it or the empty branch before the element and press the Delete key, or click the empty branch after the element and press the Backspace key.
To edit attributes of an element, click the element and press Alt+Enter, or choose -> , or click the Element Attributes button on the toolbar. If you point the cursor over an element in the ContentMap, you'll see a hint with the element's attributes.
To split an element, click it and choose -> , or click the Split Element button on the toolbar. Note that the Enter key won't work to split elements in the ContentMap and consequently the advanced split won't work.
To join two elements of the same type going in a row, select the latter element and choose -> or click the Join Elements button on the toolbar.
To wrap an element in another element, select the element and press Ctrl+Enter or Ctrl+T, or choose > to call the Wrap Into Element Dialog.
To untag an element, click it and press Ctrl+U or choose -> .
To rename an element, click it and press Ctrl+R, or choose -> , or click the Rename Element button on the toolbar to call the Rename Element Dialog.
Abstract
Custom Content is a convenient way to regularly insert the same content portion which may consist of a single element or have a complex structure. Custom content is a pre-defined content portion (template) that can be inserted into your document.
Serna comes with some ready-made custom content available through menu, hot keys and toolbar buttons. For details, see the section called “Inserting Ready-Made "Section" Custom Content”.
Custom content buttons are, of course, different for different document types. What works for DITA may not be available in Docbook.
For example, the Custom Content toolbar contains the following buttons for Docbook documents:
, , , etc.You can also create and edit your own custom content templates. For details, see the section called “Creating New Custom Content”.
Let's insert a section with a subsection using the ready-made Insert Section
and Insert Subsection
custom content:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> Article . Click .
A new document is created.
Click the Insert Section button on the toolbar. A section will be inserted.
Click the Insert Subsection button on the toolbar. A subsection will be inserted.
To insert a ready-made custom content, click its button on the toolbar, or use its hot key, or choose the corresponding item from the
-> menu.You can create a new custom content template "as is", taking it from the document.
Let's create a new custom content that will insert a section
with title
and para
:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> Article . Click .
A new document is created. Insert a section
with a title
and a para
.
Select the section
. The selection will form the content of the custom content template.
Click the Create New Custom Content button on the toolbar (or choose -> -> ).
The Custom Content Dialog appears. Some fields including the Content are filled automatically.
Change some parameters:
In the Name field, type section with para
.
In the Inscription field, type Insert section with para
.
From the Icon drop-down list, select the custom_content_1
icon.
Click
.The button associated with the newly created custom content appears on the toolbar.
Let's insert the new custom content:
Click the button (or choose -> -> ).
The section
with title
and para
custom content is inserted.
Let's make the created custom content persistent and working with any Docbook V4.5 document:
Choose
-> .In the Save View Message Box, click the
button.You can create context-sensitive custom content, i.e. with the very same button you will insert different content depending on the cursor position.
As an interesting example, try the ready-made Insert Itemized List Item button:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click .
A new document is created. Insert title
and para
.
Click the Insert Itemized List Item button on the toolbar.
An itemizedlist
with a listitem
is inserted.
Click the Insert Itemized List Item button again.
Not a new itemizedlist
, but the second listitem
is inserted.
Let's create a custom content that will insert the inlinegraphic
element for an image within text, and the figure
element with a child called graphic
for an image inside the section
element:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click .
A new document is created. Insert title
and para
. Type some text in the para
.
Click the Create New Custom Content button on the toolbar (or choose -> -> ).
In the Custom Content Dialog, specify:
In the Name field, type MyGraphic
.
In the Inscription field, type Insert MyGraphic
.
From the Icon drop-down list, select the custom_content_2
icon.
In the Hotkey field, press Ctrl+Alt+M.
Specify the first template and its context:
In the Content field, enter:
<inlinegraphic fileref="$(file caption='Choose Image' filter='Image files (*.gif *.jpg);;All files (*)')"/>
In the If matches field, enter:
text()
Click the
button to add a new context tab.Specify the second template and its context:
In the Content field, enter:
<figure><title/><graphic fileref="$(file caption='Choose Image' filter='Image files (*.gif *.jpg);;All files (*)')"/></figure>
In the If matches field, enter:
section|chapter
Click
.The button associated with the newly created context-sensitive custom content appears on the toolbar.
Let's insert the new context-sensitive custom content:
Put the cursor in the text. Click the button (or choose -> -> , or press Ctrl+Alt+M).
Browse for an image and open it.
The image is inserted as inlinegraphic
.
Put the cursor at the end of the section
. Click the button (or choose -> -> , or press Ctrl+Alt+M).
Browse for an image and open it.
The image is inserted as a figure
with title
and graphic
. Let's type "MyGraphic" title.
Let's make the created custom content persistent and working with any Docbook V4.5 document:
Choose
-> .In the Save View Message Box, click the
button.Abstract
It is convenient to create a recurrent content just once and then simply reuse it in other places in the document or in other documents. It is enough to make changes to a single occurrence of the reusable content and the other occurrences will be updated automatically. Imagine you have a copyright notice on several pages of your document and you need to change the year. Having the copyright notice as a reusable content, you change the year just in one place and the change is applied to all occurrences of the copyright notice.
Reusable content is created by means of entities, XIncluded documents, and DITA conref mechanism. We'll learn how to handle entities and Xinclude in the section called “Working with Entities” and the section called “Working with XInclude”.
For information about the DITA conref approach, please refer to DITA documentation at http://dita.xml.org/arch-conref.
An entity is a reusable fragment of the document content that can be reused multiple times by reference. Unlike other editors, Serna allows you to edit entity references in-place and shows them as regular content.
There are two types of entities:
Internal Entities . An internal entity can be reused only in the document in which it was declared.
External Entities . An external entity is saved to a separate file and can be reused in any document.
Let's create a legal notice and convert it into internal entity to reuse in the document:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click .
A new document is created. Insert title
and para
.
In the title
, type "Internal Entity Example". In the para
, type "All rights reserved."
Select the para
. This will be the content of the entity.
Choose
-> .In the Convert to Internal Entity Dialog, type "legal-notice" Entity Name. Click
.The para
is converted to the internal entity that can be reused in the current document.
Let's reuse the declared internal entity:
Move the cursor to the end of the section
.
Click the Insert Internal Entity button on the toolbar (or press Ctrl+7, or choose -> ).
In the Insert Internal Entity Dialog, select the legal-notice
entity from the Internal DTD Subset. Click .
The internal entity is inserted.
Type more text in the first internal entity, and the changes will be automatically propagated to the other internal entity.
Let's create a birthday list and convert it into the external entity to reuse in another document:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click .
A new document is created.
Insert title
. In the title
, type "External Entity Example".
Insert an itemizedlist
with listitem
s.
Select the itemizedlist
. This will be the content of the entity.
Choose
-> .In the Convert to External Entity Dialog, type "birthday-list" in the Entity Name field and "birthdays.xml" in the File Name field. Click .
The itemizedlist
is converted to the external entity.
Choose birthdays.xml
file and can be reused in other documents.
Let's reuse the external entity in another document:
Open a new document:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> All . Click .
From the Root Element drop-down list, select section
. Click .
A new document is created. Insert title
and para
.
Click the Insert External Entity button on the toolbar (or press Ctrl+6, or choose -> ).
In the Insert External Entity Dialog:
Select the Insert From File radio button.
Browse for the birthdays.xml
file.
Type "birthday-list" in the Entity Name field.
Click
.The birthday-list
external entity is now declared in the document and is inserted from the birthdays.xml
file.
XInclude allows you to include the content of standalone XML documents or their parts into your XML document. It is also possible to include plain text documents using XInclude.
You can take standalone documents and xinclude them into your document. For example, you can create confectionery.xml
and xinclude chocolates.xml
and candies.xml
.
You can turn a part of your document into an xincluded standalone document. For example, you can turn the section "Ice Cream" of desserts.xml
into xincluded standalone ice-cream.xml
.
Let's create a document "Gardening Tips" and turn its section "Planting" into a standalone xincluded XML document:
Create a new document:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> Article . Click .
A new document is created.
In the title
, type "Gardening Tips".
Click the Insert Section button on the toolbar. In the
title
, type "Planting".
Click the Insert Subsection button on the toolbar. In the
title
, type "Planting Plum Trees".
Before we go any further, let's provide the section "Planting Plum Trees" with an ID. We'll need the ID later in the section called “XIncluding Part of Document” when we xinclude "Planting Plum Trees" as a part of document "Planting".
Click the section
and press Alt+Enter to call the Attributes Dialog.
Add the id
attribute and type the plums
value. Click .
Let's convert the section
"Planting" to an xincluded document:
Select the section
"Planting".
Choose
-> .In the Convert to XML Xinclude Dialog, type the "planting" file name. Click
.The section
is converted to an xincluded standalone XML document.
Choose planting
file and can be reused in other documents.
Let's xinclude the whole planting
document in another document:
Create a new document:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> Article . Click .
A new document is created.
In the title
, type "Outdoor Activities".
Put the cursor near the Choose
element.
Click the XInclude XML File button on the toolbar (or press Ctrl+8, or choose -> ).
In the XInclude XML File Dialog:
Browse for the planting
file.
From the ID drop-down list, select <Insert Whole Document>
.
Click
.The planting
file is inserted as an xincluded document.
It is possible to xinclude not only the whole document but also some part of it having an ID.
Let's xinclude just the section "Planting Plum Trees" of the planting
document:
Click the Undo button to undo the XInclusion of the whole document.
Click the XInclude XML File button on the toolbar (or press Ctrl+8, or choose -> ).
In the XInclude XML File Dialog:
Browse for the planting
file.
From the ID drop-down list, select plums
which is the ID of the section "Planting Plum Trees".
Click
.The section "Planting Plum Trees" of the planting
file is xincluded in the document.
Abstract
In Serna, it is possible to create CALS and HTML model tables. These table models use different elements and have different table structures.
In our tutorial, we'll work with CALS tables. The CALS table model is supported by the Table Tools plugin, which greatly simplifies their creation and modification. HTML tables can be created manually, using the Insert Element Dialog and Attributes Dialog.
XML tables are constructed from elements. In Serna's WYSIWYG mode, a CALS table looks like this:
If you switch to the Tag mode (choose
-> ), you'll see markup tags. This is what the same table looks like in the Tag mode:So, an XML table is not just a grid, but it actually consists of elements such as body, header, footer, rows, entries, etc.
Let's create the CALS table we saw in the previous section. It is convenient to use the Table Tools plugin for working with CALS tables instead of inserting the table elements manually:
Choose -> to call the New Document Dialog.
Select Docbook V4.5 -> Article . Click . A new document will be created.
Choose
-> -> not to be distracted by the grey draft areas.In the title
, type "CALS Tables".
Choose Insert Table button on the toolbar).
In the Insert Table Dialog, check the Has Header checkbox. Click .
A table is inserted. In the title
, type "Capitals".
Type inside the entries. The table is ready.
Let's add more rows using the Table Tools plugin:
Choose
-> -> twice. This will add two more rows to the table.Type inside the new entries.
You can also try adding a new row manually:
Put the cursor after the last row.
Press Ctrl+Enter to call the Insert Element Dialog. Insert row
.
Press Enter to call the Insert Element Dialog. Insert entry
.
Put the cursor after the inserted entry
.
Press Ctrl+Enter to call the Insert Element Dialog. Insert entry
.
As you can see, it is much more convenient to use the Table Tools plugin when handling CALS tables. However, you'll have to insert and edit table elements manually when creating HTML tables.
Let's delete the last row of our table, add a "Continent" column and align text to center using the Table Tools plugin:
Put the cursor in the last row.
Choose
-> -> . The row will be deleted.Click the Insert Column Before button on the toolbar (or choose -> -> ). A column will be inserted.
Type inside the new entries.
Let's center text in the whole table. Choose
-> -> -> . Text will be aligned to center.Abstract
Redlining is used for collaborative authoring. The corrections are marked as "deleted", "inserted" and "commented", and they can be easily accepted or rejected.
You can perform redlining and revision of redlined documents using the Redlining menu or the Redlining toolbar.
Let's redline a Christmas letter (you can create it or open any other document, e.g.
-> -> ):Select a portion you want to delete.
Press the Redline as Deleted button on the toolbar.
In the Redline as Deleted Dialog, type some annotation or leave it empty. Click
.The selected word "wood" is marked as deleted.
Let's suggest a correct variant. Click the Redline as Inserted button on the toolbar.
In the Redline as Inserted Dialog, type some annotation or leave it empty. Click
.The insertion marking brackets appear.
Type inside the brackets and the text will be marked as inserted.
Select another portion you want to delete.
Press the Redline as Deleted button on the toolbar.
In the Redline as Deleted Dialog, type some annotation or leave it empty. Click
.The selected word "car" is marked as deleted.
Let's suggest a correct variant. Type what you would like to insert.
Select the portion to be marked as inserted.
Click the Redline as Inserted button on the toolbar.
In the Redline as Inserted Dialog, type some annotation or leave it empty. Click
.The selected word "bicycle" is marked as inserted.
Select a portion you would like to comment on.
Click the Redline as Commented button on the toolbar.
In the Redline as Commented Dialog, type some comment or leave it empty. Click
.The selection is marked as commented with yellow.
Let's revise the redlined document from the beginning:
Click the Find Next Redlining button on the toolbar.
The first redlining is found. You can see its annotation text on the toolbar .
Click the Accept Redlining button on the toolbar. The word "wood" marked as deleted will be deleted.
Click the Find Next Redlining button on the toolbar.
The next redlining is found. You can see its annotation text on the toolbar .
Click the Accept Redlining button on the toolbar. The word "would" marked as inserted will be inserted.
Let's make the cursor move automatically to the next redlining after accepting/rejecting a redlining: сheck the
-> menu item.Click the Find Next Redlining button on the toolbar.
The next redlining is found. You can see its annotation text on the toolbar .
The annotation is quite long. To see the whole annotation, click the Edit Redlining button on the toolbar. Read the annotation and click .
Since we still want a car, click the Reject Redlining button on the toolbar. The word "car" marked as deleted will stay.
The cursor moves automatically to the next redlining. You can see its annotation text on the toolbar .
Since we don't want a bicycle, click the Reject Redlining button on the toolbar. The word "bicycle" marked as inserted will be deleted.
The cursor moves automatically to the next redlining which is a comment. You can see its text on the toolbar .
To see the whole comment, click the Edit Redlining button on the toolbar. Read the annotation and click .
Choose
-> . The comment on the "PS" will be removed.When the last redlining is accepted/rejected/removed, you'll see a notice.
Abstract
In Serna, you can publish your documents in HTML or PDF format using external applications.
For transformation to HTML, Serna comes with XSLTProc in the distribution. You can also install and use Saxon, FOP, XEP, and Antenna House XSL Formatter.
Let's publish spiders.xml
document in HTML (you can create a similar document, or open any other Docbook document, e.g. -> -> ):
Open the document in Serna.
Click the Publish button on the toolbar (or press Ctrl+P, or choose -> ).
In the Publish Dialog:
From the Publishing output drop-down list, select HTML(Single Chunk)
.
Click
.Wait until the script ends.
Click
and the generated HTML file will be opened in your browser.Let's publish the same document in PDF with XEP:
Purchase and install XEP Engine.
To run XEP, you must have Java installed on your computer.
Add the XEP installation path to the PATH
system variable:
From the
, choose -> -> .Double-click System to open the System Properties window.
On the Advanced tab, click .
In the System variables combo box, select the PATH
variable and click .
In the Variable value edit box, add the path of the XEP directory.
Click Edit System Variable dialog box.
in theClick Environment Variables dialog box.
in theThe instructions are given for Classic Start menu and Classic View of Control Panel.
Restart Serna.
Open the document in Serna.
Click the Publish button on the toolbar (or press Ctrl+P, or choose -> ).
In the Publish Dialog:
From the Publishing output drop-down list, select PDF(with XEP)
.
Click
and wait until the script ends.Click
and the generated PDF file will be opened.Table of Contents
Abstract
The view of a document (fonts, enumeration of chapters and sections, etc) may be controlled by values of some XSLT parameters of the stylesheet that is applied to the document.
Values of XSLT parameters can be grouped into sets. For example, there can be a set:
title-font-name="Arial"
show-draft-notes="true"
An alternative instance of this set can be:
title-font-name="Times"
show-draft-notes="false"
If you switch between these two sets, the document will be represented differently (the title font will change from Arial to Times, and the draft notes will be hidden from the user).
You can switch between alternative XSLT Parameter Sets available for documents of a particular type changing the view of the document on-the-fly, edit them, and create your own sets.
Let's switch the XSLT Parameter Set for a Docbook document:
Create or open a Docbook V4.5 document.
Find the XSLT Parameter Set drop-down list on the toolbar. There are two XSLT Parameter Sets available for Docbook documents: "Default View" and "Clean". The "Default View" displays grey draft areas in your document.
Select "Clean" from the list. The draft areas will disappear.
You can make your documents open automatically with an XSLT Parameter Set other than the factory default one (e.g. not to switch each time manually from "Default View" to "Clean" in the case of Docbook documents):
Choose
-> .In the Save View Message Box, click the
button.Now all Docbook V4.5 documents will open automatically with the "Clean" XSLT Parameter Set.
Let's change the font of the "Clean" XSLT Parameter Set:
Choose
-> -> .The XSLT Parameter Sets Dialog will appear.
In the XSLT Parameter Sets Dialog, do the following:
From the Parameter Set>>Name drop-down list, select Clean
.
In the XSLT Parameters combo box, select body.font.family
. Click .
In the Edit XSLT Parameter Dialog, type "Tahoma" in the Value field. Click .
In the XSLT Parameters combo box, select body.font.master
. Click .
In the Edit XSLT Parameter Dialog, type "20" in the Value field. Click
.In the XSLT Parameter Sets Dialog , click
.The font of the document will be changed from "Times, 12" to "Tahoma, 20."
The changes in the "Clean" XSLT Parameter Set are applied to the current document only. To make the changes persistent for all documents of the same type, you must save them:
Choose
-> .In the Save View Message Box, click the
button.Now all Docbook V4.5 documents will open automatically with the modified "Clean" XSLT Parameter Set.
Table of Contents
Abstract
You can customize the view of Serna by changing the location of the GUI controls (buttons, menus, and dockable dialogs) and adjusting plugin settings, and make it persistent for all documents of a specific type. If you want to return the original view, you can restore it.
Actually, we have already customized and saved the Serna view in the section called “Creating New Custom Content”, where we created new custom content buttons and made them persistent for all Docbook V4.5 documents. Also, in Chapter 4, XSLT Parameter Sets, we switched the XSLT Parameter Set to "Clean", customized it and optionally saved the view. In this chapter, we'll try more examples of Serna view customization.
When documents are opened with the "Default View" XSLT Parameter Set, you see the grey draft areas. To remove the draft areas, you have to switch to the "Clean" XSLT Parameter Set each time manually.
Let's switch to the "Clean" XSLT Parameter Set once and make the view persistent for all Docbook V4.5 documents:
Open a Docbook V4.5 document.
Choose Clean item from the XSLT Parameter Set drop-down list on the toolbar).
-> -> (or select theThe draft areas have disappeared.
Let's save the customized Serna view to make it persistent for all documents of the same type as the current one:
Choose
-> .In the Save View Message Box, click the
button.Now the saved view will work with any Docbook V4.5 document.
We have customized the Serna view for Docbook V4.5 documents (see the section called “Saving "Clean" XSLT Parameter Set for Docbook Documents”). Let's now discard our personal settings and restore the original view.
We also customized the Serna view for Docbook V4.5 documents in the section called “Creating New Custom Content”. So if you created the custom content buttons and saved them, and now restore the original view, you will lose them.
To restore the original view, take the following steps:
Open a Docbook V4.5 document.
Choose
-> .In the Restore View Message Box, click the
button.If the document is not saved, you'll be prompted to save it.
The document is reloaded and the view is restored to its original state: the XSLT Parameter Set is switched to the "Default View".
Our personal view settings were lost and now this original view will work with any Docbook V4.5 document.