Ptt is a text processor that converts text written in “tt format” to the text in HTML format. Text written in tt format is much more handy and intuitive.
<h1>Ptt</h1>
H1: Ptt
< ul >
” and “ < li >
” are bothersome. In tt text, hyphen at the beginning of line is list items as shown below.H3: HTML list HTML has three list format: - unordered list - ordered list - definition list - Ptt supports all these lists.which will be converted to
<h3>HTML list</h3> <p>HTML has three list format:</p> <ul> <li>unordered list <li>ordered list <li>definition list </ul> <p>Ptt supports all these lists.</p>Note that the last empty hyphen terminates the list.
This rule is simple and intuitive.
I: cat.jpg
Ta: name age alice 18 bob 20which is enough to genarate.
name | age |
---|---|
alice | 18 |
bob | 20 |
"
to modern left and right double quote pair “ ” is one of them. Table of contents is automatically generated, indexing bibliography and referencing citations are also automatic using style similar to LaTeX.
This page is written in tt format and is converted to regular HTML format. The original tt text is here.
ptt
and some of Lua library.http://p9.nyx.link/netlib/lua/
.
You need style sheet “style.css
” for Ptt. The style sheet might be updated frequently. You can get current style sheet by accessing http://ar.nyx.link/style.css
.
<
” or “ >
” then they are converted to “ & lt;
” and “ & gt;
” respectively. &
” in text is HTML escape but “ &
” ( “ &
” with spaces on both side ) will be converted to “ & amp;
”.
Experimental rules of Ptt 4.0:
<
” and end with “ >
” does not cooked by Ptt
If you do want these lines to be cooked, insert a space at the beginning of the line.
class
attr="value" attr="value" ...
or class="value"
attr="value" attr="value" ...
where class
is a class name, attr
is attribute and value
is the value.
Don't put spaces in the value.
H1: H2: H3: H4:
H1:
” is always required. Subject of the document follows “H1:
”. The subject will be used for both title
tag and h1
tag.
H1:
”H1:
” has some options: H1: -lteq
title
where characters inside of
are options:l
: don't show logot
: don't make table of contentse
: English documentq
: convert "
to left double quote or right double quote
BO:
options
which will produceBody tag must be located before “< body
options>
H1:
” tag.
UL:
OL:
DL:
-
”. Empty item or empty line terminate the list.
It is possible to omit “UL:
”. Therefore unordered list can be written simply as
Items may include multiple lines.-
item1
-
item2
-
Definition list is expressed as
Description may include multiple lines.DL:
-
name1
description of name1
-
name2
description of name2
-
-
” or header tags. Use of “-
” is recommended for clarity.
-a
”-a
” option, the first field is regarded as link. Then list items are expressed asHere these urls are used for the value of “UL:-a
-
url1 description1
-
url2 description2
-
href
” attribute, and may be anything that are allowed for the value.
In case of “-a
”, these urls are not shown.
Look http://ar.nyx.link/ptt/ for more details.will be converted to
Look <a href="http://ar.nyx.link/ptt/" target="other"> http://ar.nyx.link/ptt/</a> for more details.Conversion is applied to the unquoted strings that start with
http:
https:
ftp:
"
).
C: sentenceIn case that we have lines to align center, we have syntax:
CC:
term
line1
line2
...
term
I:
” tag or “II:
” tag.I: cat.jpgFollowing the file name, we can specify* the size of display. For example,
I: cat.jpg width=400will display 400 pixels image at the center of line.
The common rule is:
where file is a image file name, size is the display size and options is HTML options that can be assigned toI:
filesize
options
img
tag. Size is given like: 60% or 640.
II: termImage array is implemented using table.options0
title1 file1options1
title2 file2options2
...
term
“options0” is options(table attributes) to the table and is expressed for example,
width="90%"
width="30%"
For example
II:! lily lily.jpg iris iris.jpg portyeraka portyeraka.jpg !will produce
lily | iris | portyeraka |
You will want to have images of same height. However HTML does not have such option.
Other example is
II:! lily lily.jpg width="30%" iris iris.jpg width="40%" portyeraka portyeraka.jpg width="20%" !
lily | iris | portyeraka |
You need not make 100%. If name contains spaces, use single quote(') or double quote(").
Ta: doptions
Ca: caption
name:format d name:format d name:format
item d data d data
item d data d data
The d is a single letter which delimits fields. If delimiter is not given, space is assumed. Put spaces between delimiters for empty items, because sequence of delimiters might be given special meaning in future.
Options is HTML options for table tag. The default is
Ta: align="center"
Table design is determined by style sheet.
Ca:
” is optionalTa:
” is terminated by a empty line
If all names are absent, item header is not shown. For example
Ta: : : : alice 16 female bob 20 malewill produce
alice | 16 | female |
---|---|---|
bob | 20 | male |
:-
” will hide the column, i.e.,Ta: :- : : alice 16 female bob 20 malewill produce
16 | female |
20 | male |
Ta: | :- | 2000 | | | 2010 | | | <b>name</b> | <b>age</b> | <b>sex</b> | <b>name</b> | <b>age</b> | <b>sex</b> | <b>alice</b> | 16 | female | <b>alice</b> | 26 | female | <b>bob</b> | 20 | male | <b>bob</b> | 30 | malewill produce
2000 | 2010 | ||||
---|---|---|---|---|---|
name | age | sex | name | age | sex |
alice | 16 | female | alice | 26 | female |
bob | 20 | male | bob | 30 | male |
Format is specified as:
format | meaning |
---|---|
< width |
left align |
width | center align |
> width |
right align |
- |
hidden |
We show the code of above table below as an example.
D: { <code> D: } </code> Ta: | width="40%" align="center" :- | <i>format</i>:50% | meaning:50% |{ < }<i>width</i> | left align | <i>width</i> | center align |{ > }<i>width</i> | right align |{-} | hiddenwhere “
D:
” tag is used so that we can avoid annoying “ < code >
” and “ < /code >
” pairs. Look subsection “String definition” for this topic.
Variety of table style can be defined in style sheet.
Note: Sequence of contiguous delimiter might be given special meaning in future. Put spaces for empty table elements.
simply a preformat.
We have two method to show program code, which means the text is shown as it is.
First, lines beginning with TAB code
Second, we have “P:
” tag. The syntax is,
tabsize can be an option. The default is 8.P:
term [options]
program code
term
style="overflow:auto; height:50ex"
For example, If we want to show the following C code
#include <stdio.h> main(){ printf("OK\n"); }then
P:! #include <stdio.h> main(){ printf("OK\n"); } !is enough.
N:
note
where “term” is a terminator string.NN:
term
note
note
...
term
Q:
quote
where “term” is a terminator string.QQ:
term
quote
quote
...
term
#: comment
where “term” is a terminator string.##:
term
comment
comment
...
term
!!:
term
...
...
term
Now, using Ptt 4.0, this mode will seldom be required.
D:
from to
where “from” and “to” are string, which means “from” is replaced by “to”.D: { <code> D: } </code>then
{sample.txt}
<code>sample.txt</code>
DD: from termwhich means “from” is replaced by several lines:
to1
to2
...
term
We have another type of long definition: “DD+:
” which is used if we want to convert the “to” parts following tt syntax. “DD+:
” is useful if we want to construct complex table.
2000 | 2010 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
DD+: $1 ! Ta: class=noframe name age sex alice 16 female bob 20 male ! DD+: $2 ! Ta: class=noframe name age sex alice 26 female bob 30 male ! Ta: class=nopad :- 2000 2010 - $1 $2
where “noframe
” denotes no-frame table:
name | age | sex |
---|---|---|
alice | 16 | female |
bob | 20 | male |
nopad
” denotes solid border table of cell padding=0.
Ptt handles the problem on constructing complex tables by embedding table into table element.
D:
from
will clear the definition.
Plan 9<sup>[<ref(cite:Plan9)>]</sup> is deveploped ... ... H2: References [<lab(cite:Plan9)>] Plan 9 from Bell Labs http://plan9.bell-labs.com/plan9/will produce,
Plan 9[1] is deveploped ...
...
References
[1] Plan 9 from Bell Labs
http://plan9.bell-labs.com/plan9/
Syntax of the label and the reference is
You may use “< lab(key:label) >
< ref(key:label) >
{
” and “}
” instaed of “(
” and “)
” respectively. That is,< lab{key:label} >
< ref{key:label} >
Serial numbers are automatically given by ptt for each key.
Other example:
C: Fig.<lab(fig:cat)>: My lovely cat .... The cat shown in Fig.<ref(fig:cat)> is living in my room. ....
terminology | RE syntax | comment |
---|---|---|
string | .+ |
a sequence of characters |
unquoted string | [^"']?[^ ]* |
a string that does not begin with quotation mark and that does not contain spaces |
quoted string | ("[^"]*")|('[^']*') |
a string quoted by single or double quotation mark |
line | .*$ |
a string up to newline |
size | [1-9][0-9]*[%]? |
n or n%, n is non-negative number |
delimiter | [^- ] |
a letter that separate fields |
terminator | [^- ]+ |
string to terminate block |
table format | [ < > -]?[1-9][0-9]*[%]? |
specifies alignment and size of the field |
tag | meaning | syntax |
---|---|---|
H1: |
heading ( H2: ,H3: ,…) |
H1:[-lteq] line |
KW: |
keyword | KW: keyword,... |
BO: |
body option | BO: options |
UL: |
unordered list (omissible) |
UL:[-a][+a] - lines- lines… - |
OL: |
ordered list | OL:[-a][+a] - lines- lines… - |
DL: |
definition list | DL:[-a][+a] - lines- lines… - |
C: |
center align | C: line |
CC: |
center align | CC: term [options]lines term |
I: |
image inclusion | I: url [alt [size [options]]] |
II: |
image array | II: term [options]title url [options] title url [options] ... term |
Ta: |
table | Ta: [deli] [options][ Ca: line]string[:format] [deli] string[:format] [deli] … string [deli] string [deli] … string [deli] string [deli] … … |
Ca: |
caption use next to Ta: |
Ca: line |
P: |
program code | P: term [tab= size]lines term |
N: |
short note | N: line |
NN: |
long note | NN: term [options]lines term |
Q: |
short quote | Q: line |
QQ: |
long quote | QQ: term [options]lines term |
#: |
short comment | #: line |
##: |
long comment | ##: termlines term |
D: |
string defintion | D: str subst |
DD: DD+: |
string definition | DD: str termlines term |
!: |
pure HTML mode | |
!!: |
pure HTML mode | !!: termlines term |
Words used in syntax in tag table are given in the following table.
word | meaning |
---|---|
lines | line line ... |
term | an unquoted string used for terminator |
str | an unquoted string or a quoted string |
format | table format |
url | a value that is used for href or src attribute |
deli | a delimiter |
title | an unquoted string or a quoted string |
options | an optional part. The syntax is [class] [attribute="value"] ... note: spaces must not be included in the value |
subst | an unquoted string or a quoted string that substitutes str |
patt | an unquoted string or a quoted string that follows syntax regular expression pattern |
repl | an unquoted string or a quoted string that follows syntax replacement of regular expression |
#!/
${
code
}$
,.;:!?
”.