Documentation ¶
Overview ¶
Package turboamper provides support for making some HTML structured texts validateable by Yandex Turbo and Google AMP services.
Index ¶
- func AMP(htmlText []byte) ([]byte, string, error)
- func FbToAMP(htmlText []byte) ([]byte, error)
- func FbToTurbo(htmlText []byte) ([]byte, error)
- func IframeToAMP(htmlText []byte) ([]byte, error)
- func IframeToTurbo(htmlText []byte) ([]byte, error)
- func InstaToAMP(htmlText []byte) ([]byte, error)
- func InstaToTurbo(htmlText []byte) ([]byte, error)
- func Turbo(htmlText []byte) ([]byte, string, error)
- func TwitToAMP(htmlText []byte) ([]byte, error)
- func TwitToTurbo(htmlText []byte) ([]byte, error)
- func VkToAMP(htmlText []byte) ([]byte, error)
- func VkToTurbo(htmlText []byte) ([]byte, error)
- func YoutubeToAMP(htmlText []byte) ([]byte, error)
- func YoutubeToTurbo(htmlText []byte) ([]byte, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AMP ¶
AMP gives you amp-representation of html and its type If it cannot recognize your html, it returns simple error.
func FbToAMP ¶
FbToAMP convertes given facebook embeddable html to AMP
Example ¶
html := `<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fstcnk%2Fposts%2F3384458724928901&width=500" width="500" height="498" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>` amp, err := FbToAMP([]byte(html)) if err != nil { fmt.Printf("ERROR: %s", err) } fmt.Printf("AMPfied: %s", amp)
Output:
func IframeToAMP ¶
IframeToAMP convertes some custom iframe embeddable html to AMP Tested on Russia Today
func IframeToTurbo ¶
IframeToTurbo convertes some custom iframe embeddable html to Yandex Turbo
func InstaToAMP ¶
InstaToAMP convertes given instagram embeddable html to AMP
func InstaToTurbo ¶
InstaToTurbo validates given instagram embeddable html for Yandex Turbo
func Turbo ¶
Turbo gives you YandexTurbo-representation of html and its type If it cannot recognize your html, it returns simple error.
func TwitToTurbo ¶
TwitToTurbo convertes given twitter embeddable html for Yandex Turbo
func VkToAMP ¶
VkToAMP convertes given vkontakte widget post to AMP What is that? Look https://vk.com/dev/widget_post
Example ¶
html := `<div id="vk_post_-165546713_21078"></div> <script type="text/javascript" src="https://vk.com/js/api/openapi.js?162"></script> <script type="text/javascript"> (function() { VK.Widgets.Post( "vk_post_-165546713_21078", -165546713, 21078, 'UDKmSYMw9-_LHr7Lcgz8oAVE3Xg', {width: 600}); }()); </script>` amp, err := VkToAMP([]byte(html)) if err != nil { fmt.Printf("ERROR: %s", err) } fmt.Printf("AMPfied: %s", amp)
Output:
func VkToTurbo ¶
VkToTurbo validates given vkontakte widget post for Yandex Turbo What is that? Look https://vk.com/dev/widget_post
func YoutubeToAMP ¶
YoutubeToAMP convertes given youtube embeddable html to AMP
func YoutubeToTurbo ¶
YoutubeToTurbo convertes Youtube embeddable html to Yandex Turbo
Types ¶
This section is empty.