jekyll-tweetsert 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -13
- data/jekyll-tweetsert.gemspec +3 -0
- data/lib/jekyll/tweetsert.rb +9 -7
- data/lib/jekyll/tweetsert/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46fa427ad2b24f048b448acbe2238b905147666
|
4
|
+
data.tar.gz: b7f1b6dd5b7a9de8de34aa7963860160c608c222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a26a811b1d2ce1a77f4bde517cca85c3dc30a1a65c1f012cbe963c8ceb6592305b40b369d23cd947b288829fe956b86e5218eef86eb8004d932c705a3f99a7ca
|
7
|
+
data.tar.gz: e282608ee9c2e10b5c49362e3016f3c056c06dc985c6c5849d865406b2835f9bca1fe0413eb6223c480037ccf08357e01ad7e204c3fbbd0ee5f80534834d5c17
|
data/README.md
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
# Jekyll::Tweetsert
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/jekyll-tweetsert.svg)](https://badge.fury.io/rb/jekyll-tweetsert)
|
4
4
|
|
5
5
|
*Tweetsert* is a plugin for Jekyll that pulls recent tweets from one or more Twitter handles, then inserts them (dated appropriately) as regular posts on your site. You can specify which tweets to include or exclude based on patterns or words, import retweets and replies, and tweak the theme and link colors of the embedded tweet.
|
6
6
|
|
7
7
|
To organize your tweet-posts, Tweetsert can automatically assign a category and/or tag. You may also choose to automatically import Twitter hashtags.
|
8
8
|
|
9
|
-
|
9
|
+
## Why do this?
|
10
10
|
|
11
11
|
1. You want your blog readers to also see your recent tweets when they visit;
|
12
12
|
1. You may want to pull in tweets from friends, family, co-workers, etc. into your blog;
|
13
13
|
1. You want to create a blog composed only of tweets from a group of people;
|
14
14
|
1. Just for fun!
|
15
15
|
|
16
|
+
## What's new?
|
17
|
+
|
18
|
+
*v1.1.0* Added `prefix` and `suffix` options to `embed`
|
19
|
+
|
16
20
|
## Installation
|
17
21
|
|
18
22
|
Add this line to your application's Gemfile:
|
@@ -138,6 +142,11 @@ tweetsert:
|
|
138
142
|
# Set to true if you manually include it in e.g. the header
|
139
143
|
#omit_script: true
|
140
144
|
|
145
|
+
# Some markup to include right before and after the embedded tweet
|
146
|
+
# {{anything}} will be expanded to the corresponding frontmatter/properties
|
147
|
+
#prefix: '<i>This was tweeted on {{date}}</i>'
|
148
|
+
#suffix: '<i>This is after. Click <a href="{{url}}">here</a> to view this tweet separately.</i>'
|
149
|
+
|
141
150
|
category:
|
142
151
|
default: "tweets" # Automatically set to this category
|
143
152
|
dir: "" # Folder that contains your categories
|
@@ -223,6 +232,8 @@ tweetsert:
|
|
223
232
|
theme: "dark"
|
224
233
|
link_color: "#80FF80"
|
225
234
|
omit_script: false
|
235
|
+
prefix: '<i>I tweeted this on {{date}}</i>'
|
236
|
+
suffix: '<p>Click <a href="{{url}}">here</a> to comment.</p>'
|
226
237
|
|
227
238
|
category:
|
228
239
|
default: "tweets"
|
@@ -262,7 +273,19 @@ tweetsert:
|
|
262
273
|
|
263
274
|
## Further configuration
|
264
275
|
|
265
|
-
|
276
|
+
You may want to edit your `home`/index layout to make the imported tweets look different from the regular ones, for instance,
|
277
|
+
|
278
|
+
```html
|
279
|
+
{% for post in site.posts %}
|
280
|
+
{% if post.tags contains "tweet" %}
|
281
|
+
<br/>
|
282
|
+
{% else %}
|
283
|
+
<!-- normal post header -->
|
284
|
+
{% endif %}
|
285
|
+
{% endfor %}
|
286
|
+
```
|
287
|
+
|
288
|
+
The embedded tweet is wrapped inside a `<div class="jekyll-tweetsert">`, with `embed.prefix` inserted before, and `embed.suffix` after. You may adjust its appearance via CSS:
|
266
289
|
|
267
290
|
```css
|
268
291
|
.jekyll-tweetsert {
|
@@ -278,23 +301,24 @@ If you'd rather access the embedded tweet directly, use a property:
|
|
278
301
|
|
279
302
|
```yaml
|
280
303
|
properties:
|
281
|
-
|
304
|
+
tweet: $
|
282
305
|
```
|
283
306
|
|
284
|
-
and include it as `{{
|
307
|
+
and include it in your layout as `{{ page.tweet }}` or `{{ post.tweet }}`. You may want to do this since `{{ content }}` includes the contents of `embed.prefix` and `embed.suffix` and you'd rather exclude them to further tweak the appearance via a custom layout.
|
285
308
|
|
286
|
-
|
309
|
+
This has the nice side-effect of being able to do things like:
|
287
310
|
|
288
311
|
```html
|
289
|
-
{%
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
{% endfor %}
|
312
|
+
{% if page.tweet %}
|
313
|
+
<p>The following is a tweet:</p>
|
314
|
+
<div class="my-tweet-class">{{ page.tweet }}</div>
|
315
|
+
{% else %}
|
316
|
+
{{ content }}
|
317
|
+
{% endif %}
|
296
318
|
```
|
297
319
|
|
320
|
+
## Demo
|
321
|
+
|
298
322
|
See the [author's blog](https://ibrado.org) for a demo.
|
299
323
|
|
300
324
|
## Contributing
|
@@ -319,3 +343,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
319
343
|
|
320
344
|
## Code of Conduct
|
321
345
|
Everyone interacting in the Jekyll::Tweetsert project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jekyll-tweetsert/blob/master/CODE_OF_CONDUCT.md).
|
346
|
+
|
347
|
+
## Also by the author
|
348
|
+
|
349
|
+
[Jekyll Stickyposts Plugin](https://github.com/ibrado/jekyll-stickyposts) - Move/pin posts tagged `sticky: true` before all others. Sorting on custom fields supported, collection and paginator friendly.
|
data/jekyll-tweetsert.gemspec
CHANGED
@@ -6,6 +6,8 @@ require "jekyll/tweetsert/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "jekyll-tweetsert"
|
8
8
|
spec.version = Jekyll::Tweetsert::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.required_ruby_version = '>= 2.0.0'
|
9
11
|
spec.authors = ["Alex Ibrado"]
|
10
12
|
spec.email = ["alex@ibrado.org"]
|
11
13
|
|
@@ -23,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
23
25
|
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
27
|
|
28
|
+
spec.add_runtime_dependency "jekyll", "~> 3.0"
|
26
29
|
spec.add_runtime_dependency "api_cache", "~> 0.3"
|
27
30
|
spec.add_runtime_dependency "moneta", "~> 1.0"
|
28
31
|
end
|
data/lib/jekyll/tweetsert.rb
CHANGED
@@ -370,17 +370,10 @@ module Jekyll
|
|
370
370
|
tweetpost = Jekyll::Document.new(File.join(site.source, o[:category], name),
|
371
371
|
{ :site => site, :collection => site.posts })
|
372
372
|
|
373
|
-
tweetpost.content = '<div class="jekyll-tweetsert">' + oembed["html"] + '</div>'
|
374
|
-
|
375
373
|
tweetpost.data["title"] = prefix + title_base + suffix
|
376
|
-
|
377
374
|
tweetpost.data["date"] = tweet['timestamp'].to_time
|
378
375
|
tweetpost.data["layout"] = o[:layout]
|
379
376
|
|
380
|
-
if o[:embed]["excerpts"].nil? || o[:embed]["excerpts"]
|
381
|
-
tweetpost.data["excerpt"] = Jekyll::Excerpt.new(tweetpost)
|
382
|
-
end
|
383
|
-
|
384
377
|
tweet_tags = [o[:default_tag]].compact
|
385
378
|
|
386
379
|
plain_text = tweet["full_text"].downcase.gsub(/&\S[^;]+;/, '');
|
@@ -410,6 +403,15 @@ module Jekyll
|
|
410
403
|
end
|
411
404
|
end
|
412
405
|
|
406
|
+
pre = Liquid::Template.parse(o[:embed]["prefix"] || '').render(tweetpost.to_liquid)
|
407
|
+
post = Liquid::Template.parse(o[:embed]["suffix"] || '').render(tweetpost.to_liquid)
|
408
|
+
|
409
|
+
tweetpost.content = '<div class="jekyll-tweetsert">' + pre + oembed["html"] + post + '</div>'
|
410
|
+
|
411
|
+
if o[:embed]["excerpts"].nil? || o[:embed]["excerpts"]
|
412
|
+
tweetpost.data["excerpt"] = Jekyll::Excerpt.new(tweetpost)
|
413
|
+
end
|
414
|
+
|
413
415
|
site.posts.docs << tweetpost
|
414
416
|
|
415
417
|
# Create the tag index file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tweetsert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Ibrado
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jekyll
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: api_cache
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
99
|
requirements:
|
86
100
|
- - ">="
|
87
101
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
102
|
+
version: 2.0.0
|
89
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
104
|
requirements:
|
91
105
|
- - ">="
|