Documentation ¶
Overview ¶
Package transformer invokes the golang HTML parser, executes the individual transformers (unless overridden), and prints the output to the provided string.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedVersions = []*rpb.VersionRange{{Min: 1, Max: 2}}
SupportedVersions is a set of all transform versions supported by this snapshot of the library. This should not include transforms not yet snapshotted to a finalized version. The ranges should be non-overlapping and in descending order. Visible for test.
Functions ¶
func Process ¶
Process will parse the given request, which contains the HTML to transform, applying the requested list of transformers, and return the transformed HTML and list of resources to preload (absolute URLs), or an error.
If the requested list of transformers is empty, apply the default.
func SelectVersion ¶
func SelectVersion(requested []*rpb.VersionRange) (int64, error)
SelectVersion returns the highest requested version number that the transformer supports, or an error if no such version exists. The requested list must consist of non-overlapping ranges in descending order.
The transfomer will select the highest version from requested that it supports. If requested is nil or empty, the transfomer will select the highest version it supports. In both cases, it shouldn't include in-development versions.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
amphtml
Package amphtml contains common constants and utilies for working with AMP HTML.
|
Package amphtml contains common constants and utilies for working with AMP HTML. |
css
Package css contains tools for parsing a CSS3 stylesheet.
|
Package css contains tools for parsing a CSS3 stylesheet. |
htmlnode
Package htmlnode contains helpers to interact with html.Node
|
Package htmlnode contains helpers to interact with html.Node |
testing
Package testing provides test constants and utilities for the transformer and printer.
|
Package testing provides test constants and utilities for the transformer and printer. |
Package layout applies the AMP layout algorithm to a custom element (prefixed with "amp-").
|
Package layout applies the AMP layout algorithm to a custom element (prefixed with "amp-"). |
Package printer emits the given html.Node as HTML text to an io.Writer.
|
Package printer emits the given html.Node as HTML text to an io.Writer. |
Package transformers performs AMP transformations/optimizations on the DOM tree.
|
Package transformers performs AMP transformations/optimizations on the DOM tree. |