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
shorttext: The short form, as shown.fulltext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
firsttext: The first key, such as "Ctrl".secondtext: The second key, such as "Shift".thirdtext: 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
firsttext: The first key, such as "Ctrl".secondtext: 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
wordstext: The words to show.classNametext: 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
classNametext: 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
wordstext: The words to show.addresstext: 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
valuetext: 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
valuetext: 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
targetLibraries.Web.Page.WebTag: The paragraph or list item to write into.pageLibraries.Web.Page.WebPage: The page the text is on.
SmallText(text value)
Adds small print, such as a side note.
Parameters
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
valuetext: 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
wordstext: The date or time as shown, such as "1998".momenttext: 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
valuetext: 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