text

package
v0.0.0-...-51f9457 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

common/data/text

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

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
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.



	`))
Output:

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.

Directories

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL