3.4 Metatext

By mchoate
Last modified: 2006-11-05 19:37:43

If you are already familiar with HTML, then it will be very easy for you to learn how to use Metawrite to it's fullest potential. If you are new to HTML, you will still be able to use the program, but you might not understand all the features.

Metawrite uses a special shorthand for creating HTML pages. If you've ever used a Wiki, then you will be familiar with the concept.

This is self-documenting documentation. In other words, you can view this in your browser and then view the source here in the application in order to see first-hand how things work.

The tags used by Metawrite parallel the elements used in XHTML. In XHTML, some tags apply to blocks of text, like paragraphs and lists. Others are used to apply style information to a string of text within a block.

Block Tags

Block tags are tags that apply to the entire paragraph, or block of text. By default, any paragraph followed by a blank line is treated as if it had a [p] tag. The most common Block tags are illustrated here (you can find the complete list in the Preferences).

This code:

[p] This is a paragraph tag

Generates this HTML:

<p>This is a paragraph tag</p>

In addition to the raw HTML element, you can also indicate a class for the Block using the following notation:

[p.aClass] This is a paragraph tag


This results in the following HTML:

<p class="aClass">This is a paragraph tag</p>

This tag:

[h1] Heading 1


Results in this HTML:

<h1>Heading 1</h1>

Inline Tags

Inline tags are used to apply styles and classes to characters within a Block. A common tag is the Strong tag, which can be indicated using the following shorthand notation:

This word is[* strongly] displayed.


The * is translated to this HTML:

<p>This word is <strong>strongly</strong> displayed.</p>

If the first word in a Block requires an Inline style, then you have to specify the Block and cannot rely on the default value.

This code works:

[p][* Bolded phrase] starts the sentence.


And this code does not:

[* Bolded phrase] starts the sentence


Actually, Metawrite will do it's best to display it, but it will likely try to apply the style intended for the first word or phrase to the entire Block, which is not what you intended.

"Special" Block Tags

There's also a special kind of block tag. Instead of typing the content that will appear in the page, you point to a file and import the content. These special block tags are: table, fig, img, mov and pre.

Tables

You will not create tables directly in Metawrite. There are plenty of other tools, like spreadsheets, that do a much better job of letting you compile tabular data. In order to display a table in Metawrite, you first need to import an HTML file that includes a table, using the Import Table command in the File menu. Metawrite will automatically embed the first table it encounters in the file. If you use Microsoft Excel, you can create a spreadsheet (with one worksheet) and fill in your data. Then all you need to do is save it as HTML and then import it into the Item where it will appear.

Here is an example of a table. The code looks like this:

[table.main{style=border:1px solid black;}
 This is a caption|testtable.html]


It results in something that looks like this:

Table 3.4.1 This is a caption
table cell heading
table cell

One of the unique features of of these special kind of Blocks are that they are numbered whenever a caption is used with them.

I can display a table with no caption:

table cell heading
table cell

Then I can display another table with a caption. This new table automatically gets numbered:

[table.main{style=border:1px solid black;}
 What will this number be?|testtable.html]


Here's the output:

Table 3.4.2 What will this number be?
table cell heading
table cell

As you can see, this table is numbered consequetively from the previous table. Here's what it looks like without a caption:

[table.main{style=border:1px solid black;} |testtable.html]


Here's the output:

table cell heading
table cell

Here's what it looks like without a caption, using a slightly different notion (note the missing "|")::

[table.main{style=border:1px solid black;} testtable.html]


Here's the output:

table cell heading
table cell

If I return to another table that includes a caption, the numbering returns:

[table.main{style=border:1px solid black;}
This table has a caption|testtable.html]


Here's the output:

Table 3.4.3 This table has a caption
table cell heading
table cell
some code[is] [here].


Lists

You can create ordered and unordered (bulleted) lists in Metawrite. Here is the code for an ordered list.

Pre 3.4.1 Code for an ordered list
[ol An ordered list|
# First
# Second
# Third
]


This is how that list gets displayed in HTML:

List 3.4.1 An ordered list
  1. First

  2. Second

  3. Third

Next, the code for an unordered list:

Pre 3.4.2 Code for an unordered list
[ul An unordered list|
- Bullet 1
- Bullet 2
- Bullet 3
]


Here is how this list gets displayed:

List 3.4.2 An unordered list
  • Bullet 1

  • Bullet 2

  • Bullet 3

You can even nest lists.

Pre 3.4.3 A nested list
[ul.plain A Caption |
- [* One]
- Two
-- a [One], a
-- One, b
]


Here is how the nest list appears:

List 3.4.3 A Caption
  • One

  • Two

    • a One, a

    • One, b

Figures and Images

Figures and images work in a similar way. Here's the code for a figure without a caption:

[fig |NewDomainToobar.png]


This is how that figure will be displayed:

In the next example, the same figure will be displayed with a caption:

[fig This is a figure with a caption|NewDomainToobar.png]


Here is how it is displayed:

Figure 3.4.1 This is a figure with a caption
This is a figure with a caption
Escaping Characters

This is a sentence with [escaped] characters.

To Be Continued...