import "go.chromium.org/luci/common/data/text"
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.
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. `))
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.
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. |
Package text imports 3 packages (graph) and is imported by 4 packages. Updated 2019-12-10. Refresh now. Tools for package owners.