share_with 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ ---
2
+ :info:
3
+ :name: 'Tumblr'
4
+ :classname: 'tumblr'
5
+ :home_page: 'https://www.tumblr.com'
6
+ :language_area: :general
7
+ :description: |-
8
+ Tumblr is where your interests connect you with your people.
9
+ :link: 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=<params.url>&title=<params.title>&content=<params.content>&caption=<params.caption>&tags=<params.tags>'
10
+ :inherit_from: '_base'
11
+ :si_icon: 'tumblr'
12
+ :fa_icon: 'fab fa-tumblr'
13
+ :bi_icon: 'bi-box-arrow-in-right'
14
+ :extend_with:
15
+ - 'icons.simple_icons'
16
+
17
+ :params:
18
+ :content:
19
+ :type: :encoded_url_param
20
+ :default: ''
21
+ :caption:
22
+ :type: :encoded_url_param
23
+ :default: ''
24
+ :tags:
25
+ :type: :string_list
26
+ :default: ''
27
+ :blog_name:
28
+ :type: :encoded_url_param
29
+ :default: ''
30
+ :data_counter:
31
+ :type: :select
32
+ :default: 'right'
33
+ :options:
34
+ top: 'Top'
35
+ right: 'Right'
36
+ none: 'None'
37
+ :data_color:
38
+ :type: :select
39
+ :default: 'blue'
40
+ :options:
41
+ blue: 'Blue'
42
+ white: 'White'
43
+ black: 'Black'
44
+ :data_locale:
45
+ :type: :select
46
+ :default: 'en_US'
47
+ :options:
48
+ en_US: 'English'
49
+ de_DE: 'German'
50
+ fr_FR: 'French'
51
+ it_IT: 'Italian'
52
+ ja_JP: 'Japanese'
53
+ tr_TR: 'Turkish'
54
+ es_ES: 'Spanish'
55
+ ru_RU: 'Russian'
56
+ pl_PL: 'Polish'
57
+ pt_PT: 'Portuguese (Portugal)'
58
+ pt_BR: 'Portuguese (Brazil)'
59
+ nl_NL: 'Dutch'
60
+ ko_KR: 'Korean'
61
+ zh_CN: 'Chinese (Simplified)'
62
+ zh_TW: 'Chinese (Traditional)'
63
+
64
+ :templates:
65
+ :post_button:
66
+ :requires: :body_js
67
+ :content:
68
+ a:
69
+ :attr:
70
+ class: 'tumblr-share-button'
71
+ data-color: '<params.data_color>'
72
+ data-notes: '<params.data_counter.key>'
73
+ data-locale: '<params.data_locale.key>'
74
+ href: 'https://embed.tumblr.com/share'
75
+ :content: ''
76
+ :body_js:
77
+ :content:
78
+ script:
79
+ :content: |-
80
+ !function(d,s,id){
81
+ var js,ajs=d.getElementsByTagName(s)[0];
82
+ if(!d.getElementById(id)){js=d.createElement(s);
83
+ js.id=id;
84
+ js.src="https://assets.tumblr.com/share-button.js";
85
+ ajs.parentNode.insertBefore(js,ajs);}
86
+ }(document, "script", "tumblr-js");
87
+ :follow_button:
88
+ :content:
89
+ iframe:
90
+ :attr:
91
+ class: 'btn'
92
+ frameborder: '0'
93
+ border: '0'
94
+ scrolling: 'no'
95
+ allowtransparency: 'true'
96
+ height: '20'
97
+ width: '65'
98
+ src: 'https://platform.tumblr.com/v2/follow_button.html?type=follow&amp;tumblelog=<params.blog_name>&amp;color=<params.data_color.key>'
@@ -0,0 +1,64 @@
1
+ ---
2
+ :info:
3
+ :name: 'Twitter'
4
+ :classname: 'twitter'
5
+ :home_page: 'https://twitter.com'
6
+ :language_area: :general
7
+ :description: |-
8
+ Twitter is what's happening in the world and what people are talking about right now.
9
+ :link: 'https://twitter.com/share?text=<params.title>&url=<params.url>[&via=<params.via>]&related=<params.related>&hashtags=<params.hashtags>'
10
+ :inherit_from: '_base'
11
+ :si_icon: 'twitter'
12
+ :fa_icon: 'fab fa-twitter'
13
+ :bi_icon: 'bi-twitter'
14
+ :extend_with:
15
+ - 'icons.simple_icons'
16
+
17
+ :params:
18
+ :related:
19
+ :default: ''
20
+ :type: :string_list
21
+ :hashtags:
22
+ :default: ''
23
+ :type: :string_list
24
+ :via:
25
+ :default: ''
26
+ :type: :encoded_url_param
27
+ :data_url:
28
+ :default: ''
29
+ :type: :plain_text
30
+ :data_size:
31
+ :type: :select
32
+ :default: 'large'
33
+ :options:
34
+ small: 'Small'
35
+ large: 'Large'
36
+ :data_text:
37
+ :type: :encoded_text
38
+ :default: ''
39
+
40
+ :templates:
41
+ :button:
42
+ :requires: :head_js
43
+ :content:
44
+ a:
45
+ :attr:
46
+ href: 'https://twitter.com/share'
47
+ class: 'twitter-share-button'
48
+ data-text: '<params.data_text>'
49
+ data-url: '<params.data_url>'
50
+ data-hashtags: '<params.hashtags>'
51
+ data-related: '<params.related>'
52
+ data-via: '<params.via>'
53
+ data-size: '<params.data_size.key>'
54
+ data-show-count: 'false'
55
+ :content: 'Tweet'
56
+ :head_js:
57
+ :content:
58
+ script:
59
+ :attr:
60
+ type: 'text/javascript'
61
+ async:
62
+ src: 'https://platform.twitter.com/widgets.js'
63
+ charset: 'utf-8'
64
+ :content: ''
@@ -0,0 +1,46 @@
1
+ ---
2
+ :info:
3
+ :name: 'Whatsapp'
4
+ :classname: 'whatsapp'
5
+ :language_area: :general
6
+ :description: |-
7
+ Whatsapp is an instant messaging and voice over IP service.
8
+ :link: 'whatsapp://send?text=<params.title>%20<params.url>'
9
+ :inherit_from: '_base'
10
+ :si_icon: 'whatsapp'
11
+ :fa_icon: 'fab fa-whatsapp'
12
+ :bi_icon: 'bi-whatsapp'
13
+ :extend_with:
14
+ - 'icons.simple_icons'
15
+
16
+ :templates:
17
+ :icon:
18
+ :content:
19
+ a:
20
+ :attr:
21
+ href: '<info.link>'
22
+ title: 'Share with <info.name>'
23
+ class: 'share-with-<info.icon>'
24
+ data-action: 'share/whatsapp/share'
25
+ target: '_blank'
26
+ :content: '<includes.service_icon>'
27
+ :icon_and_text:
28
+ :content:
29
+ a:
30
+ :attr:
31
+ href: '<info.link>'
32
+ title: 'Share with <info.name>'
33
+ class: 'share-with-<info.icon>'
34
+ data-action: 'share/whatsapp/share'
35
+ target: '_blank'
36
+ :content: '<includes.service_icon> <info.name>'
37
+ :text:
38
+ :content:
39
+ a:
40
+ :attr:
41
+ href: '<info.link>'
42
+ title: 'Share with <info.name>'
43
+ class: 'share-with-<info.icon>'
44
+ data-action: 'share/whatsapp/share'
45
+ target: '_blank'
46
+ :content: '<info.name>'
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "erb"
4
+ require "loofah"
5
+
6
+ module ShareWith
7
+ #
8
+ # Monkey patching of the String class.
9
+ #
10
+ class ::String
11
+ def to_escaped_html
12
+ ERB::Util.html_escape(self)
13
+ end
14
+
15
+ def to_encoded_url_param
16
+ ERB::Util.url_encode(self)
17
+ end
18
+
19
+ def to_plain_text
20
+ Loofah.fragment(self).text
21
+ end
22
+ end
23
+
24
+ #
25
+ # Monkey patching of the Array class.
26
+ #
27
+ class ::Array
28
+ def to_text_list(separator = ",")
29
+ map do |x|
30
+ x.to_s.to_plain_text.gsub(/[^a-z]/, "")
31
+ end.join(separator)
32
+ end
33
+ end
34
+
35
+ #
36
+ # Invalid service error.
37
+ #
38
+ class InvalidService < StandardError
39
+ def initialize(name)
40
+ super "Invalid service: #{name}"
41
+ end
42
+ end
43
+
44
+ #
45
+ # Invalid layer error.
46
+ #
47
+ class InvalidLayer < StandardError
48
+ def initialize(args)
49
+ super "Invalid layer: #{args[1]} in #{args[0]} service"
50
+ end
51
+ end
52
+
53
+ #
54
+ # Invalid data type error.
55
+ #
56
+ class InvalidDataType < StandardError
57
+ def initialize(type)
58
+ super "Invalid data type: #{type}"
59
+ end
60
+ end
61
+
62
+ #
63
+ # Invalid value error.
64
+ #
65
+ class InvalidValue < StandardError
66
+ def initialize(args)
67
+ super "Invalid value: #{args[0]}, the allowed values are: #{args[1].join(", ")}"
68
+ end
69
+ end
70
+
71
+ #
72
+ # Invalid template error,
73
+ #
74
+ class InvalidTemplate < StandardError
75
+ def initialize(template)
76
+ super "Invalid template: #{template}"
77
+ end
78
+ end
79
+
80
+ #
81
+ # Invalid context error.
82
+ #
83
+ class InvalidContext < StandardError
84
+ def initialize(context)
85
+ super "Invalid context: #{context}"
86
+ end
87
+ end
88
+
89
+ #
90
+ # Invalid param error.
91
+ #
92
+ class InvalidParam < StandardError
93
+ def initialize(var_name)
94
+ super "Invalid param: #{var_name}"
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShareWith
4
+ VERSION = "1.0.0"
5
+ end
data/lib/share_with.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "share_with/version"
4
+ require_relative "share_with/utils"
5
+ require_relative "share_with/collection"
6
+ require_relative "share_with/placeholders"
7
+ require_relative "share_with/link_factory"
8
+ require_relative "share_with/service"
9
+ require_relative "share_with/service_data"
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/share_with/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "share_with"
7
+ spec.version = ShareWith::VERSION
8
+ spec.authors = ["Fabio Mucciante"]
9
+ spec.email = ["fabio.mucciante@gmail.com"]
10
+
11
+ spec.summary = "Encodes the sharing links from social networks and similar services."
12
+ spec.description = "Model and build up sharing links from yaml files to HTML code."
13
+ spec.homepage = "https://freeaptitude.altervista.org/projects/share-with.html"
14
+ spec.license = "GPL-3.0"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/fabiomux/share_with"
21
+ spec.metadata["changelog_uri"] = "https://freeaptitude.altervista.org/projects/share-with.html#changelog"
22
+ spec.metadata["wiki_uri"] = "https://github.com/fabiomux/share_with/wiki"
23
+ spec.metadata["rubygems_mfa_required"] = "true"
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(__dir__) do
28
+ `git ls-files -z`.split("\x0").reject do |f|
29
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
30
+ end
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_dependency "erb"
37
+ spec.add_dependency "loofah"
38
+
39
+ # For more information and examples about making a new gem, check out our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
@@ -0,0 +1,4 @@
1
+ module ShareWith
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: share_with
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Mucciante
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: erb
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: loofah
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Model and build up sharing links from yaml files to HTML code.
42
+ email:
43
+ - fabio.mucciante@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rspec"
49
+ - ".rubocop.yml"
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - LICENSE
54
+ - README.md
55
+ - Rakefile
56
+ - lib/share_with.rb
57
+ - lib/share_with/collection.rb
58
+ - lib/share_with/link_factory.rb
59
+ - lib/share_with/placeholders.rb
60
+ - lib/share_with/service.rb
61
+ - lib/share_with/service_data.rb
62
+ - lib/share_with/services/_base.yaml
63
+ - lib/share_with/services/_icons.yaml
64
+ - lib/share_with/services/buymeacoffee.yaml
65
+ - lib/share_with/services/cc.yaml
66
+ - lib/share_with/services/email.yaml
67
+ - lib/share_with/services/facebook.yaml
68
+ - lib/share_with/services/flipboard.yaml
69
+ - lib/share_with/services/linkedin.yaml
70
+ - lib/share_with/services/odnoklassniki.yaml
71
+ - lib/share_with/services/pinterest.yaml
72
+ - lib/share_with/services/pocket.yaml
73
+ - lib/share_with/services/reddit.yaml
74
+ - lib/share_with/services/telegram.yaml
75
+ - lib/share_with/services/tumblr.yaml
76
+ - lib/share_with/services/twitter.yaml
77
+ - lib/share_with/services/whatsapp.yaml
78
+ - lib/share_with/utils.rb
79
+ - lib/share_with/version.rb
80
+ - share_with.gemspec
81
+ - sig/share_with.rbs
82
+ homepage: https://freeaptitude.altervista.org/projects/share-with.html
83
+ licenses:
84
+ - GPL-3.0
85
+ metadata:
86
+ homepage_uri: https://freeaptitude.altervista.org/projects/share-with.html
87
+ source_code_uri: https://github.com/fabiomux/share_with
88
+ changelog_uri: https://freeaptitude.altervista.org/projects/share-with.html#changelog
89
+ wiki_uri: https://github.com/fabiomux/share_with/wiki
90
+ rubygems_mfa_required: 'true'
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 2.6.0
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.4.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Encodes the sharing links from social networks and similar services.
110
+ test_files: []