Tetropy

Tetropy, from Greytower Technologies, is a markup language related to Markdown and Wikitext. Like HTML it uses plain text in which certain well–defined symbols — text strings — are embedded to indicate structure.

The main difference between Tetropy and the HTML–family of markup languages is the simplicity — whereas HTML or XHTML would use:

<p> To Sherlock Holmes she is always THE woman. I have seldom heard him mention her under any other name. In his eyes she eclipses and predominates the whole of her sex. </p>

<p> All emotions, and that one particularly, were abhorrent to his cold, precise but admirably balanced mind. He was, I take it, the most perfect reasoning and observing machine that the world has seen, but as a lover he would have placed himself in a false position. </p>

Tetropy would use:

To Sherlock Holmes she is always THE woman. I have seldom heard him mention her under any other name. In his eyes she eclipses and predominates the whole of her sex.

All emotions, and that one particularly, were abhorrent to his cold, precise but admirably balanced mind. He was, I take it, the most perfect reasoning and observing machine that the world has seen, but as a lover he would have placed himself in a false position.

This, by necessity, makes it a less capable language than HTML, but in return the source code is emminently readable and very, very easy to write. The source of a Tetropy document will typically look very similar to a newspaper article, or a page from a book.

Plain text source documents, for example from Project Gutenberg, can subsequently be transformed into reasonably good markup very quickly. Some hands–on post–processing will be required for perfection, if indeed that is what you seek.

As you can imagine, this format is not designed for web applications or splash–pages, but rather for processing large amounts of writing into reflowable markup for e–books, articles, and so forth.

Primary Syntax

Tetropy can be written in one of three ways, or a combination of them. The primary syntax, so named becaused it is the one most users will see and take advantage of, is designed to be simple, and to resemble “normal” text as much as possible.

A sentence is a sequence of characters which end in punctuation (dot, comma, exclamation mark, question mark, or right parenthesis). A paragraph is one or more sentences; paragraphs are separated from each other by an empty line.

Example:

 Tetropy can be written in one of three ways, or a combination of
 them. The primary syntax, so named becaused it is the one most users
 will see and take advantage of, is designed to be simple, and to
 resemble "normal" text as much as possible.



 A sentence is a sequence of characters which end in punctuation
 (dot, comma, exclamation mark, question mark, or right parenthesis). A
 paragraph is one or more sentences; paragraphs are separated from each
 other by an empty line.

A section heading is a line which does not end in punctuation, and which is not part of a paragraph — a separate line, in other words.

Example:

Primary Syntax



Tetropy can be written in one of three ways, or a combination of
them. The primary syntax, so named becaused it is the one most users
will see and take advantage of, is designed to be simple, and to
resemble "normal" text as much as possible.

The phrase “Primary Syntax” will be deduced to be a heading, and marked up as such.

URIs are automatically detected, including images and e–mail addresses — just type these normally, and the proper markup will be constructed. An URI such as http://www.google.com will subsequently turn into a link: http://www.google.com — see the section on “Secondary Syntax” for more details on links, including details on how you can prevent them from being turned into markup, how you can add titles, embed images and how you can supply class and ID information.

Simple data tables are written as you would expect, with data in lines and rows. All you need remember is to start each line with a tab, and place another tab between each “cell”.

The horizontal size of each tab does not matter, but make sure that your text editor does not turn them into sequences of space–characters.

This example:

	a	b	c	d	e
	f	g	h	i	j
	k	l	m	n	o
	p	q	r	s	t

will result in this HTML table:

a b c d e
f g h i j
k l m n o
p q r s t

Lists follow the same principle as paragraphs, headers, and tables: write them as you normally would; with “*” as the bullet:

 * Banana
 * Carrots
 * Blueberries

or, if you need a numbered list:

 1. Banana
 2. Carrots
 3. Blueberries
  1. Banana
  2. Carrots
  3. Blueberries

A sequence of five, or more, hyphen or underscore characters will form a horizontal divider. This:




-----

becomes this:


Secondary Syntax

The secondary syntax is a tad more complicated, and requires you to remember a number of so–called meta–characters. I won’t use that term ever again :)

Inside a paragraph, or a header, you can add meaning to words or phrases by using the following techniques:

 //phrase//            - The phrase is emphasised
 **phrase**            - The phrase is strongly emphasised
 = phrase =            - A first level heading
 == phrase ==          - A second level heading
 === phrase ===        - A third level heading
 ==== phrase ====      - A fourth level heading
 ===== phrase =====    - A fifth level heading
 ====== phrase ======  - A sixth level heading
 ||phrase||            - The phrase is marked as 'deleted text'
 ++phrase++            - The phrase is marked as 'inserted text'
 %%phrase%%            - The phrase is marked as a citation
 __phrase__            - The phrase is underlined
 ~~phrase~~            - The phrase is subscripted
 ^^phrase^^            - The phrase is superscripted
 ``phrase``            - The phrase is written in a monospaced font

This is a mostly useless paragraph containing a number of phrases marked up using secondary syntax or Tetropy’s phrase markup syntax; specifically all of them after another. It’s followed by six hyphens in a row to create a horizontal divider.

Example:

 This //is// a **mostly** useless paragraph containing a number of
 ||phrases|| marked up using ++secondary++ syntax or %%Tetropy's%%
 phrase markup __syntax__; specifically ~~all~~ of ^^them^^ after
 ``another``. It's followed by six hyphens in a row to create a
 horizontal divider.

