README

common/data/text

This folder should be used for libraries that store, organize or manipulate textual data.

Expand ▾ Collapse ▴

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Doc

func Doc(doc string) string

Doc transforms doc:

1. Strips leading and trailing whitespace.
2. Removes common '\t' indentation.
3. Replaces '\n' not-followed by whitespace with ' '.

See example.

This function is not fast.

Example

Code:

fmt.Println(Doc(`
		Leading blank line above is removed.

		The indentation on the left is trimmed.

		These 2 lines appear on the same line,
		with a space instead of newline.

		A new paragraph is preserved.
			New line before indented text is preserved.
			Indentation of the intentionally indented text is preserved.

		Trailing blank lines is removed.



	`))
Leading blank line above is removed.

The indentation on the left is trimmed.

These 2 lines appear on the same line, with a space instead of newline.

A new paragraph is preserved.
	New line before indented text is preserved.
	Indentation of the intentionally indented text is preserved.

Trailing blank lines is removed.

Types

This section is empty.

Source Files

Directories

Path Synopsis
color
indented
pattern Package pattern implements lightweight parsable string patterns.
sanitizehtml Package sanitizehtml implements a sanitizer of a very limited HTML.
stringtemplate Package stringtemplate implements Python string.Template-like substitution.
templateproto Package templateproto defines a proto-based way to configure templates for JSON documents.
units Package units provides common useful printable units.