jekyll-twitch 0.2.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/checks.yml +25 -0
- data/.github/workflows/deploy-demo.yml +17 -0
- data/.jekyll-cache/Jekyll/Cache/Jekyll--Cache/b7/9606fb3afea5bd1609ed40b622142f1c98125abcfe89a76a661b0e8e343910 +1 -0
- data/.jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/63/7e252fa8460c2278df772e6dfbf4934329e2f03a9174070b70d0883886b435 +11 -0
- data/.jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/e3/b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +2 -0
- data/.jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/fd/aa4200cef2544ec568b25970b3a49cf9b4f3d7015485506ccda914caf9c5b9 +19 -0
- data/.rubocop.yml +24 -0
- data/CONTRIBUTING.md +32 -0
- data/Gemfile +8 -4
- data/Gemfile.lock +40 -17
- data/README.md +50 -10
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/docs/.gitignore +5 -0
- data/docs/404.html +25 -0
- data/docs/Gemfile +42 -0
- data/docs/Gemfile.lock +119 -0
- data/docs/_config.yml +54 -0
- data/docs/_posts/2021-04-23-Version-1-Released.md +9 -0
- data/docs/_posts/2022-10-17-Version-1.0.1-Released.md +9 -0
- data/docs/channel.md +17 -0
- data/docs/clips.md +17 -0
- data/docs/collection.md +17 -0
- data/docs/index.markdown +35 -0
- data/docs/videos.md +17 -0
- data/jekyll-twitch.gemspec +17 -14
- data/lib/jekyll-twitch/twitch_tag.rb +39 -10
- data/lib/jekyll-twitch/version.rb +3 -1
- data/lib/jekyll-twitch.rb +5 -2
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a55749b9d60817241db98a15db62ca1c715c81cc00430253123244fc4280795f
|
4
|
+
data.tar.gz: 1ed87896070266cb77c96ac8da604e1c80445f87c8a93d5e7e47875c90db8387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c153844c2a5295362172f491d33b5d1d0e1b2c1f267b4fd6d6f56d1e63c3f6c3d5d5813d7066b582e2f8e68378b1a956008f2b8d2af2eda488cd3c11114131
|
7
|
+
data.tar.gz: 2924ab54374abccfda4f49fc06b44309e213b7b505b36d67451a6b52e7a16cf047d1bd0ef4ec0696e8bbd42526bb155e8d21fdfc769c1a13611dedbc3bced8a1
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Check Code
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
lint:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- uses: ruby/setup-ruby@v1
|
11
|
+
with:
|
12
|
+
ruby-version: 2.7.2
|
13
|
+
- run: bundle install
|
14
|
+
- name: Rubocop
|
15
|
+
run: bundle exec rubocop
|
16
|
+
test:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 2.7.2
|
23
|
+
- run: bundle install
|
24
|
+
- name: RSpec
|
25
|
+
run: bundle exec rspec
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Build and deploy Jekyll site to GitHub Pages
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
github-pages:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: helaili/jekyll-action@v2
|
14
|
+
with:
|
15
|
+
jekyll_src: 'docs'
|
16
|
+
target_branch: 'gh-pages'
|
17
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1 @@
|
|
1
|
+
I"u{"source"=>"/home/chael/Code/jekyll-twitch", "destination"=>"/home/chael/Code/jekyll-twitch/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>[".htaccess"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>nil, "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false, "syntax_highlighter"=>"rouge", "syntax_highlighter_opts"=>{:default_lang=>"plaintext", :guess_lang=>true}, "coderay"=>{}}, "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>nil}:ET
|
@@ -0,0 +1,11 @@
|
|
1
|
+
I"<p>This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at <a href="https://jekyllrb.com/">jekyllrb.com</a></p>
|
2
|
+
|
3
|
+
<p>You can find the source code for Minima at GitHub:
|
4
|
+
<a href="https://github.com/jekyll">jekyll</a> /
|
5
|
+
<a href="https://github.com/jekyll/minima">minima</a></p>
|
6
|
+
|
7
|
+
<p>You can find the source code for Jekyll at GitHub:
|
8
|
+
<a href="https://github.com/jekyll">jekyll</a> /
|
9
|
+
<a href="https://github.com/jekyll/jekyll">jekyll</a></p>
|
10
|
+
|
11
|
+
:ET
|
@@ -0,0 +1,19 @@
|
|
1
|
+
I"9<p>You’ll find this post in your <code class="language-plaintext highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="language-plaintext highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>
|
2
|
+
|
3
|
+
<p>Jekyll requires blog post files to be named according to the following format:</p>
|
4
|
+
|
5
|
+
<p><code class="language-plaintext highlighter-rouge">YEAR-MONTH-DAY-title.MARKUP</code></p>
|
6
|
+
|
7
|
+
<p>Where <code class="language-plaintext highlighter-rouge">YEAR</code> is a four-digit number, <code class="language-plaintext highlighter-rouge">MONTH</code> and <code class="language-plaintext highlighter-rouge">DAY</code> are both two-digit numbers, and <code class="language-plaintext highlighter-rouge">MARKUP</code> is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>
|
8
|
+
|
9
|
+
<p>Jekyll also offers powerful support for code snippets:</p>
|
10
|
+
|
11
|
+
<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
|
12
|
+
<span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
|
13
|
+
<span class="k">end</span>
|
14
|
+
<span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
|
15
|
+
<span class="c1">#=> prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>
|
16
|
+
|
17
|
+
<p>Check out the <a href="https://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p>
|
18
|
+
|
19
|
+
:ET
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Hey maintainer!
|
2
|
+
# Don't forget you can exclude individual examples using
|
3
|
+
# rubocop:disable RSpec/ExampleLength
|
4
|
+
# You're smarter than the machine!
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
SuggestExtensions: false
|
8
|
+
NewCops: enable
|
9
|
+
require:
|
10
|
+
- rubocop-rspec
|
11
|
+
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- 'spec/**/*'
|
15
|
+
|
16
|
+
Naming/FileName:
|
17
|
+
Exclude:
|
18
|
+
- 'lib/jekyll-twitch.rb'
|
19
|
+
|
20
|
+
RSpec/ImplicitSubject:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
RSpec/NestedGroups:
|
24
|
+
Enabled: false
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Contributing
|
2
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ChaelCodes/jekyll-twitch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ChaelCodes/jekyll-twitch/blob/main/CODE_OF_CONDUCT.md).
|
3
|
+
|
4
|
+
## Gem Development
|
5
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
6
|
+
|
7
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
8
|
+
|
9
|
+
## Demo Site Development
|
10
|
+
Jekyll-Twitch has a demo site for testing and demonstrating its capabilities. It is located in [docs](/docs) and deployed via [GitHub Actions](.github/workflows/deploy-demo.yml) to GitHub Pages. It uses the copy of jekyll-twitch available on main, but can be customized to look at a specific branch in the [Gemfile](docs/Gemfile).
|
11
|
+
|
12
|
+
### Run it locally
|
13
|
+
|
14
|
+
1. navigate to the docs directory `cd docs`
|
15
|
+
1. `bundle install` Installs all gems and dependencies according to Gemfile.lock
|
16
|
+
1. `bundle update jekyll-twitch` Updates Jekyll-twitch to the newest version from main
|
17
|
+
1. `bundle exec jekyll serve --host localhost --port 4000` Run the server - we need the port and host for Twitch's embeds
|
18
|
+
|
19
|
+
Website should be up and running at [http://localhost:4000/jekyll-twitch/](http://localhost:4000/jekyll-twitch/)
|
20
|
+
|
21
|
+
You will need to rerun steps 3 and 4 whenever there are changes on main or pushed to your branch that you want to test on the site.
|
22
|
+
|
23
|
+
## Release a new Version
|
24
|
+
- Ensure all desired changes are merged to the `main` branch
|
25
|
+
- checkout a branch with the version number eg. `git checkout -b 1.0.1`
|
26
|
+
- Update the version number in [version.rb](lib/jekyll-twitch/version.rb)
|
27
|
+
- We use [semantic versioning](https://semver.org/)
|
28
|
+
- Add a new post to the demo site describing the changes, and linking to the PRs that changed them
|
29
|
+
- `bundle update jekyll-twitch` on the docs site to get the newest changes from `main`
|
30
|
+
- Test `main` on the demo site
|
31
|
+
- Run `bundle exec rake release`
|
32
|
+
- This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Gemfile
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in jekyll-twitch.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
|
-
gem
|
7
|
-
gem
|
8
|
+
gem 'rake', '~> 12.0'
|
9
|
+
gem 'rspec', '~> 3.0'
|
10
|
+
gem 'rubocop'
|
11
|
+
gem 'rubocop-rspec'
|
8
12
|
|
9
|
-
gem
|
13
|
+
gem 'pry', '~> 0.14.0'
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-twitch (0.1
|
4
|
+
jekyll-twitch (1.0.1)
|
5
5
|
jekyll
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
11
|
-
public_suffix (>= 2.0.2, <
|
10
|
+
addressable (2.8.1)
|
11
|
+
public_suffix (>= 2.0.2, < 6.0)
|
12
|
+
ast (2.4.2)
|
12
13
|
coderay (1.1.3)
|
13
14
|
colorator (1.1.0)
|
14
|
-
concurrent-ruby (1.1.
|
15
|
+
concurrent-ruby (1.1.10)
|
15
16
|
diff-lcs (1.4.4)
|
16
|
-
em-websocket (0.5.
|
17
|
+
em-websocket (0.5.3)
|
17
18
|
eventmachine (>= 0.12.9)
|
18
|
-
http_parser.rb (~> 0
|
19
|
+
http_parser.rb (~> 0)
|
19
20
|
eventmachine (1.2.7)
|
20
|
-
ffi (1.15.
|
21
|
+
ffi (1.15.5)
|
21
22
|
forwardable-extended (2.6.0)
|
22
|
-
http_parser.rb (0.
|
23
|
-
i18n (1.
|
23
|
+
http_parser.rb (0.8.0)
|
24
|
+
i18n (1.12.0)
|
24
25
|
concurrent-ruby (~> 1.0)
|
25
|
-
jekyll (4.2.
|
26
|
+
jekyll (4.2.2)
|
26
27
|
addressable (~> 2.4)
|
27
28
|
colorator (~> 1.0)
|
28
29
|
em-websocket (~> 0.5)
|
@@ -37,32 +38,37 @@ GEM
|
|
37
38
|
rouge (~> 3.0)
|
38
39
|
safe_yaml (~> 1.0)
|
39
40
|
terminal-table (~> 2.0)
|
40
|
-
jekyll-sass-converter (2.
|
41
|
+
jekyll-sass-converter (2.2.0)
|
41
42
|
sassc (> 2.0.1, < 3.0)
|
42
43
|
jekyll-watch (2.2.1)
|
43
44
|
listen (~> 3.0)
|
44
|
-
kramdown (2.
|
45
|
+
kramdown (2.4.0)
|
45
46
|
rexml
|
46
47
|
kramdown-parser-gfm (1.1.0)
|
47
48
|
kramdown (~> 2.0)
|
48
49
|
liquid (4.0.3)
|
49
|
-
listen (3.
|
50
|
+
listen (3.7.1)
|
50
51
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
51
52
|
rb-inotify (~> 0.9, >= 0.9.10)
|
52
53
|
mercenary (0.4.0)
|
53
54
|
method_source (1.0.0)
|
55
|
+
parallel (1.20.1)
|
56
|
+
parser (3.0.0.0)
|
57
|
+
ast (~> 2.4.1)
|
54
58
|
pathutil (0.16.2)
|
55
59
|
forwardable-extended (~> 2.6)
|
56
60
|
pry (0.14.0)
|
57
61
|
coderay (~> 1.1)
|
58
62
|
method_source (~> 1.0)
|
59
|
-
public_suffix (
|
63
|
+
public_suffix (5.0.0)
|
64
|
+
rainbow (3.0.0)
|
60
65
|
rake (12.3.3)
|
61
|
-
rb-fsevent (0.
|
66
|
+
rb-fsevent (0.11.2)
|
62
67
|
rb-inotify (0.10.1)
|
63
68
|
ffi (~> 1.0)
|
64
|
-
|
65
|
-
|
69
|
+
regexp_parser (2.1.1)
|
70
|
+
rexml (3.2.5)
|
71
|
+
rouge (3.30.0)
|
66
72
|
rspec (3.10.0)
|
67
73
|
rspec-core (~> 3.10.0)
|
68
74
|
rspec-expectations (~> 3.10.0)
|
@@ -76,6 +82,21 @@ GEM
|
|
76
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
83
|
rspec-support (~> 3.10.0)
|
78
84
|
rspec-support (3.10.2)
|
85
|
+
rubocop (1.12.0)
|
86
|
+
parallel (~> 1.10)
|
87
|
+
parser (>= 3.0.0.0)
|
88
|
+
rainbow (>= 2.2.2, < 4.0)
|
89
|
+
regexp_parser (>= 1.8, < 3.0)
|
90
|
+
rexml
|
91
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
92
|
+
ruby-progressbar (~> 1.7)
|
93
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
94
|
+
rubocop-ast (1.4.1)
|
95
|
+
parser (>= 2.7.1.5)
|
96
|
+
rubocop-rspec (2.2.0)
|
97
|
+
rubocop (~> 1.0)
|
98
|
+
rubocop-ast (>= 1.1.0)
|
99
|
+
ruby-progressbar (1.11.0)
|
79
100
|
safe_yaml (1.0.5)
|
80
101
|
sassc (2.4.0)
|
81
102
|
ffi (~> 1.9)
|
@@ -91,6 +112,8 @@ DEPENDENCIES
|
|
91
112
|
pry (~> 0.14.0)
|
92
113
|
rake (~> 12.0)
|
93
114
|
rspec (~> 3.0)
|
115
|
+
rubocop
|
116
|
+
rubocop-rspec
|
94
117
|
|
95
118
|
BUNDLED WITH
|
96
119
|
2.1.4
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
# Twitch
|
1
|
+
# Jekyll::Twitch
|
2
2
|
|
3
|
-
|
3
|
+
This gem allows you to embed twitch channels, clips, collections, and videos in your Jekyll websites. It adds and registers a new twitch liquid tag that accepts a twitch clip, channel, broadcast, or highlight url. It's based on the [Twitch video embeds](https://dev.twitch.tv/docs/embed/video-and-clips).
|
4
4
|
|
5
|
-
|
5
|
+
`{% twitch https://www.twitch.tv/chaelcodes/clip/SpoopySlipperyGrasshopperPogChamp %}`
|
6
|
+
|
7
|
+
## [See the DEMO site](https://www.chael.codes/jekyll-twitch/)
|
8
|
+
Check out the [demo site](https://www.chael.codes/jekyll-twitch/) for install instructions and to review different embed examples.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -20,20 +23,57 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
$ gem install jekyll-twitch
|
22
25
|
|
26
|
+
Then add Jekyll-Twitch to your `_config.yml` like so:
|
27
|
+
```
|
28
|
+
plugins:
|
29
|
+
- jekyll-twitch
|
30
|
+
```
|
31
|
+
|
23
32
|
## Usage
|
24
33
|
|
25
|
-
|
34
|
+
This is a Jekyll liquid tag, so just put `{% twitch https://www.twitch.tv/chaelcodes/clip/SpoopySlipperyGrasshopperPogChamp %}` to embed your clip, channel, or broadcast.
|
26
35
|
|
27
|
-
|
36
|
+
When building your site, Jekyll no longer substitutes `site.url` for localhost, which means Twitch embeds will not render. You need to supply host and localhost to view clips in development. `jekyll serve --host localhost --port 4000`
|
28
37
|
|
29
|
-
|
38
|
+
All of the below examples are on the demo site with actual embeds. I strongly recommend using that.
|
30
39
|
|
31
|
-
|
40
|
+
### Channel
|
41
|
+
This channel embed will show the broadcast while the streamer is live, and the channel offline art when they are not.
|
32
42
|
|
33
|
-
|
43
|
+
```
|
44
|
+
<div style="width:720px;height:480px">
|
45
|
+
{% twitch https://twitch.tv/ChaelCodes %}
|
46
|
+
</div>
|
47
|
+
```
|
48
|
+
### Collection
|
49
|
+
This embed is used to add a collection of videos to your page or post.
|
34
50
|
|
35
|
-
|
51
|
+
```
|
52
|
+
<div style="width:720px;height:480px">
|
53
|
+
{% twitch https://www.twitch.tv/collections/x5bG2TGTeBYIRg %}
|
54
|
+
</div>
|
55
|
+
```
|
56
|
+
### Clips
|
57
|
+
This embed is used to add one Twitch clip to your page or post.
|
58
|
+
|
59
|
+
```
|
60
|
+
<div style="width:720px;height:480px">
|
61
|
+
{% twitch https://www.twitch.tv/chaelcodes/clip/DeterminedSweetRedpandaDoritosChip-pQiRlDz6rQ9uvuuq %}
|
62
|
+
</div>
|
63
|
+
```
|
64
|
+
### Videos
|
65
|
+
Whether you call them videos, vods, or higlights, this will embed them in your page or psot.
|
66
|
+
|
67
|
+
```
|
68
|
+
<div style="width:720px;height:480px">
|
69
|
+
{% twitch https://www.twitch.tv/videos/716698136 %}
|
70
|
+
</div>
|
71
|
+
```
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ChaelCodes/jekyll-twitch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ChaelCodes/jekyll-twitch/blob/main/CODE_OF_CONDUCT.md).
|
36
75
|
|
76
|
+
For more details on setting up the local environment, demo site, and releasing a new version, see our [CONTRIBUTING.md](/CONTRIBUTING.md).
|
37
77
|
|
38
78
|
## License
|
39
79
|
|
@@ -41,4 +81,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
81
|
|
42
82
|
## Code of Conduct
|
43
83
|
|
44
|
-
Everyone interacting in the Twitch
|
84
|
+
Everyone interacting in the Jekyll::Twitch project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ChaelCodes/jekyll-twitch/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'twitch_tag'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "twitch_tag"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/docs/.gitignore
ADDED
data/docs/404.html
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
permalink: /404.html
|
3
|
+
layout: default
|
4
|
+
---
|
5
|
+
|
6
|
+
<style type="text/css" media="screen">
|
7
|
+
.container {
|
8
|
+
margin: 10px auto;
|
9
|
+
max-width: 600px;
|
10
|
+
text-align: center;
|
11
|
+
}
|
12
|
+
h1 {
|
13
|
+
margin: 30px 0;
|
14
|
+
font-size: 4em;
|
15
|
+
line-height: 1;
|
16
|
+
letter-spacing: -1px;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
|
20
|
+
<div class="container">
|
21
|
+
<h1>404</h1>
|
22
|
+
|
23
|
+
<p><strong>Page not found :(</strong></p>
|
24
|
+
<p>The requested page could not be found.</p>
|
25
|
+
</div>
|
data/docs/Gemfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
# Hello! This is where you manage which Jekyll version is used to run.
|
5
|
+
# When you want to use a different version, change it below, save the
|
6
|
+
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
7
|
+
#
|
8
|
+
# bundle exec jekyll serve
|
9
|
+
#
|
10
|
+
# This will help ensure the proper Jekyll version is running.
|
11
|
+
# Happy Jekylling!
|
12
|
+
gem 'jekyll', '~> 4.2.0'
|
13
|
+
|
14
|
+
gem 'webrick' # See https://github.com/jekyll/jekyll/issues/8523 this is a Ruby 3/Jekyll thing
|
15
|
+
|
16
|
+
# there were issues with rubygems - remove these later
|
17
|
+
gem 'i18n', github: 'ruby-i18n/i18n'
|
18
|
+
gem 'rexml', github: 'ruby/rexml'
|
19
|
+
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
20
|
+
gem 'minima', github: 'jekyll/minima'
|
21
|
+
|
22
|
+
# there were issues with rubygems - remove these later
|
23
|
+
gem 'listen', github: 'guard/listen'
|
24
|
+
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
25
|
+
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
26
|
+
# gem "github-pages", group: :jekyll_plugins
|
27
|
+
# If you have any plugins, put them here!
|
28
|
+
group :jekyll_plugins do
|
29
|
+
# remove github later, issues with rubygems
|
30
|
+
gem 'jekyll-feed', github: 'jekyll/jekyll-feed'
|
31
|
+
gem 'jekyll-twitch', github: 'ChaelCodes/jekyll-twitch', branch: 'main'
|
32
|
+
end
|
33
|
+
|
34
|
+
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
35
|
+
# and associated library.
|
36
|
+
platforms :mingw, :x64_mingw, :mswin, :jruby do
|
37
|
+
gem 'tzinfo', '~> 1.2'
|
38
|
+
gem 'tzinfo-data'
|
39
|
+
end
|
40
|
+
|
41
|
+
# Performance-booster for watching directories on Windows
|
42
|
+
gem 'wdm', '~> 0.1.1', platforms: %i[mingw x64_mingw mswin]
|
data/docs/Gemfile.lock
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/ChaelCodes/jekyll-twitch.git
|
3
|
+
revision: d9233863077a04bc105710d4f1b2767ddbf3473e
|
4
|
+
branch: main
|
5
|
+
specs:
|
6
|
+
jekyll-twitch (1.0.0)
|
7
|
+
jekyll
|
8
|
+
|
9
|
+
GIT
|
10
|
+
remote: https://github.com/guard/listen.git
|
11
|
+
revision: ded2016a72d05f20d254c8ff25dd272a36c14d08
|
12
|
+
specs:
|
13
|
+
listen (3.7.1)
|
14
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
15
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
16
|
+
|
17
|
+
GIT
|
18
|
+
remote: https://github.com/jekyll/jekyll-feed.git
|
19
|
+
revision: a58064c68f49e63b0741d368cd95bb35ac2c7c5d
|
20
|
+
specs:
|
21
|
+
jekyll-feed (0.17.0)
|
22
|
+
jekyll (>= 3.7, < 5.0)
|
23
|
+
|
24
|
+
GIT
|
25
|
+
remote: https://github.com/jekyll/minima.git
|
26
|
+
revision: 41b97699af658128fa9983e5312ca5516641f335
|
27
|
+
specs:
|
28
|
+
minima (2.5.1)
|
29
|
+
jekyll (>= 3.5, < 5.0)
|
30
|
+
jekyll-feed (~> 0.9)
|
31
|
+
jekyll-seo-tag (~> 2.1)
|
32
|
+
|
33
|
+
GIT
|
34
|
+
remote: https://github.com/ruby-i18n/i18n.git
|
35
|
+
revision: c5ccd28f8413f44baf6e32aeeb80854471650533
|
36
|
+
specs:
|
37
|
+
i18n (1.12.0)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
|
40
|
+
GIT
|
41
|
+
remote: https://github.com/ruby/rexml.git
|
42
|
+
revision: afafbacd8a8c1947b63eb0b46d698da76c831d98
|
43
|
+
specs:
|
44
|
+
rexml (3.2.6)
|
45
|
+
|
46
|
+
GEM
|
47
|
+
remote: https://rubygems.org/
|
48
|
+
specs:
|
49
|
+
addressable (2.8.1)
|
50
|
+
public_suffix (>= 2.0.2, < 6.0)
|
51
|
+
colorator (1.1.0)
|
52
|
+
concurrent-ruby (1.1.10)
|
53
|
+
em-websocket (0.5.3)
|
54
|
+
eventmachine (>= 0.12.9)
|
55
|
+
http_parser.rb (~> 0)
|
56
|
+
eventmachine (1.2.7)
|
57
|
+
ffi (1.15.5)
|
58
|
+
forwardable-extended (2.6.0)
|
59
|
+
http_parser.rb (0.8.0)
|
60
|
+
jekyll (4.2.2)
|
61
|
+
addressable (~> 2.4)
|
62
|
+
colorator (~> 1.0)
|
63
|
+
em-websocket (~> 0.5)
|
64
|
+
i18n (~> 1.0)
|
65
|
+
jekyll-sass-converter (~> 2.0)
|
66
|
+
jekyll-watch (~> 2.0)
|
67
|
+
kramdown (~> 2.3)
|
68
|
+
kramdown-parser-gfm (~> 1.0)
|
69
|
+
liquid (~> 4.0)
|
70
|
+
mercenary (~> 0.4.0)
|
71
|
+
pathutil (~> 0.9)
|
72
|
+
rouge (~> 3.0)
|
73
|
+
safe_yaml (~> 1.0)
|
74
|
+
terminal-table (~> 2.0)
|
75
|
+
jekyll-sass-converter (2.2.0)
|
76
|
+
sassc (> 2.0.1, < 3.0)
|
77
|
+
jekyll-seo-tag (2.8.0)
|
78
|
+
jekyll (>= 3.8, < 5.0)
|
79
|
+
jekyll-watch (2.2.1)
|
80
|
+
listen (~> 3.0)
|
81
|
+
kramdown (2.4.0)
|
82
|
+
rexml
|
83
|
+
kramdown-parser-gfm (1.1.0)
|
84
|
+
kramdown (~> 2.0)
|
85
|
+
liquid (4.0.3)
|
86
|
+
mercenary (0.4.0)
|
87
|
+
pathutil (0.16.2)
|
88
|
+
forwardable-extended (~> 2.6)
|
89
|
+
public_suffix (5.0.0)
|
90
|
+
rb-fsevent (0.11.2)
|
91
|
+
rb-inotify (0.10.1)
|
92
|
+
ffi (~> 1.0)
|
93
|
+
rouge (3.30.0)
|
94
|
+
safe_yaml (1.0.5)
|
95
|
+
sassc (2.4.0)
|
96
|
+
ffi (~> 1.9)
|
97
|
+
terminal-table (2.0.0)
|
98
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
99
|
+
unicode-display_width (1.8.0)
|
100
|
+
webrick (1.7.0)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
x86_64-linux
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
i18n!
|
107
|
+
jekyll (~> 4.2.0)
|
108
|
+
jekyll-feed!
|
109
|
+
jekyll-twitch!
|
110
|
+
listen!
|
111
|
+
minima!
|
112
|
+
rexml!
|
113
|
+
tzinfo (~> 1.2)
|
114
|
+
tzinfo-data
|
115
|
+
wdm (~> 0.1.1)
|
116
|
+
webrick
|
117
|
+
|
118
|
+
BUNDLED WITH
|
119
|
+
2.3.23
|
data/docs/_config.yml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Welcome to Jekyll!
|
2
|
+
#
|
3
|
+
# This config file is meant for settings that affect your whole blog, values
|
4
|
+
# which you are expected to set up once and rarely edit after that. If you find
|
5
|
+
# yourself editing this file very often, consider using Jekyll's data files
|
6
|
+
# feature for the data you need to update frequently.
|
7
|
+
#
|
8
|
+
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
9
|
+
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
|
10
|
+
#
|
11
|
+
# If you need help with YAML syntax, here are some quick references for you:
|
12
|
+
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
|
13
|
+
# https://learnxinyminutes.com/docs/yaml/
|
14
|
+
#
|
15
|
+
# Site settings
|
16
|
+
# These are used to personalize your new site. If you look in the HTML files,
|
17
|
+
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
|
18
|
+
# You can create any custom variable you would like, and they will be accessible
|
19
|
+
# in the templates via {{ site.myvariable }}.
|
20
|
+
|
21
|
+
title: Jekyll-Twitch Demo
|
22
|
+
email: chaelcodes@gmail.com
|
23
|
+
description: >- # this means to ignore newlines until "baseurl:"
|
24
|
+
You can use Jekyll-Twitch to embed Twitch clips in your Jekyll Site.
|
25
|
+
baseurl: "/jekyll-twitch" # the subpath of your site, e.g. /blog
|
26
|
+
url: "https://www.chael.codes" # the base hostname & protocol for your site, e.g. http://example.com
|
27
|
+
twitter_username: ChaelCodes
|
28
|
+
github_username: ChaelCodes
|
29
|
+
|
30
|
+
# Build settings
|
31
|
+
theme: minima
|
32
|
+
plugins:
|
33
|
+
- jekyll-feed
|
34
|
+
- jekyll-twitch
|
35
|
+
|
36
|
+
# Exclude from processing.
|
37
|
+
# The following items will not be processed, by default.
|
38
|
+
# Any item listed under the `exclude:` key here will be automatically added to
|
39
|
+
# the internal "default list".
|
40
|
+
#
|
41
|
+
# Excluded items can be processed by explicitly listing the directories or
|
42
|
+
# their entries' file path in the `include:` list.
|
43
|
+
#
|
44
|
+
# exclude:
|
45
|
+
# - .sass-cache/
|
46
|
+
# - .jekyll-cache/
|
47
|
+
# - gemfiles/
|
48
|
+
# - Gemfile
|
49
|
+
# - Gemfile.lock
|
50
|
+
# - node_modules/
|
51
|
+
# - vendor/bundle/
|
52
|
+
# - vendor/cache/
|
53
|
+
# - vendor/gems/
|
54
|
+
# - vendor/ruby/
|
@@ -0,0 +1,9 @@
|
|
1
|
+
---
|
2
|
+
layout: post
|
3
|
+
date: 2021-04-23
|
4
|
+
---
|
5
|
+
Version 1.0 of Jekyll-Twitch has just been released!
|
6
|
+
|
7
|
+
- embed now sizes to the parent div instead of being a fixed 1280x720
|
8
|
+
- See the example pages on the documentation site for more details
|
9
|
+
- Supports clips, channels, collections, and vods
|
@@ -0,0 +1,9 @@
|
|
1
|
+
---
|
2
|
+
layout: post
|
3
|
+
date: 2021-04-23
|
4
|
+
---
|
5
|
+
It's been a while since the last release. Jekyll-Twitch is feature complete in my eyes, unless folks start asking for the interactive embeds or custom sizes in the embed. This release just includes security fixes from the last year.
|
6
|
+
|
7
|
+
# Changes
|
8
|
+
- [#16](https://github.com/ChaelCodes/jekyll-twitch/pull/16) Bump rexml from 3.2.4 to 3.2.5
|
9
|
+
- [#17](https://github.com/ChaelCodes/jekyll-twitch/pull/17) Bump addressable from 2.7.0 to 2.8.1
|
data/docs/channel.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
title: Channel
|
4
|
+
permalink: /channel/
|
5
|
+
---
|
6
|
+
This embeds a live broadcast of a particular channel in your page or post.
|
7
|
+
|
8
|
+
{% raw %}
|
9
|
+
```
|
10
|
+
<div style="width:720px;height:480px">
|
11
|
+
{% twitch https://twitch.tv/ChaelCodes %}
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
{% endraw %}
|
15
|
+
<div style="width:720px;height:480px">
|
16
|
+
{% twitch https://twitch.tv/ChaelCodes %}
|
17
|
+
</div>
|
data/docs/clips.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
title: Clips
|
4
|
+
permalink: /clips/
|
5
|
+
---
|
6
|
+
This embed is used to add one Twitch clip to your page or post.
|
7
|
+
|
8
|
+
{% raw %}
|
9
|
+
```
|
10
|
+
<div style="width:720px;height:480px">
|
11
|
+
{% twitch https://www.twitch.tv/chaelcodes/clip/DeterminedSweetRedpandaDoritosChip-pQiRlDz6rQ9uvuuq %}
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
{% endraw %}
|
15
|
+
<div style="width:720px;height:480px">
|
16
|
+
{% twitch https://www.twitch.tv/chaelcodes/clip/DeterminedSweetRedpandaDoritosChip-pQiRlDz6rQ9uvuuq %}
|
17
|
+
</div>
|
data/docs/collection.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
title: Collection
|
4
|
+
permalink: /collection/
|
5
|
+
---
|
6
|
+
This embed is used to add a collection of videos to your page or post.
|
7
|
+
|
8
|
+
{% raw %}
|
9
|
+
```
|
10
|
+
<div style="width:720px;height:480px">
|
11
|
+
{% twitch https://www.twitch.tv/collections/x5bG2TGTeBYIRg %}
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
{% endraw %}
|
15
|
+
<div style="width:720px;height:480px">
|
16
|
+
{% twitch https://www.twitch.tv/collections/x5bG2TGTeBYIRg %}
|
17
|
+
</div>
|
data/docs/index.markdown
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
layout: home
|
3
|
+
---
|
4
|
+
This Liquid plugin lets you embed Twitch clips in your jekyll sites.
|
5
|
+
|
6
|
+
### Usage
|
7
|
+
1. Add the gem to your Gemfile.
|
8
|
+
```
|
9
|
+
group :jekyll_plugins do
|
10
|
+
gem 'jekyll-twitch'
|
11
|
+
end
|
12
|
+
```
|
13
|
+
2. Add it the plugin to your `_config.yml`.
|
14
|
+
```
|
15
|
+
plugins:
|
16
|
+
- jekyll-twitch
|
17
|
+
```
|
18
|
+
3. `bundle install` to install your gem.
|
19
|
+
4. Start your server. `bundle exec jekyll serve --host localhost --port 4000`
|
20
|
+
5. Embed Twitch on the page!
|
21
|
+
{% raw %}
|
22
|
+
```
|
23
|
+
<div style="width:720px;height:480px">
|
24
|
+
{% twitch https://www.twitch.tv/chaelcodes/clip/DeterminedSweetRedpandaDoritosChip-pQiRlDz6rQ9uvuuq %}
|
25
|
+
</div>
|
26
|
+
```
|
27
|
+
{% endraw %}
|
28
|
+
|
29
|
+
### Testing in Development
|
30
|
+
|
31
|
+
When building your site in development, Jekyll no longer substitutes `site.url` for localhost, which means Twitch embeds will not render. You need to supply host and localhost to view clips in development. `jekyll serve --host localhost --port 4000` This is not an issue in production.
|
32
|
+
|
33
|
+
### Deploying using GitHub Pages
|
34
|
+
|
35
|
+
If you have custom gems and you're using GitHub pages for your deploys, they will prevent your gems from executing. You need to modify your deploy to use GitHub actions. (This is also the only way to deploy Jekyll 4). You're welcome to use our [deploy setup](.github/workflows/deploy-demo.yml) as an example.
|
data/docs/videos.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
title: Videos
|
4
|
+
permalink: /videos/
|
5
|
+
---
|
6
|
+
Whether you call them videos, vods, or higlights, this will embed them in your page or psot.
|
7
|
+
|
8
|
+
{% raw %}
|
9
|
+
```
|
10
|
+
<div style="width:720px;height:480px">
|
11
|
+
{% twitch https://www.twitch.tv/videos/716698136 %}
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
{% endraw %}
|
15
|
+
<div style="width:720px;height:480px">
|
16
|
+
{% twitch https://www.twitch.tv/videos/716698136 %}
|
17
|
+
</div>
|
data/jekyll-twitch.gemspec
CHANGED
@@ -1,30 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/jekyll-twitch/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name =
|
6
|
+
spec.name = 'jekyll-twitch'
|
5
7
|
spec.version = Jekyll::Twitch::VERSION
|
6
|
-
spec.authors = [
|
7
|
-
spec.email = [
|
8
|
+
spec.authors = ['Rachael Wright-Munn']
|
9
|
+
spec.email = ['chaelcodes@gmail.com']
|
8
10
|
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
11
|
-
|
12
|
-
spec.
|
13
|
-
spec.
|
11
|
+
spec.summary = 'Embed Twitch clips, VODs, and broadcasts in your Jekyll sites.'
|
12
|
+
spec.description = 'A gem that creates a TwitchTag liquid tag that allows Jekyll sites ' \
|
13
|
+
'to render Twitch clips, VODs, and broadcasts.'
|
14
|
+
spec.homepage = 'https://github.com/ChaelCodes/jekyll-twitch'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
14
17
|
|
15
18
|
# spec.metadata["allowed_push_host"] = "" # Used for private gem server
|
16
19
|
|
17
|
-
spec.metadata[
|
18
|
-
spec.metadata[
|
19
|
-
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/ChaelCodes/jekyll-twitch'
|
22
|
+
spec.metadata["changelog_uri"] = "https://www.chael.codes/jekyll-twitch/"
|
20
23
|
|
21
24
|
# Specify which files should be added to the gem when it is released.
|
22
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
27
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
28
|
end
|
26
|
-
spec.bindir =
|
29
|
+
spec.bindir = 'exe'
|
27
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = [
|
31
|
+
spec.require_paths = ['lib']
|
29
32
|
spec.add_dependency 'jekyll'
|
30
33
|
end
|
@@ -1,39 +1,68 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'jekyll'
|
4
|
+
|
5
|
+
# These are all for Jekyll.
|
3
6
|
module Jekyll
|
7
|
+
# This is a liquid tag that embed Twitch Clips
|
8
|
+
# input is a url
|
4
9
|
class TwitchTag < Liquid::Tag
|
5
10
|
def initialize(_tag_name, content, _tokens)
|
6
11
|
super
|
7
|
-
@parsed_url = Jekyll::TwitchTag.parse_twitch_url content
|
12
|
+
@parsed_url = Jekyll::TwitchTag.parse_twitch_url content.strip
|
8
13
|
end
|
9
14
|
|
10
15
|
def render(context)
|
11
16
|
host = Jekyll::TwitchTag.site_url context
|
12
|
-
%
|
17
|
+
%(<iframe
|
13
18
|
src="#{@parsed_url}&parent=#{host}"
|
14
|
-
height="
|
15
|
-
width="
|
19
|
+
height="100%"
|
20
|
+
width="100%"
|
16
21
|
allowfullscreen="true">
|
17
22
|
</iframe>)
|
18
23
|
end
|
19
24
|
|
20
25
|
# Class Methods
|
26
|
+
def self.channel_url(url)
|
27
|
+
slug = url.match %r{(?<no>twitch.tv/)(?<channel>.+)/?\??}
|
28
|
+
"https://player.twitch.tv/?channel=#{slug[:channel]}&autoplay=false"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.clip_url(url)
|
32
|
+
slug = url.match %r{(?<no>/clip/)(?<clip>.+)/?\??}
|
33
|
+
"https://clips.twitch.tv/embed?autoplay=false&clip=#{slug[:clip]}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.collection_url(url)
|
37
|
+
slug = url.match %r{(?<no>/collections/)(?<collection>.+)/?\??}
|
38
|
+
"https://player.twitch.tv/?collection=#{slug[:collection]}&autoplay=false"
|
39
|
+
end
|
40
|
+
|
21
41
|
def self.hostname(url)
|
22
|
-
matches = url.match %r{\A(https?://)?(?<host>[A-z.]+)(
|
42
|
+
matches = url.match %r{\A(?<safe>https?://)?(?<host>[A-z.]+)(?<port>:\d+)?}
|
23
43
|
matches[:host]
|
24
44
|
end
|
25
45
|
|
26
46
|
def self.parse_twitch_url(url)
|
27
|
-
url = url.strip
|
28
47
|
case url
|
29
48
|
when %r{/clip/}
|
30
|
-
|
31
|
-
|
49
|
+
clip_url url
|
50
|
+
when %r{/videos/}
|
51
|
+
video_url url
|
52
|
+
when %r{/collections/}
|
53
|
+
collection_url url
|
54
|
+
else
|
55
|
+
channel_url url
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
35
59
|
def self.site_url(context)
|
36
|
-
|
60
|
+
hostname(context.registers[:site].config['url'])
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.video_url(url)
|
64
|
+
slug = url.match %r{(?<no>/videos/)(?<vod>\d+)}
|
65
|
+
"https://player.twitch.tv/?video=#{slug[:vod]}&autoplay=false"
|
37
66
|
end
|
38
67
|
end
|
39
68
|
|
data/lib/jekyll-twitch.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'jekyll-twitch/version'
|
4
|
+
require 'jekyll-twitch/twitch_tag'
|
3
5
|
|
4
6
|
module Jekyll
|
7
|
+
# This is the module for Twitch stuff for Jekyll
|
5
8
|
module Twitch
|
6
9
|
end
|
7
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-twitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rachael Wright-Munn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -32,9 +32,17 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- ".github/workflows/checks.yml"
|
36
|
+
- ".github/workflows/deploy-demo.yml"
|
35
37
|
- ".gitignore"
|
38
|
+
- ".jekyll-cache/Jekyll/Cache/Jekyll--Cache/b7/9606fb3afea5bd1609ed40b622142f1c98125abcfe89a76a661b0e8e343910"
|
39
|
+
- ".jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/63/7e252fa8460c2278df772e6dfbf4934329e2f03a9174070b70d0883886b435"
|
40
|
+
- ".jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/e3/b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
41
|
+
- ".jekyll-cache/Jekyll/Cache/Jekyll--Converters--Markdown/fd/aa4200cef2544ec568b25970b3a49cf9b4f3d7015485506ccda914caf9c5b9"
|
36
42
|
- ".rspec"
|
43
|
+
- ".rubocop.yml"
|
37
44
|
- CODE_OF_CONDUCT.md
|
45
|
+
- CONTRIBUTING.md
|
38
46
|
- Gemfile
|
39
47
|
- Gemfile.lock
|
40
48
|
- LICENSE.txt
|
@@ -42,6 +50,18 @@ files:
|
|
42
50
|
- Rakefile
|
43
51
|
- bin/console
|
44
52
|
- bin/setup
|
53
|
+
- docs/.gitignore
|
54
|
+
- docs/404.html
|
55
|
+
- docs/Gemfile
|
56
|
+
- docs/Gemfile.lock
|
57
|
+
- docs/_config.yml
|
58
|
+
- docs/_posts/2021-04-23-Version-1-Released.md
|
59
|
+
- docs/_posts/2022-10-17-Version-1.0.1-Released.md
|
60
|
+
- docs/channel.md
|
61
|
+
- docs/clips.md
|
62
|
+
- docs/collection.md
|
63
|
+
- docs/index.markdown
|
64
|
+
- docs/videos.md
|
45
65
|
- jekyll-twitch.gemspec
|
46
66
|
- lib/jekyll-twitch.rb
|
47
67
|
- lib/jekyll-twitch/twitch_tag.rb
|
@@ -52,6 +72,7 @@ licenses:
|
|
52
72
|
metadata:
|
53
73
|
homepage_uri: https://github.com/ChaelCodes/jekyll-twitch
|
54
74
|
source_code_uri: https://github.com/ChaelCodes/jekyll-twitch
|
75
|
+
changelog_uri: https://www.chael.codes/jekyll-twitch/
|
55
76
|
post_install_message:
|
56
77
|
rdoc_options: []
|
57
78
|
require_paths:
|
@@ -60,14 +81,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
81
|
requirements:
|
61
82
|
- - ">="
|
62
83
|
- !ruby/object:Gem::Version
|
63
|
-
version: 2.
|
84
|
+
version: 2.4.0
|
64
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
86
|
requirements:
|
66
87
|
- - ">="
|
67
88
|
- !ruby/object:Gem::Version
|
68
89
|
version: '0'
|
69
90
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
91
|
+
rubygems_version: 3.3.7
|
71
92
|
signing_key:
|
72
93
|
specification_version: 4
|
73
94
|
summary: Embed Twitch clips, VODs, and broadcasts in your Jekyll sites.
|