If a paragraph itself start with a “, it will be considered a block quotation up until the next paragraph ending with a ” — this closely, if not exactly, mimic the normal way of writing quotations in English prose.

Links can be controlled in more detail by prefixing them with + and –. If you, for example, write an image URI as +URI, then code will be created which embed the image instead of linking to it. If you write any URI as –URI, then it’ll be included literally, and not converted to a link.

Example:

http://www.greytower.net                           - creates a link
-http://www.greytower.net                          - is used literally
http://www.greytower.net/images/wcag1AAA-blue.png  - creates a link
+http://www.greytower.net/images/wcag1AAA-blue.png - embeds the image

In the above, http://www.greytower.net/images/wcag1AAA-blue.png will create a link to the image, while adding a ‘+’ in front of the URI will embed it:

Abbreviations, Acronyms, Quotations, and so forth

Certain constructions used within paragraphs are of a more complex nature. Take, for example, the abbreviation “URI”, used above. It expands to the phrase “Uniform Resource Identificator”, and should be properly written as

<abbr title="Uniform Resource Identificator">URI</abbr>

In Tetropy, you’d write:

 An URI (+Uniform Resource Identificator+) is a string which ...

or, in other words, the way you would usually write an abbrevation and its meaning in regular text, but with the addition of the “+” character inside the parenthesis. You can do the same for acronyms:

 I've spent some time studying
 COBOL (-Common Business Oriented Language-)

and inline quotations:

 Do you recall the line "the mirror crack'd" (*http://en.wikipedia.org/wiki/The_Lady_of_Shalott*) 
 by that famous poet Whatshisname?

Tables

Table headers can be created by adding a tophat (‸) before and after the content of each cell you want to make into a header.

Example:

	^a^	^b^	^c^	^d^	^e^
	f	g	h	i	j
	k	l	m	n	o
	p	q	r	s	t

will produce:

a b c d e
f g h i j
k l m n o
p q r s t

Tertiary — or Advanced — Syntax

Advanced Usage: Links

If you wish even further control of links, then this is also possible. The general syntax is as follows:

(([URI][Link Text][Attributes]))



will generate <a href="URI" Attributes>Link Text</a>

(({URI} {} {attributes}))

will generate <img src="URI" alt="alt" Attributes>

while this

(({URI 1} {URI 2} {attributes}))

  will generate <a href="URI 2"><img src="URI 1" Attributes></a>

You can, for example, embed an image and include both an ALT text and style information:

(({http://www.greytower.net/images/wcag1AAA-blue.png} {} {alt="WCAG 1.0 'AAA' Compliant" style="display: block ; margin-left: auto ; margin-right: auto ;"}))

which will yield: WCAG 1.0 'AAA' Compliant

Advanced Usage: Tables

Tetropy follows a similar philosophy as Dokuwiki when it comes to tables. Each cell is separated from the next by way of a pipe (“|”) symbol; each line from the next by one new line (not two!).

Example:

|  ^Heading 1^  |  ^Heading 2^  |  ^Heading 3^ |
| Row 1 Col 1   | Row 1 Col 2   | Row 1 Col 3  |
| Row 2 Col 1   | Row 2 Col 2   | Row 2 Col 3  |
| Row 3 Col 1   | Row 3 Col 2   | Row 3 Col 3  |

will produce:

Heading 1 Heading 2 Heading 3
Row 1 Col 1 Row 1 Col 2 Row 1 Col 3
Row 2 Col 1 Row 2 Col 2 Row 2 Col 3
Row 3 Col 1 Row 3 Col 2 Row 3 Col 3

Advanced Usage: classes and IDs

In some circumstances you might want to add classes and/or ids to elements. This can be done as follows:

 =={foo} This is a header ==

will produce:

 <h2 id="foo">This is a header</h2>

and:

 (bar)To Sherlock Holmes she is always THE woman. I have seldom heard
 him mention her under any other name. In his eyes she eclipses
 and predominates the whole of her sex.

would produce:

 <p class="bar">
  To Sherlock Holmes she is always THE woman. I have seldom heard
  him mention her under any other name. In his eyes she eclipses
  and predominates the whole of her sex.
 </p>

Advanced Usage: HTML

Tetropy will do its very best to reckognise, and avoid touching, markup. Even so we suggest you use as little of it as possible, as it may just interfere with the selected output filter.

Using elements from HTML 3.2, for example, which doesn’t exist in XHTML 1.1 would have consequences for the output, and would in a worst case scenario make the markup non–wellformed.

Or just plain ugly….

Output

The exact markup produced from a Tetropy–format document depends on the output–filter chosen — and, of course, the parser. At the moment our reference parser can write HTML 4.01 Strict, XHTML 1.1 and EPUB 2 – the latter being a specialized form of XHTML.

The default output is HTML 4.01 Strict, where paragraphs create P–elements, emphasis EM, underline U, and so forth.

For XHTML 1.1, underlining is transformed into a SPAN element (in lowercase) with a STYLE attribute. Tetropy will attempt to follow the specifications it support as closely as possible, both syntactically and semantically.

The THEAD and TBODY elements are produced for both HTML 4.01 Strict and XHTML 1.1 — if any TH elements are produced.

An empty ALT–text is added to IMG elements if none is present.

Notes

Why “Tetropy”?

It’s a pun. Seriously. Don’t worry about it. Here, take a cookie. I promise, by the time you’re done eating it, you’ll feel as right as rain.

Copyright © 2002—2017 Greytower Technologies. All rights reserved.
Last update 3th of January 2017