The Pliant .page format is an alternative to native HTML. The Pliant HTTP server will translate on the fly any .page file to HTML, so the client browser will not see any difference. On the server side, there are several advantages using .page format instead of HTML:
A document written in Pliant .page format, is saved with ".page" extention, and actually is a Pliant program. The style/default.style module which is defaultly binded to any .page file provides a basic set of instructions to display text, images, hyperlink, etc, so with .page format you will use instructions instead of HTML tags. Several attributes, such as 'bold' need the area it applies on to be specifyed. In HTML this is performed using an start tag and a stop tag. In Pliant, it's done using indentation, so keep in mind that when writing .page files, indentation is not only for nice looking but also has meaning for Pliant dynamic compiler.
On this page you will have every .page format instruction described with examples.
The 'text' instruction is to display text.
syntax:
text string
Sample code:
text "hello world " text "on the same line [lf]" text "on the next line"
The 'eol' instruction inserts a line feed.
Syntax:
eol
text "[lf]"
text "my first line" eol text "my second line"
alternatives that will give the same result:
text "my first line" text "[lf]" text "my second line"
text "my first line[lf]" text "my second line"
text "my first line[lf]my second line"
The 'html' instruction, can display pure html code in your page. It can be useful when HTML code is needed where Pliant .page format isn't shaped for.
html 'string
html "<hr>"
The 'link' instruction makes hyperlinks between pages or programs.
link label target [section section] [options options]
Sample code: 1:
link "Pliant home page" "http://pliant.cx/"
Various sections within a page are defined using 'section' instruction.
section name
Sample code 2:
section "mysection" text "bla bla bla[lf]" text "more bla bla bla[lf]" link "jump to beginning of my section" "" section "mysection"
The 'note' instruction is set to make a note in your document, you just have to indent the note content under the instruction. On the client side it will appear like an hypertext, and your note will be displayed on a new page
note label instructions
text "more " note "explanations" title "My sample note" text "As you can see the note is displayed on a new " text "page, but you included it in your main document" text " about notes."
The 'image' instruction inserts image in your page. If 'image' has a single parameter, it's a true image pasted in the page, but if it has two or more parameters, it's a graphical hyperlink, just like 'link' introduced a text hyperlink.
image url [target] [section section] [options options]
text "A passive image:[lf]" image "/pliant/welcome/image/pliant.jpeg" eol text "An active image (in other words, an hyperlink):[lf]" image "/pliant/welcome/image/pliant.jpeg" "http://pliant.cx/" # FIXME
The 'listing' instruction displays pure ASCII code in your page.
listing bloc
listing what ever you want with free indentation and on several lines
what ever you want with free indentation and on several lines
The 'highlight' instruction is a very useful instruction which highlights any character string, to ask for reader's attention.
highlight string
highlight "look at this"
The 'title' instruction has the same function than <title> HTML tag, but more than giving a title to the page, it also display page's title in a preformatted style .
title string
title "My page"
The instruction 'chapter' is a big heading, in a preformatted style.
chapter string
chapter "chapter XVI"
The `header` instruction is also a heading, if you indent an other 'header' instruction in it, you would have an other kind of heading, more soft with little size fonts.
header string content
header "first" text "first text" header "one" header "two" text "second text"
The 'para' instruction creates paragraphs.
para instructions
para text "once upon a time, bla bla bla" eol text "more bla bla bla." para text "and they lived happy and , bal bla bla" eol text "even more bla bla bla."
once upon a time, bla bla bla more bla bla bla.
and they lived happy and , bal bla bla even more bla bla bla.
The 'list' instruction makes a list of item. Please remind that you must indent each item of the list and introduce it with 'item' instruction.
list item instructions item instructions
list item text "banana" item text "apple" eol text "and lemon" item text "orange"
If you indent a new list in a list, you would have different kind.
list item text "fruits" list item text "banana" item text "apple"
HTML makes intensive usage of tables with no border, as they are a very efficient way to define the page layout. If you are not awarded of tables as a powerfull page layout mechanism, please refer to some HTML documentation.
To make a table with Pliant .page format, you must declare the number of columns so that when introducing a new cell, the system knows if they it has to be displayed on the same row or on the next one. Inside the table you have to indent each cell and introduce it with 'cell' instruction.
table columns columns [border size] cell [color lsh l s h] [color rgb r g b] instructions cell [color lsh l s h] [color rgb r g b] instructions
table columns 3 cell text"cell one" cell text "cell two" cell text "cell three" cell text"cell four" cell text "cell five" cell text "cell six"
These instructions change any element's style, you just have to indent any instruction in it.
The 'bold' instruction displays text in bold.
Syntax :
bold instructions
bold text "Displayed in bold" eol text "also bold" text " no more bold"
The 'italic' instruction displays text in italic.
italic instructions
italic text "Displayed in italic"
The 'small' instruction decreases the font size.
small instructions
small text "small font"
The 'big' instruction increases the font size.
big instructions
big text "big font"
The 'center' instruction aligns any element in the page or table center.
center instructions
Sample code;
center text "The Pliant .page format is " eol text "an alternative to native HTML."
The 'fixed' instruction displays text in fixed font.
fixed instructions
fixed text "This font is fixed"
There are two ways to code colors with Pliant .page format: lsh encoding and rgb encoding. lsh stands for light saturation and hue. Please notice that Pliant lsh encoding does not conform strictly to the CIE lsh encoding. In particular, with Pliant lsh encoding 'light' value meaning has no effect when saturation=100.
color lsh light saturation hue instructions
The following tables should help you understand the meaning of 'light' 'saturation' and 'hue':
Alternative syntax :
color rgb red green blue instructions
font color (color hsl 60 100 50) text "yellow text."
font color (color rgb 255 255 0) text "yellow text."
Sample code 3:
table columns 1 cell color (color hsl 120 33 0) font color (color hsl 120 100 0) text "green text, in a dark green cell."
Just include the 'dynamic' instruction in your page, to describe your page as a dynamic one. If you forget it, and you page does not contain any input field and any button, then the HTTP server is allowed to cache the translated to HTML page.
dynamic
The 'input' instruction creates a text area , which can be filled on the client side.
input label variable
var Str name input "your name: " name
The 'button' instruction is used to create dynamism in your web site, clicking on the button in the client browser will ask the server to execute any pliant code indented under it, and display the result on the client browser.
button label instructions
var Int i := 3 var Int j := 5 input "Type a number: " i input "Type an other number: " j button "Calculate" text "The sum of "+(string i)+" and "+(string j) text " is "+(string i+j)
Some of pliant .page format instructions are very often used, so there are shortcut instructions to go faster.
bracketed text enables you to omit the 'text' instruction.
[string]
The following sample
[your prose]
text "your prose"
So, the following sample
bold [your prose]
bold text "your prose"
With " ; " you can write instructions on the same line.
instruction ; instruction
[A ] ; bold [strong] ; [ word] ; eol
text "A " bold text "strong" text " word" eol