TextOptions controls the behaviour of the Text function.
| 59 | |
| 60 | // TextOptions controls the behaviour of the Text function. |
| 61 | type TextOptions struct { |
| 62 | // Separator is inserted between the contents of the text nodes that are |
| 63 | // included in the result. It defaults to the empty string, which |
| 64 | // concatenates the text nodes without any separator. |
| 65 | Separator string |
| 66 | |
| 67 | // Trim, when true, removes leading and trailing whitespace from the |
| 68 | // content of each text node and omits text nodes that are empty once |
| 69 | // trimmed. This is useful to discard the insignificant whitespace that |
| 70 | // comes from the indentation of the source HTML. |
| 71 | Trim bool |
| 72 | |
| 73 | // Keep, when non-nil, is called for each text node encountered while |
| 74 | // traversing the selection. The content of the text node is included in |
| 75 | // the result only if Keep returns true. It can be used, for example, to |
| 76 | // drop the text of <script> and <style> elements by inspecting the node's |
| 77 | // parent. When Keep is nil, every text node is included (subject to Trim). |
| 78 | Keep func(node *html.Node) bool |
| 79 | } |
| 80 | |
| 81 | // Text returns the combined text contents of the nodes in the selection, |
| 82 | // including their descendants, in document order. It is a package-level |
nothing calls this directly
no outgoing calls
no test coverage detected