HelpSectionTextContent

A simple content class the simply displays a given string.

Notes: This class is fully compliant with the HelpSectionOptions.

Constructors

this
this(string text)

Members

Functions

getContent
string getContent(HelpSectionOptions options)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

text
string text;

Inherited Members

From IHelpSectionContent

getContent
string getContent(HelpSectionOptions options)

Generates a string to display inside of a help text section.

lineWrap
string lineWrap(HelpSectionOptions options, const(char)[] value)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import std.exception : assertThrown;

auto options = HelpSectionOptions("\t", 7 + 2); // '+ 2' is for the prefix + ending new line. 7 is the wanted char limit.
auto content = new HelpSectionTextContent("Hey Hip Lell Loll");
assert(content.getContent(options) == 
    "\tHey Hip\n"
   ~"\tLell Lo\n"
   ~"\tll",

    "\n"~content.getContent(options)
);

options.lineCharLimit = 200;
assert(content.getContent(options) == "\tHey Hip Lell Loll");

options.lineCharLimit = 2; // Enough for the prefix and ending new line, but not enough for any piece of text.
assertThrown(content.getContent(options));

options.lineCharLimit = 3; // Useable, but not readable.
assert(content.getContent(options) ==
    "\tH\n"
   ~"\te\n"
   ~"\ty\n"

   ~"\tH\n"
   ~"\ti\n"
   ~"\tp\n"

   ~"\tL\n"
   ~"\te\n"
   ~"\tl\n"
   ~"\tl\n"

   ~"\tL\n"
   ~"\to\n"
   ~"\tl\n"
   ~"\tl"
);

Meta