Layout

Clio has two decorator classes, Title and Paragraph. They allow for a natural reading layout. The paragraphs follow web standards where they are separated by a empty line and expand to the width specified in the clio object.

Titles are very straightforward, you instantiate objects that represent different titles in your program.

    $H1 = new Title($clio, "center", new Style(true,null,Color::black(),Color::teal),0,1);");
    $H1->display("H1 Title");
        
H1 Title

Paragraphs are equally easy to use. Instantiate an object to reuse to draw out paragraphs, which by default work like web paragraphs, filling the width set in Clio and placing a blank space after each one.

    $p = new Paragraph($clio);
    $p->display("A book is made from a tree. It is an assemblage of flat...");
    $p->display("Across the millennia, the author is speaking, clearly and silently...");
        

Which looks like this:

A book is made from a tree. It is an assemblage of flat, flexible parts (still called "leaves") imprinted with dark pigmented squiggles. One glance at it and you hear the voice of another person, perhaps someone dead for thousands of years.
Across the millennia, the author is speaking, clearly and silently, inside your head, directly to you. Writing is perhaps the greatest of human inventions, binding together people, citizens of distant epochs, who never knew one another. Books break the shackles of time ― proof that humans can work magic. - Carl Sagan

Software Documentation

The following sections lists the software documentation for:

Title Class

Constructor


Set up the styling in the constructor and reuse for consistency throughout our program.

__construct($clio, $justification = "left", $style, $spaceBefore = 2, $spaceAfter = 1)

Parameters
NameTypeDescription
$clio Clio The single Clio object controlling the terminal
$justification string | int - either a justification constant from HTML or "left", "Center"...etc justification of the title
$style Style bold, underscore and colors of the title
$spaceBefore int The number of empty lines before the title (like margin-top)
$spaceAfter int The number of empty lines after the title (like margin-bottom)

display


Display the title, with an extra empty line underneath if desired.

display($text)

Parameters
NameTypeDescription
$text string text of the paragraph

Paragraph Class

Straightforward class to map out any paragraphs for reading. Markup can be placed in the text to trigger styling embedded in the text.

Constructor


Constructor to set up the look of the paragraph.

__construct($clio, $style = null, $spaceAfter = 1, $trim = true)

Parameters
NameTypeDescription
$clio Clio Clio object
$style Style The styling of a paragraph.

display


Display a paragraph.

Any markup strings found in the $text will trigger the corresponding styling.

display($text)

Parameters
NameTypeDescription
$text string text of the paragraph