Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document is a generic data structure that represents a document.
func NewDocument ¶ added in v0.2.36
NewDocument creates a new document.
Parameters:
- sentences: The sentences to add to the document.
Returns:
- *Document: A pointer to the newly created document.
Behaviors:
- The sentences are separated by a space and on the same line.
func (*Document) AddLine ¶ added in v0.2.36
AddLine adds sentences to the document separated by a space. The line is split by the newline character.
Parameters:
- line: The line to add.
Returns:
- *Document: A pointer to the document. This allows for chaining.
Example:
- AddLine("Hello,", "world!")
- AddLine("This is a sentence.")
func (*Document) FString ¶ added in v0.2.36
FString returns the formatted string representation of the document.
Parameters:
- indentLevel: The level of indentation.
Returns:
- []string: The formatted string representation of the document.
type DocumentPrinter ¶ added in v0.3.5
type DocumentPrinter struct { // The name of the document. Name string // The document to print. Doc *Document // IfEmpty is the string to print if the document is empty. IfEmpty string }
DocumentPrinter is a type that represents a printer for a document.
func NewDocumentPrinter ¶ added in v0.3.5
func NewDocumentPrinter(name string, doc *Document, ifEmpty string) *DocumentPrinter
NewDocumentPrinter is a function that creates a new document printer.
Parameters:
- name: The name of the document.
- doc: The document to print.
- ifEmpty: The string to print if the document is empty.
Returns:
- *DocumentPrinter: A pointer to the new document printer.
func (*DocumentPrinter) FString ¶ added in v0.3.5
func (dp *DocumentPrinter) FString(trav *ffs.Traversor) error
FString is a helper function that prints a document.
Format:
<name>: <document>
or
<name>: <ifEmpty>
Parameters:
- trav: The traversor to use for printing.
Returns:
- error: An error if the printing fails.
Behaviors:
- If the document is nil, the function prints the IfEmpty string.
- If the document is not nil, the function prints the document.
Click to show internal directories.
Click to hide internal directories.