RichText

Package: Libraries.Web.Page · Inherits from: Libraries.Language.Object

RichText writes text into one paragraph or list item, piece by piece: plain words, and words named by what they are, such as a term being defined or a key to press. Each piece takes its look from the page's style options, so a page never says how words look. Text is written exactly as a reader should see it: characters such as "<" and "&" are made safe for the page here. Every action returns the same RichText, so the pieces can be chained in one line. A page gets one from anything that holds text: Paragraph, ListItem, Title, Section, Subsection and Subsubsection each return a writer for their own text. Each writer writes only into its own element.

Example Code

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Section("Positions")
        Paragraph("Every item has a position, written as "):Term("coordinates"):Text(".")
    end
end

Actions

Abbreviation(text short, text full)

Adds a short form, such as "CSTA", with its full form, which screen readers and tooltips can give.

Parameters

  • short text: The short form, as shown.
  • full text: The full form.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("See the "):Abbreviation("CSTA", "Computer Science Teachers Association"):Text(" standards.")
    end
end

Bold(text value)

Adds bold words that have no other meaning: only a look. Prefer Term, Strong or Emphasis when one of them fits.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph():Bold("Note:"):Text(" this changes every page.")
    end
end

Citation(text value)

Adds the title of a work, such as a game, book or film.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph():Citation("StarCraft"):Text(" shipped with a map editor.")
    end
end

Code(text value)

Adds code, such as the name of an action.

Parameters

  • value text: The code.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Call "):Code("SetGap"):Text(" to space the items.")
    end
end

Deleted(text value)

Adds words that were deleted, to show a change being made.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("The line becomes SetGap("):Deleted("8"):Inserted("16"):Text(").")
    end
end

DoubleQuote()

Adds a double quote mark ("), which can't be typed inside a Quorum string.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Quorum Studio says "):DoubleQuote():Text("Placed"):DoubleQuote():Text(".")
    end
end

Emphasis(text value)

Adds words said with stress.

Parameters

  • value text: The stressed words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Neither kind is "):Emphasis("better"):Text(".")
    end
end

Highlight(text value)

Adds highlighted words, to point at them, such as a line that changed.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Change "):Highlight("SetGap(8)"):Text(" to SetGap(16).")
    end
end

Inserted(text value)

Adds words that were inserted, to show a change being made.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("The line becomes SetGap("):Deleted("8"):Inserted("16"):Text(").")
    end
end

Key(text value)

Adds a key to press, such as "Enter".

Parameters

  • value text: The key.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Press "):Key("Enter"):Text(" to place the item.")
    end
end

Keys(text first, text second, text third)

Adds a combination of three keys pressed together, such as Ctrl+Shift+S.

Parameters

  • first text: The first key, such as "Ctrl".
  • second text: The second key, such as "Shift".
  • third text: The third key, such as "S".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Press "):Keys("Ctrl", "Shift", "S"):Text(" to save as.")
    end
end

Keys(text first, text second)

Adds a combination of two keys pressed together, such as Ctrl+S.

Parameters

  • first text: The first key, such as "Ctrl".
  • second text: The second key, such as "S".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Press "):Keys("Ctrl", "S"):Text(" to save.")
    end
end

LibraryCodeLink(text words, text className)

Adds a link to the page documenting a class in a code library, showing words of your choice.

Parameters

  • words text: The words to show.
  • className text: The class's full name, such as "Libraries.System.File".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Read it with the "):LibraryCodeLink("File class", "Libraries.System.File"):Text(".")
    end
end

LibraryCodeLink(text className)

Adds a link to the page documenting a class in a code library, showing the class's short name. The website knows where those pages are (see WebSite:SetLibraryCodeFolder).

Parameters

  • className text: The class's full name, such as "Libraries.System.File".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Files are read with "):LibraryCodeLink("Libraries.System.File"):Text(".")
    end
end

LineFeed()

Adds a line feed character to the text. A browser shows it as a space, so it changes how the page's source looks, not how the page looks; use NewLine for a line the reader sees.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("First line"):LineFeed():Text("still the same line to a reader")
    end
end

Link(text words, text address)

Adds a link.

Parameters

  • words text: The words to show.
  • address text: Where the link goes.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("See the "):Link("standards", "https://csteachers.org/pk12standards/view/"):Text(".")
    end
end

NewLine()

Starts a new line within the same paragraph or list item, as a line break the reader sees. Use a new paragraph instead when the text starts a new idea.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Quorum Studio"):NewLine():Text("Las Vegas, Nevada")
    end
end

NonBreakingSpace()

Adds a space that never breaks across lines, to keep two words together, such as "Warcraft III".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Warcraft"):NonBreakingSpace():Text("III shipped with its World Editor.")
    end
end

Output(text value)

Adds what a program prints or says, such as a message a screen reader reads aloud.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Quorum Studio says "):Output("Placed"):Text(".")
    end
end

Quoted(text value)

Adds words that are quoted, such as what someone or something says. The browser puts the quote marks around them, in the style of the page's language, so the marks aren't typed.

Parameters

  • value text: The quoted words, without quote marks.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Quorum Studio says "):Quoted("Placed"):Text(".")
    end
end

SetTarget(Libraries.Web.Page.WebTag target, Libraries.Web.Page.WebPage page)

Attaches this writer to the paragraph or list item it writes into, and the page that styles what it writes. RichText calls this; people making pages don't.

Parameters

SmallText(text value)

Adds small print, such as a side note.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Scenes save automatically. "):SmallText("(Every few seconds.)")
    end
end

Strong(text value)

Adds important words.

Parameters

  • value text: The important words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph():Strong("Save your work"):Text(" before closing the editor.")
    end
end

Subscript(text value)

Adds words lowered below the line, such as the 2 in H2O.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Water is H"):Subscript("2"):Text("O.")
    end
end

Superscript(text value)

Adds words raised above the line, such as the 2 in x squared.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("The area is x"):Superscript("2"):Text(".")
    end
end

Term(text value)

Adds a term at the place it is introduced or defined.

Parameters

  • value text: The term.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("The point (0, 0, 0) is called the "):Term("origin"):Text(".")
    end
end

Text(text value)

Adds plain words.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Scenes come in two kinds.")
    end
end

Time(text words, text moment)

Adds a date or time, with the same moment written the way computers read it, so screen readers, calendars and search engines can understand it.

Parameters

  • words text: The date or time as shown, such as "1998".
  • moment text: The same moment for computers, such as "1998" or "2026-10-29".

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("StarCraft ("):Time("1998", "1998"):Text(") shipped with a map editor.")
    end
end

Variable(text value)

Adds the name of a variable: a name that stands for a value, in math or in code.

Parameters

  • value text: The words.

Returns

Libraries.Web.Page.RichText: This writer, to add more.

Example

use Libraries.Web.Page.all

class Main is WebPage
    action Main
        Paragraph("Set "):Variable("x"):Text(" to 100.")
    end
end

Inherited Actions

3 actions from Libraries.Language.Object