amp-html 0.7.18 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +82 -77
- data/README.md +61 -75
- data/app/helpers/amp_html/asset_helper.rb +11 -0
- data/app/helpers/amp_html/base_helper.rb +14 -0
- data/app/helpers/amp_html/dynamic_content_helper.rb +14 -0
- data/app/helpers/amp_html/layouts_helper.rb +11 -0
- data/app/helpers/amp_html/media_helper.rb +15 -0
- data/app/views/mozaic/amp/_amp-link.html.erb +1 -0
- data/app/views/mozaic/amp/_audio.html.erb +11 -0
- data/app/views/mozaic/amp/_canonical-link.html.erb +1 -0
- data/app/views/mozaic/amp/_components.html.erb +6 -0
- data/app/views/mozaic/amp/_doctype.html.erb +4 -0
- data/app/views/mozaic/amp/_font.html.erb +2 -0
- data/app/views/mozaic/amp/_form-response.html.erb +5 -0
- data/app/views/mozaic/amp/_form.html.erb +3 -0
- data/app/views/mozaic/amp/_head.html.erb +13 -0
- data/app/views/mozaic/amp/_img.html.erb +1 -0
- data/app/views/mozaic/amp/_input.html.erb +1 -0
- data/app/views/mozaic/amp/_mustache.html.erb +3 -0
- data/app/views/mozaic/amp/_selector.html.erb +3 -0
- data/app/views/mozaic/amp/_video.html.erb +11 -0
- data/lib/amp-html.rb +4 -20
- data/lib/amp-html/configuration.rb +13 -158
- data/lib/amp-html/engine.rb +6 -0
- data/lib/amp-html/railtie.rb +109 -0
- data/lib/amp-html/version.rb +1 -9
- data/lib/generators/amp_html_generator.rb +27 -0
- data/lib/generators/templates/{assets/stylesheets/application.scss → application.css} +1 -1
- data/lib/generators/templates/initializer.rb +14 -0
- data/lib/generators/templates/layout.html.erb +15 -0
- metadata +53 -204
- data/.github/issue_template.md +0 -16
- data/.github/pull_request_template.md +0 -21
- data/.gitignore +0 -13
- data/.travis.yml +0 -4
- data/CODE_OF_CONDUCT.md +0 -46
- data/CONTRIBUTING.md +0 -1
- data/DEPRECATIONS.md +0 -9
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -164
- data/INSTALL.md +0 -2
- data/OWNERS.yaml +0 -1
- data/Rakefile +0 -6
- data/amp-html.gemspec +0 -30
- data/bin/amp-html +0 -4
- data/lib/amp-html/cli.rb +0 -113
- data/lib/amp-html/components/docs/README.md +0 -101
- data/lib/amp-html/components/docs/ad.md +0 -83
- data/lib/amp-html/components/docs/analytics.md +0 -131
- data/lib/amp-html/components/docs/anim.md +0 -66
- data/lib/amp-html/components/docs/fonts.md +0 -63
- data/lib/amp-html/components/docs/forms.md +0 -79
- data/lib/amp-html/components/docs/iframe.md +0 -62
- data/lib/amp-html/components/docs/javascript.md +0 -71
- data/lib/amp-html/components/docs/lists.md +0 -168
- data/lib/amp-html/components/docs/media.md +0 -52
- data/lib/amp-html/components/docs/mustache.md +0 -46
- data/lib/amp-html/components/docs/notifications.md +0 -0
- data/lib/amp-html/components/docs/schema.md +0 -80
- data/lib/amp-html/components/docs/service_worker.md +0 -60
- data/lib/amp-html/components/docs/social.md +0 -130
- data/lib/amp-html/components/docs/stylesheets.md +0 -50
- data/lib/amp-html/components/help.rb +0 -19
- data/lib/amp-html/components/install.rb +0 -34
- data/lib/amp-html/components/templates/ERROR.md +0 -5
- data/lib/amp-html/components/templates/README.md +0 -12
- data/lib/amp-html/configuration/docs/README.md +0 -0
- data/lib/amp-html/configuration/help.rb +0 -11
- data/lib/amp-html/helpers/docs/README.md +0 -98
- data/lib/amp-html/helpers/docs/amp.md +0 -0
- data/lib/amp-html/helpers/docs/amp_ad.md +0 -86
- data/lib/amp-html/helpers/docs/amp_analytics.md +0 -76
- data/lib/amp-html/helpers/docs/amp_anim.md +0 -68
- data/lib/amp-html/helpers/docs/amp_audio.md +0 -54
- data/lib/amp-html/helpers/docs/amp_auto_ads.md +0 -43
- data/lib/amp-html/helpers/docs/amp_close_user_notification_button.md +0 -0
- data/lib/amp-html/helpers/docs/amp_css.md +0 -37
- data/lib/amp-html/helpers/docs/amp_css_link.md +0 -0
- data/lib/amp-html/helpers/docs/amp_custom_ad.md +0 -0
- data/lib/amp-html/helpers/docs/amp_document_link.md +0 -0
- data/lib/amp-html/helpers/docs/amp_embed.md +0 -86
- data/lib/amp-html/helpers/docs/amp_facebook.md +0 -70
- data/lib/amp-html/helpers/docs/amp_fallback.md +0 -47
- data/lib/amp-html/helpers/docs/amp_font.md +0 -0
- data/lib/amp-html/helpers/docs/amp_font_link.md +0 -0
- data/lib/amp-html/helpers/docs/amp_form.md +0 -0
- data/lib/amp-html/helpers/docs/amp_form_response.md +0 -0
- data/lib/amp-html/helpers/docs/amp_gfycat.md +0 -0
- data/lib/amp-html/helpers/docs/amp_global_css.md +0 -0
- data/lib/amp-html/helpers/docs/amp_google_analytics.md +0 -0
- data/lib/amp-html/helpers/docs/amp_google_font.md +0 -0
- data/lib/amp-html/helpers/docs/amp_head.md +0 -0
- data/lib/amp-html/helpers/docs/amp_html_doctype.md +0 -0
- data/lib/amp-html/helpers/docs/amp_iframe.md +0 -0
- data/lib/amp-html/helpers/docs/amp_image.md +0 -0
- data/lib/amp-html/helpers/docs/amp_input.md +0 -0
- data/lib/amp-html/helpers/docs/amp_instagram.md +0 -0
- data/lib/amp-html/helpers/docs/amp_js.md +0 -0
- data/lib/amp-html/helpers/docs/amp_link.md +0 -0
- data/lib/amp-html/helpers/docs/amp_list.md +0 -0
- data/lib/amp-html/helpers/docs/amp_live_list.md +0 -0
- data/lib/amp-html/helpers/docs/amp_live_list_items.md +0 -0
- data/lib/amp-html/helpers/docs/amp_live_list_pagination.md +0 -0
- data/lib/amp-html/helpers/docs/amp_live_list_update.md +0 -0
- data/lib/amp-html/helpers/docs/amp_mustache.md +0 -0
- data/lib/amp-html/helpers/docs/amp_pin_it.md +0 -0
- data/lib/amp-html/helpers/docs/amp_pin_widget.md +0 -0
- data/lib/amp-html/helpers/docs/amp_pinterest_follow.md +0 -0
- data/lib/amp-html/helpers/docs/amp_pixel.md +0 -0
- data/lib/amp-html/helpers/docs/amp_placeholder.md +0 -0
- data/lib/amp-html/helpers/docs/amp_reddit.md +0 -0
- data/lib/amp-html/helpers/docs/amp_resources.md +0 -0
- data/lib/amp-html/helpers/docs/amp_selector.md +0 -0
- data/lib/amp-html/helpers/docs/amp_serviceworker.md +0 -0
- data/lib/amp-html/helpers/docs/amp_social_share.md +0 -0
- data/lib/amp-html/helpers/docs/amp_soundcloud.md +0 -0
- data/lib/amp-html/helpers/docs/amp_twitter.md +0 -0
- data/lib/amp-html/helpers/docs/amp_user_notification.md +0 -0
- data/lib/amp-html/helpers/docs/amp_video.md +0 -0
- data/lib/amp-html/helpers/docs/amp_video_ad.md +0 -0
- data/lib/amp-html/helpers/docs/amp_vine.md +0 -0
- data/lib/amp-html/helpers/docs/amp_youtube.md +0 -0
- data/lib/amp-html/helpers/docs/audio_tag.md +0 -0
- data/lib/amp-html/helpers/docs/canonical_document_link.md +0 -0
- data/lib/amp-html/helpers/docs/form_tag.md +0 -0
- data/lib/amp-html/helpers/docs/image_tag.md +0 -0
- data/lib/amp-html/helpers/docs/input_tag.md +0 -0
- data/lib/amp-html/helpers/docs/javascript_include_tag.md +0 -0
- data/lib/amp-html/helpers/docs/noscript_tag.md +0 -0
- data/lib/amp-html/helpers/docs/schema_tag.md +0 -0
- data/lib/amp-html/helpers/docs/stylesheet_link_tag.md +0 -0
- data/lib/amp-html/helpers/docs/video_tag.md +0 -0
- data/lib/amp-html/helpers/help.rb +0 -23
- data/lib/amp-html/root.rb +0 -7
- data/lib/amp-html/test.rb +0 -169
- data/lib/amp-html/test/help.rb +0 -11
- data/lib/amp-html/test/templates/README.md +0 -43
- data/lib/amp-html/test/templates/css/!important.md +0 -1
- data/lib/amp-html/test/templates/css/-amp-.md +0 -1
- data/lib/amp-html/test/templates/css/-moz-binding.md +0 -1
- data/lib/amp-html/test/templates/css/@import.md +0 -1
- data/lib/amp-html/test/templates/css/behavior.md +0 -1
- data/lib/amp-html/test/templates/css/filter.md +0 -1
- data/lib/amp-html/test/templates/css/i-amp-.md +0 -1
- data/lib/amp-html/test/templates/css/overflow.md +0 -1
- data/lib/amp-html/test/templates/html/applet.md +0 -1
- data/lib/amp-html/test/templates/html/audio.md +0 -1
- data/lib/amp-html/test/templates/html/base.md +0 -1
- data/lib/amp-html/test/templates/html/embed.md +0 -1
- data/lib/amp-html/test/templates/html/frame.md +0 -1
- data/lib/amp-html/test/templates/html/frameset.md +0 -1
- data/lib/amp-html/test/templates/html/http-equiv.md +0 -1
- data/lib/amp-html/test/templates/html/iframe.md +0 -1
- data/lib/amp-html/test/templates/html/img.md +0 -1
- data/lib/amp-html/test/templates/html/javascript_include_tag.md +0 -1
- data/lib/amp-html/test/templates/html/object.md +0 -1
- data/lib/amp-html/test/templates/html/onclick.md +0 -1
- data/lib/amp-html/test/templates/html/onmousehover.md +0 -1
- data/lib/amp-html/test/templates/html/param.md +0 -1
- data/lib/amp-html/test/templates/html/stylesheet_link_tag.md +0 -1
- data/lib/amp-html/test/templates/html/video.md +0 -1
- data/lib/amp-html/test/templates/markup/!doctype.md +0 -1
- data/lib/amp-html/test/templates/markup/amp_document_link.md +0 -1
- data/lib/amp-html/test/templates/markup/amp_head.md +0 -1
- data/lib/amp-html/test/templates/markup/amp_html_doctype.md +0 -1
- data/lib/amp-html/test/templates/markup/canonical_document_link.md +0 -1
- data/lib/amp-html/test/templates/markup/head_body.md +0 -1
- data/lib/amp-html/test/templates/markup/html.md +0 -1
- data/lib/amp-html/test/templates/markup/meta_viewport.md +0 -1
- data/lib/amp-html/validate.rb +0 -46
- data/lib/amp-html/validate/help.rb +0 -11
- data/lib/amp-html/validate/templates/README.md +0 -32
- data/lib/generators/amp_html/assets_generator.rb +0 -31
- data/lib/generators/amp_html/bundle_generator.rb +0 -50
- data/lib/generators/amp_html/components_generator.rb +0 -84
- data/lib/generators/amp_html/helpers_generator.rb +0 -32
- data/lib/generators/amp_html/install_generator.rb +0 -53
- data/lib/generators/amp_html/views_generator.rb +0 -62
- data/lib/generators/templates/assets/README.md +0 -0
- data/lib/generators/templates/components/README.md +0 -0
- data/lib/generators/templates/components/views/_components.html.erb +0 -141
- data/lib/generators/templates/components/views/_google_analytics.html.erb +0 -23
- data/lib/generators/templates/helpers/README.md +0 -0
- data/lib/generators/templates/helpers/amp/fallback_tag_helper.rb +0 -16
- data/lib/generators/templates/helpers/amp/font_tag_helper.rb +0 -37
- data/lib/generators/templates/helpers/amp/link_tag_helper.rb +0 -11
- data/lib/generators/templates/helpers/amp/mustache_tag_helper.rb +0 -13
- data/lib/generators/templates/helpers/amp/noscript_tag_helper.rb +0 -13
- data/lib/generators/templates/helpers/amp/placeholder_tag_helper.rb +0 -16
- data/lib/generators/templates/helpers/amp/schema_tag_helper.rb +0 -16
- data/lib/generators/templates/helpers/amp/stylesheets_tag_helper.rb +0 -21
- data/lib/generators/templates/helpers/amp_tag_helper.rb.erb +0 -65
- data/lib/generators/templates/helpers/asset_tag_helper.rb.erb +0 -119
- data/lib/generators/templates/helpers/form_tag_helper.rb.erb +0 -79
- data/lib/generators/templates/install/README.md +0 -0
- data/lib/generators/templates/install/amp-html.rb.erb +0 -19
- data/lib/generators/templates/install/amp-html.yml.erb +0 -189
- data/lib/generators/templates/views/README.md +0 -0
- data/lib/generators/templates/views/application.html.erb +0 -71
- data/lib/generators/templates/views/application/_head.html.erb +0 -47
- data/lib/generators/templates/views/application/_resources.html.erb +0 -16
- data/lib/generators/templates/views/application/_schema.html.erb +0 -6
- data/lib/generators/templates/views/config/mime_types.rb +0 -8
File without changes
|
File without changes
|
@@ -1,141 +0,0 @@
|
|
1
|
-
<!-- ************************** -->
|
2
|
-
<!-- DO NOT ALTER THIS FILE! -->
|
3
|
-
<!-- ************************** -->
|
4
|
-
|
5
|
-
|
6
|
-
<!-- Assets -->
|
7
|
-
|
8
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-anim> (amp_anim helper) for animated images. Learn more: https://www.ampproject.org/docs/guides/author-develop/amp_replacements -->
|
9
|
-
<% if options[:anim] || options[:all] %>
|
10
|
-
<script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-0.1.js"></script>
|
11
|
-
<% else %>
|
12
|
-
<!-- <script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-0.1.js"></script> -->
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
|
16
|
-
<!-- Components -->
|
17
|
-
|
18
|
-
<!-- Forms -->
|
19
|
-
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
|
20
|
-
<%% if AmpHtml.forms_selector %><script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script><%% end %>
|
21
|
-
|
22
|
-
<!-- Mustache.js -->
|
23
|
-
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
|
24
|
-
|
25
|
-
<!-- Lists -->
|
26
|
-
<% if options[:lists] || options[:all] %>
|
27
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-list> (amp_list helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-list -->
|
28
|
-
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script>
|
29
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-live-list> (amp_live_list helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-live-list -->
|
30
|
-
<script async custom-element="amp-live-list" src="https://cdn.ampproject.org/v0/amp-live-list-0.1.js"></script>
|
31
|
-
<% else %>
|
32
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-list> (amp_list helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-list -->
|
33
|
-
<!-- <script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script> -->
|
34
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-live-list> (amp_live_list helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-live-list -->
|
35
|
-
<!-- <script async custom-element="amp-live-list" src="https://cdn.ampproject.org/v0/amp-live-list-0.1.js"></script> -->
|
36
|
-
<% end %>
|
37
|
-
|
38
|
-
<!-- Ads -->
|
39
|
-
<% if options[:ad] || options[:all] %>
|
40
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-ad> (amp_ad helper). Learn more: https://www.ampproject.org/docs/reference/components/ads/amp-ad -->
|
41
|
-
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
|
42
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-sticky-ad> (amp_ad(sticky: true) helper). Learn more: https://www.ampproject.org/docs/reference/components/ads/amp-sticky-ad -->
|
43
|
-
<script async custom-element="amp-sticky-ad" src="https://cdn.ampproject.org/v0/amp-sticky-ad-1.0.js"></script>
|
44
|
-
<% else %>
|
45
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-ad> (amp_ad helper). Learn more: https://www.ampproject.org/docs/reference/components/ads/amp-ad -->
|
46
|
-
<!-- <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script> -->
|
47
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-sticky-ad> (amp_ad(sticky: true) helper). Learn more: https://www.ampproject.org/docs/reference/components/ads/amp-sticky-ad -->
|
48
|
-
<!-- <script async custom-element="amp-sticky-ad" src="https://cdn.ampproject.org/v0/amp-sticky-ad-1.0.js"></script> -->
|
49
|
-
<% end %>
|
50
|
-
|
51
|
-
<!-- iframe -->
|
52
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-iframe> (amp_iframe helper). Learn more: https://www.ampproject.org/docs/guides/author-develop/iframes -->
|
53
|
-
<% if options[:iframe] || options[:javascript] || options[:service_worker] || options[:all] %>
|
54
|
-
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
|
55
|
-
<% else %>
|
56
|
-
<!-- <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script> -->
|
57
|
-
<% end %>
|
58
|
-
|
59
|
-
<!-- iframe -->
|
60
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-install-serviceworker> (amp_serviceworker helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-install-serviceworker -->
|
61
|
-
<% if options[:service_worker] || options[:all] %>
|
62
|
-
<script async custom-element="amp-install-serviceworker" src="https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js"></script>
|
63
|
-
<% else %>
|
64
|
-
<!-- <script async custom-element="amp-install-serviceworker" src="https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js"></script> -->
|
65
|
-
<% end %>
|
66
|
-
|
67
|
-
<!-- Analytics -->
|
68
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-analytics> (amp_analytics helper). Learn more: https://www.ampproject.org/docs/reference/components/ads/amp-analytics -->
|
69
|
-
<% if options[:analytics] || options[:notifications] || options[:all] %>
|
70
|
-
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
|
71
|
-
<% else %>
|
72
|
-
<!-- <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script> -->
|
73
|
-
<% end %>
|
74
|
-
|
75
|
-
<!-- Notifications -->
|
76
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-user-notification> (amp_user_notification helper). Learn more: https://www.ampproject.org/docs/reference/components/dynamic/amp-user-notification -->
|
77
|
-
<% if options[:notifications] || options[:all] %>
|
78
|
-
<script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
|
79
|
-
<% else %>
|
80
|
-
<!-- <script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script> -->
|
81
|
-
<% end %>
|
82
|
-
|
83
|
-
|
84
|
-
<!-- Social -->
|
85
|
-
|
86
|
-
<% if options[:social] || options[:all] %>
|
87
|
-
|
88
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-twitter> (amp_twitter helper) for embedding Twitter Tweets. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
89
|
-
<script async custom-element="amp-twitter" src="https://cdn.ampproject.org/v0/amp-twitter-0.1.js"></script>
|
90
|
-
|
91
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-instagram> (amp_instagram helper) for embedding Instagrams. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
92
|
-
<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script>
|
93
|
-
|
94
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-facebook> (amp_facebook helper) for embedding a Facebook post or video. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
95
|
-
<script async custom-element="amp-facebook" src="https://cdn.ampproject.org/v0/amp-facebook-0.1.js"></script>
|
96
|
-
|
97
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-youtube> (amp_youtube helper) for embedding a YouTube video. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
98
|
-
<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
|
99
|
-
|
100
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-reddit> (amp_reddit helper) for embedding a Reddit post or comment. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-reddit -->
|
101
|
-
<script async custom-element="amp-reddit" src="https://cdn.ampproject.org/v0/amp-reddit-0.1.js"></script>
|
102
|
-
|
103
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-social-share> (amp_social_share helper) for displaying a social share button. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-social-share -->
|
104
|
-
<script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
|
105
|
-
|
106
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-soundcloud> (amp_soundcloud helper) for embedding a SoundCloud track. Learn more: https://www.ampproject.org/docs/reference/components/media/amp-soundcloud -->
|
107
|
-
<script async custom-element="amp-soundcloud" src="https://cdn.ampproject.org/v0/amp-soundcloud-0.1.js"></script>
|
108
|
-
|
109
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-vine> (amp_vine helper) for embedding a Vine. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-vine -->
|
110
|
-
<script async custom-element="amp-vine" src="https://cdn.ampproject.org/v0/amp-vine-0.1.js"></script>
|
111
|
-
|
112
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-gfycat> (amp_gfycat helper) for embedding a Pin it button, Pin widget or follow button. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-pinterest -->
|
113
|
-
<script async custom-element="amp-pinterest" src="https://cdn.ampproject.org/v0/amp-pinterest-0.1.js"></script>
|
114
|
-
|
115
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-gfycat> (amp_gfycat helper) for embedding a Gfycat. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-gfycat -->
|
116
|
-
<script async custom-element="amp-gfycat" src="https://cdn.ampproject.org/v0/amp-gfycat-0.1.js"></script>
|
117
|
-
|
118
|
-
<% else %>
|
119
|
-
|
120
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-twitter> (twitter_tag || amp_twitter_tag helper) for embedding Twitter Tweets. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
121
|
-
<!-- <script async custom-element="amp-twitter" src="https://cdn.ampproject.org/v0/amp-twitter-0.1.js"></script> -->
|
122
|
-
|
123
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-instagram> (instagram_tag || amp_instagram_tag helper) for embedding Instagrams. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
124
|
-
<!-- <script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script> -->
|
125
|
-
|
126
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-facebook> (facebook_tag || amp_facebook_tag helper) for embedding Facebook post or video. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
127
|
-
<!-- <script async custom-element="amp-facebook" src="https://cdn.ampproject.org/v0/amp-facebook-0.1.js"></script> -->
|
128
|
-
|
129
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-youtube> (youtube_tag || amp_youtube_tag helper) for embedding YouTube video. Learn more: https://www.ampproject.org/docs/guides/author-develop/third_party_components -->
|
130
|
-
<!-- <script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script> -->
|
131
|
-
|
132
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-reddit> (amp_reddit helper) for embedding a Reddit post or comment. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-reddit -->
|
133
|
-
<!-- <script async custom-element="amp-reddit" src="https://cdn.ampproject.org/v0/amp-reddit-0.1.js"></script> -->
|
134
|
-
|
135
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-social-share> (amp_social_share helper) for displaying a social share button. Learn more: https://www.ampproject.org/docs/reference/components/social/amp-social-share -->
|
136
|
-
<!-- <script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script> -->
|
137
|
-
|
138
|
-
<!-- **Note:** Uncomment the following script tag to use <amp-soundcloud> (amp_soundcloud helper) for embedding a SoundCloud track. Learn more: https://www.ampproject.org/docs/reference/components/media/amp-soundcloud -->
|
139
|
-
<!-- <script async custom-element="amp-soundcloud" src="https://cdn.ampproject.org/v0/amp-soundcloud-0.1.js"></script> -->
|
140
|
-
|
141
|
-
<% end %>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<script type="application/json">
|
2
|
-
{
|
3
|
-
"vars": {
|
4
|
-
"account": <%%= AmpHtml.google_analytics_account %>
|
5
|
-
},
|
6
|
-
"triggers": {
|
7
|
-
"trackPageview": {
|
8
|
-
"on": "visible",
|
9
|
-
"request": "pageview",
|
10
|
-
}<%% if triggers %>,<%% triggers.each do |name, trigger| %>
|
11
|
-
<%%= name %>: {
|
12
|
-
"on": <%%= trigger.on %>,
|
13
|
-
"request": <%%= trigger.request %><%% if trigger.vars %>,
|
14
|
-
"vars": {<%% trigger.vars.each do |variable| %><%% if variable.event_category %>
|
15
|
-
"eventCategory": <%%= variable.event_category %>,<%% end %><%% if variable.event_action %>
|
16
|
-
"eventAction": <%%= variable.event_action %><%% end %><%% if variable.title %>
|
17
|
-
"title": <%%= variable.title %>,<%% end %><%% if variable.document_location %>
|
18
|
-
"documentLocation": <%%= variable.document_location %><%% end %>
|
19
|
-
}<%% end %>
|
20
|
-
}<%% unless trigger == triggers.last %>,<%% end %><%% end %><%% end %>
|
21
|
-
}
|
22
|
-
}
|
23
|
-
</script>
|
File without changes
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::FallbackTagHelper
|
3
|
-
|
4
|
-
def amp_fallback(name, options = {}, &block)
|
5
|
-
options = options.symbolize_keys
|
6
|
-
options.merge(fallback: "")
|
7
|
-
|
8
|
-
if block_given?
|
9
|
-
content_tag(name, capture(&block), options)
|
10
|
-
else
|
11
|
-
content_tag(name, nil, options)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::FontTagHelper
|
3
|
-
|
4
|
-
# # Requires script
|
5
|
-
# def amp_font(family, timeout, options = {})
|
6
|
-
# options = options.symbolize_keys
|
7
|
-
#
|
8
|
-
# options[:"font-family"] = family
|
9
|
-
# options[:timeout] = timeout
|
10
|
-
#
|
11
|
-
# content_tag("amp-font", options)
|
12
|
-
# end
|
13
|
-
|
14
|
-
def amp_font_link href
|
15
|
-
options = {}
|
16
|
-
|
17
|
-
options[:href] = href
|
18
|
-
options[:rel] = 'stylesheet'
|
19
|
-
warn 'WARNING (AMP): For including custom fonts, origins must be whitelisted - use `@font-face` instead. Learn more: https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#custom-fonts' unless href.include?('fonts.googleapis.com') || href.include?('fast.fonts.net') || href.include?('cloud.typography.com') || href.include?('maxcdn.bootstrapcdn.com')
|
20
|
-
|
21
|
-
content_tag 'link', options
|
22
|
-
end
|
23
|
-
|
24
|
-
def amp_google_font family, types = {}
|
25
|
-
options = {}
|
26
|
-
|
27
|
-
href = 'https://fonts.googleapis.com/css?family=' + family.gsub(' ', '+')
|
28
|
-
href = href + ':' + types.map(&:to_s).join(',') if types.size > 0
|
29
|
-
|
30
|
-
options[:href] = href
|
31
|
-
options[:rel] = 'stylesheet'
|
32
|
-
|
33
|
-
content_tag 'link', options
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::PlaceholderTagHelper
|
3
|
-
|
4
|
-
def amp_placeholder(name, options = {}, &block)
|
5
|
-
options = options.symbolize_keys
|
6
|
-
options[:placeholder] = ""
|
7
|
-
|
8
|
-
if block_given?
|
9
|
-
content_tag(name, capture(&block), options)
|
10
|
-
else
|
11
|
-
content_tag(name, nil, options)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::SchemaTagHelper
|
3
|
-
|
4
|
-
def schema_tag(options = {})
|
5
|
-
options = options.symbolize_keys
|
6
|
-
|
7
|
-
options[:@type] = AmpHtml.application_type if AmpHtml.application_type && options[:@type] == nil
|
8
|
-
options[:headline] = AmpHtml.application_name if AmpHtml.application_name && options[:headline] == nil
|
9
|
-
options[:datePublished] = AmpHtml.application_date_published if AmpHtml.application_date_published && options[:datePublished] == nil
|
10
|
-
options[:image] = AmpHtml.application_image if AmpHtml.application_image && options[:image] == nil
|
11
|
-
|
12
|
-
render 'application/amp/schema', options: options
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::StylesheetsTagHelper
|
3
|
-
|
4
|
-
def amp_css &block
|
5
|
-
if block_given?
|
6
|
-
content_for :css, capture(&block)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
# def amp_css_link(href)
|
11
|
-
# end
|
12
|
-
|
13
|
-
def amp_global_css &block
|
14
|
-
warn 'AMP-HTML WARNING: `amp_global_css` is deprecated and will be removed in amp-html 2.0 - use `amp_css` instead'
|
15
|
-
if block_given?
|
16
|
-
content_for :global_css, capture(&block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
module Amp::AmpTagHelper
|
3
|
-
|
4
|
-
def amp_html_doctype &block
|
5
|
-
doctype = render html: '<!doctype html>'.html_safe
|
6
|
-
if block_given?
|
7
|
-
html = content_tag 'html', capture(&block), ⚡: ''
|
8
|
-
else
|
9
|
-
html = content_tag 'html', nil, ⚡: ''
|
10
|
-
end
|
11
|
-
doctype + html
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
<% if options[:split] %>
|
16
|
-
def amp_document_link href = request.original_url
|
17
|
-
options = {}
|
18
|
-
options[:href] = href
|
19
|
-
options[:rel] = 'amphtml'
|
20
|
-
tag "link", options
|
21
|
-
end
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
def canonical_document_link href = request.original_url
|
25
|
-
options = {}
|
26
|
-
options[:href] = href
|
27
|
-
options[:rel] = 'canonical'
|
28
|
-
tag "link", options
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
def amp_head options = {}
|
33
|
-
options = options.symbolize_keys
|
34
|
-
|
35
|
-
head = render 'application/amp/head', options: options
|
36
|
-
|
37
|
-
resources = render 'application/amp/resources'
|
38
|
-
components = render 'application/amp/components'
|
39
|
-
|
40
|
-
head + resources + components
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
def amp_resources
|
45
|
-
warn 'AMP-HTML WARNING: `amp_resources` is deprecated and will be removed in amphtml 1.0 - use `amp_head` instead'
|
46
|
-
resources = render 'application/amp/resources'
|
47
|
-
components = render 'application/amp/components'
|
48
|
-
resources + components
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def amp?
|
53
|
-
unless AmpHtml.split_view
|
54
|
-
true
|
55
|
-
else
|
56
|
-
if request.format = AmpHtml.default_format
|
57
|
-
true
|
58
|
-
else
|
59
|
-
false
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/array/extract_options"
|
2
|
-
require "active_support/core_ext/hash/keys"
|
3
|
-
require "action_view/helpers/asset_url_helper"
|
4
|
-
require "action_view/helpers/tag_helper"
|
5
|
-
|
6
|
-
module AssetTagHelper
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
include ::ActionView::Helpers::AssetUrlHelper
|
10
|
-
include ::ActionView::Helpers::TagHelper
|
11
|
-
|
12
|
-
<% unless options[:split] %>
|
13
|
-
def javascript_include_tag(*sources)
|
14
|
-
warn "AMP-HTML WARNING: external and internal scripts are not allowed in an AMP document"
|
15
|
-
super
|
16
|
-
end
|
17
|
-
def stylesheet_link_tag(*sources)
|
18
|
-
warn "AMP-HTML WARNING: external and internal stylesheets are not allowed in an AMP document"
|
19
|
-
super
|
20
|
-
end
|
21
|
-
<% else %>
|
22
|
-
# def javascript_include_tag(*sources)
|
23
|
-
# warn "AMP-HTML WARNING: external and internal scripts are not allowed in an AMP document"
|
24
|
-
# super
|
25
|
-
# end
|
26
|
-
# def stylesheet_link_tag(*sources)
|
27
|
-
# warn "AMP-HTML WARNING: external and internal stylesheets are not allowed in an AMP document"
|
28
|
-
# super
|
29
|
-
# end
|
30
|
-
<% end %>
|
31
|
-
|
32
|
-
|
33
|
-
def amp_image(source, options = {})
|
34
|
-
options = options.symbolize_keys
|
35
|
-
check_for_image_tag_errors(options)
|
36
|
-
|
37
|
-
src = options[:src] = path_to_image(source, skip_pipeline: options.delete(:skip_pipeline))
|
38
|
-
|
39
|
-
unless src.start_with?("cid:") || src.start_with?("data:") || src.blank?
|
40
|
-
options[:alt] = options.fetch(:alt) { image_alt(src) }
|
41
|
-
end
|
42
|
-
|
43
|
-
options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]
|
44
|
-
warn "WARNING (AMP): specify width and height of amp-img tags." unless options[:width] && options[:height]
|
45
|
-
|
46
|
-
options[:layout] = "responsive" unless options[:layout] != "responsive"
|
47
|
-
content_tag("amp-img", options) do
|
48
|
-
noscript_tag
|
49
|
-
end
|
50
|
-
end
|
51
|
-
<% unless options[:split] %>
|
52
|
-
def image_tag(source, options = {})
|
53
|
-
amp_image(source, options)
|
54
|
-
end
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
def amp_video(*sources)
|
58
|
-
options = sources.extract_options!.symbolize_keys
|
59
|
-
options[:fallback] = "Your browser doesn’t support HTML5 video" unless options[:fallback]
|
60
|
-
public_poster_folder = options.delete(:poster_skip_pipeline)
|
61
|
-
sources << options
|
62
|
-
multiple_sources_tag_builder("amp-video", sources, fallback) do |tag_options|
|
63
|
-
tag_options[:poster] = path_to_image(tag_options[:poster], skip_pipeline: public_poster_folder) if tag_options[:poster]
|
64
|
-
tag_options[:width], tag_options[:height] = extract_dimensions(tag_options.delete(:size)) if tag_options[:size]
|
65
|
-
warn "WARNING (AMP): specify width and height of amp-video tags." unless tag_options[:width] && tag_options[:height]
|
66
|
-
tag_options[:layout] = "responsive" unless tag_options[:layout] != "responsive"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
<% unless options[:split] %>
|
70
|
-
def video_tag(*sources)
|
71
|
-
options[:fallback] = "Your browser doesn’t support HTML5 video" unless options[:fallback]
|
72
|
-
amp_video(*sources, fallback)
|
73
|
-
end
|
74
|
-
<% end %>
|
75
|
-
|
76
|
-
def amp_audio(*sources)
|
77
|
-
options = sources.extract_options!.symbolize_keys
|
78
|
-
options[:fallback] = "Your browser doesn’t support HTML5 audio" unless options[:fallback]
|
79
|
-
multiple_sources_tag_builder("amp-audio", sources, options)
|
80
|
-
end
|
81
|
-
<% unless options[:split] %>
|
82
|
-
def audio_tag(*sources)
|
83
|
-
options = sources.extract_options!.symbolize_keys
|
84
|
-
options[:fallback] = "Your browser doesn’t support HTML5 audio" unless options[:fallback]
|
85
|
-
amp_audio(*sources, options)
|
86
|
-
end
|
87
|
-
<% end %>
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def multiple_sources_tag_builder(type, sources, fallback)
|
92
|
-
options = sources.extract_options!.symbolize_keys
|
93
|
-
skip_pipeline = options.delete(:skip_pipeline)
|
94
|
-
sources.flatten!
|
95
|
-
|
96
|
-
yield options if block_given?
|
97
|
-
|
98
|
-
if sources.size > 1
|
99
|
-
content_tag(type, options) do
|
100
|
-
safe_join sources.map { |source| tag("source", src: send("path_to_#{type}", source, skip_pipeline: skip_pipeline)) }
|
101
|
-
if fallback.present?
|
102
|
-
content_tag("div", nil, {fallback: true}) do
|
103
|
-
content_tag("p", fallback)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
else
|
108
|
-
options[:src] = send("path_to_#{type}", sources.first, skip_pipeline: skip_pipeline)
|
109
|
-
content_tag(type, nil, options) do
|
110
|
-
if fallback.present?
|
111
|
-
content_tag("div", nil, {fallback: true}) do
|
112
|
-
content_tag("p", fallback)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|