octopress-quote-tag 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +16 -6
- data/lib/octopress-quote-tag.rb +8 -23
- data/lib/octopress-quote-tag/utils.rb +24 -0
- data/lib/octopress-quote-tag/version.rb +2 -2
- data/octopress-quote-tag.gemspec +2 -1
- data/test/_config.yml +1 -1
- data/test/_expected/markdown.html +7 -7
- data/test/markdown.md +7 -7
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d41cf529a9e930c6661f032b4a29011c7e32dbd
|
4
|
+
data.tar.gz: 9a1e6921a4c2bebdcfaad6c8f0fdd759d0618ee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9f4b7769959c59ea4b30095700f636e4832fd441e7ec2cf5d0b0986108c1f438bc044e3283835589d6aeef4546f2633359faab0b0f103bc9ef1be0dc4b2ba8e
|
7
|
+
data.tar.gz: c468888243a149896c4473ed63e481454b7e418c9936c5a6ebaa63157dcf6674e8a65665e6042286093311063bf8490299e8e8e0216a60df247cbe164959747f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -32,9 +32,9 @@ Then add the gem to your Jekyll configuration.
|
|
32
32
|
## Usage
|
33
33
|
|
34
34
|
```
|
35
|
-
{%
|
35
|
+
{% quote [options] %}
|
36
36
|
Some great quote
|
37
|
-
{%
|
37
|
+
{% endquote %}
|
38
38
|
```
|
39
39
|
|
40
40
|
Options:
|
@@ -49,7 +49,7 @@ Options:
|
|
49
49
|
### Example
|
50
50
|
|
51
51
|
```
|
52
|
-
{% quote author:"Bob McAwesome" url:
|
52
|
+
{% quote author:"Bob McAwesome" url:http://example.com title:"Great Wisdom" %}
|
53
53
|
Never pet a burning dog.
|
54
54
|
{% endquote %}
|
55
55
|
```
|
@@ -68,8 +68,8 @@ Never pet a burning dog.
|
|
68
68
|
|
69
69
|
## Why?
|
70
70
|
|
71
|
-
In Markdown Blockquotes are simple but attribution isn't.
|
72
|
-
|
71
|
+
In Markdown Blockquotes are simple but attribution isn't. Also,
|
72
|
+
writing the semantic HTML is tricky and easy to forget.
|
73
73
|
|
74
74
|
```
|
75
75
|
> Some cool quote
|
@@ -83,7 +83,6 @@ Also, if you want semantic HTML, you'll have to write your own.
|
|
83
83
|
|
84
84
|
But what if you want to cite an author or a source?
|
85
85
|
|
86
|
-
|
87
86
|
```
|
88
87
|
> Some cool quote
|
89
88
|
> - Bob McAwesome
|
@@ -101,3 +100,14 @@ Which doesn't work at all since a browser will see it as:
|
|
101
100
|
```
|
102
101
|
Some cool quote - Bob McAwesome
|
103
102
|
```
|
103
|
+
|
104
|
+
And now you know.
|
105
|
+
|
106
|
+
## Contributing
|
107
|
+
|
108
|
+
1. Fork it ( https://github.com/octopress/quote-tag/fork )
|
109
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
110
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
111
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
112
|
+
5. Create a new Pull Request
|
113
|
+
|
data/lib/octopress-quote-tag.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require "octopress-quote-tag/version"
|
3
|
+
require "octopress-quote-tag/utils"
|
3
4
|
require "jekyll"
|
4
5
|
|
5
6
|
module Octopress
|
6
7
|
module Tags
|
7
|
-
module
|
8
|
+
module Quote
|
8
9
|
class Tag < Liquid::Block
|
9
10
|
FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
10
11
|
FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i
|
@@ -62,29 +63,13 @@ module Octopress
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def render(context)
|
65
|
-
quote = "<blockquote>#{parse_content(super, context).strip}</blockquote>"
|
66
|
+
quote = "<blockquote>#{Utils.parse_content(super, context).strip}</blockquote>"
|
66
67
|
if cap = figcaption
|
67
68
|
quote = "<figure class='quote'>#{quote}#{cap}</figure>"
|
68
69
|
end
|
69
70
|
quote
|
70
71
|
end
|
71
72
|
|
72
|
-
def parse_content(content, context)
|
73
|
-
path = context.environments.first['page']['path']
|
74
|
-
ext = File.extname(path[1..-1])[1..-1]
|
75
|
-
site = context.registers[:site]
|
76
|
-
mdext = site.config['markdown_ext']
|
77
|
-
txext = site.config['textile_ext']
|
78
|
-
|
79
|
-
if mdext.include? ext
|
80
|
-
site.getConverterImpl(Jekyll::Converters::Markdown).convert(content)
|
81
|
-
elsif txext.include? ext
|
82
|
-
site.getConverterImpl(Jekyll::Converters::Textile).convert(content)
|
83
|
-
else
|
84
|
-
"<p>" + content.strip.gsub(/\n\n/, "<p>\n\n</p>") + "</p>"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
73
|
def figcaption
|
89
74
|
if @options['author'] || @options['url'] || @options['title']
|
90
75
|
"<figcaption class='quote-source'>#{author || ''}#{title || ''}</figcaption>"
|
@@ -127,17 +112,17 @@ module Octopress
|
|
127
112
|
end
|
128
113
|
end
|
129
114
|
|
130
|
-
|
131
|
-
Liquid::Template.register_tag('
|
115
|
+
|
116
|
+
Liquid::Template.register_tag('blockquote', Octopress::Tags::Quote::Tag)
|
117
|
+
Liquid::Template.register_tag('quote', Octopress::Tags::Quote::Tag)
|
132
118
|
|
133
119
|
if defined? Octopress::Docs
|
134
120
|
Octopress::Docs.add({
|
135
121
|
name: "Octopress Quote Tag",
|
136
122
|
gem: "octopress-quote-tag",
|
137
|
-
description: "Easy HTML5 blockquotes for Jekyll sites
|
123
|
+
description: "Easy HTML5 blockquotes for Jekyll sites",
|
138
124
|
path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
|
139
125
|
source_url: "https://github.com/octopress/quote-tag",
|
140
|
-
version: Octopress::Tags::
|
126
|
+
version: Octopress::Tags::Quote::VERSION
|
141
127
|
})
|
142
128
|
end
|
143
|
-
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Tags
|
3
|
+
module Quote
|
4
|
+
module Utils
|
5
|
+
def self.parse_content(content, context)
|
6
|
+
path = context.environments.first['page']['path']
|
7
|
+
ext = File.extname(path[1..-1])[1..-1]
|
8
|
+
site = context.registers[:site]
|
9
|
+
mdext = site.config['markdown_ext']
|
10
|
+
txext = site.config['textile_ext']
|
11
|
+
|
12
|
+
if mdext.include? ext
|
13
|
+
site.getConverterImpl(Jekyll::Converters::Markdown).convert(content)
|
14
|
+
elsif txext.include? ext
|
15
|
+
site.getConverterImpl(Jekyll::Converters::Textile).convert(content)
|
16
|
+
else
|
17
|
+
"<p>" + content.strip.gsub(/\n\n/, "<p>\n\n</p>") + "</p>"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/octopress-quote-tag.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'octopress-quote-tag/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "octopress-quote-tag"
|
8
|
-
spec.version = Octopress::Tags::
|
8
|
+
spec.version = Octopress::Tags::Quote::VERSION
|
9
9
|
spec.authors = ["Brandon Mathis"]
|
10
10
|
spec.email = ["brandon@imathis.com"]
|
11
11
|
spec.summary = %q{Nicely formatted HTML5 blockquotes for Jekyll sites}
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "jekyll"
|
22
|
+
spec.add_runtime_dependency "rubypants"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
25
|
spec.add_development_dependency "rake"
|
data/test/_config.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
<blockquote><p><strong>Quick</strong> wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs!
|
1
|
+
<blockquote><p><strong>Quick</strong> wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.</p></blockquote>
|
2
2
|
|
3
|
-
<figure class=
|
3
|
+
<figure class='quote'><blockquote><p>Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. <a href="http://timecube.com">How quickly</a> daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.</p></blockquote><figcaption class='quote-source'><span class='quote-author'>Bobby Jones </span></figcaption></figure>
|
4
4
|
|
5
|
-
<figure class=
|
5
|
+
<figure class='quote'><blockquote><p>Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.</p></blockquote><figcaption class='quote-source'><span class='quote-author'>Bobby Jones</span><cite class='quote-title'>Some Book</cite></figcaption></figure>
|
6
6
|
|
7
|
-
<figure class=
|
7
|
+
<figure class='quote'><blockquote><p>Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.</p></blockquote><figcaption class='quote-source'><span class='quote-author'>Bobby Jones</span><cite class='quote-title'><a class='quote-link' href='http://foo.com/blahboogersblahasdfoasdfasdf'>Some Article</a></cite></figcaption></figure>
|
8
8
|
|
9
|
-
<figure class=
|
9
|
+
<figure class='quote'><blockquote><p>Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.</p></blockquote><figcaption class='quote-source'><span class='quote-author'><a class='quote-link' href='http://foo.com/blahboogersblahasdfoasdfasdf'>Bobby Jones</a></span></figcaption></figure>
|
10
10
|
|
11
|
-
<blockquote><p>Here
|
11
|
+
<blockquote><p>Here's a paragraph where something happens</p>
|
12
12
|
|
13
|
-
<p>Here
|
13
|
+
<p>Here's another paragraph where something happens</p></blockquote>
|
data/test/markdown.md
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
---
|
3
3
|
|
4
4
|
{% blockquote %}
|
5
|
-
**Quick** wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!
|
5
|
+
**Quick** wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.
|
6
6
|
{% endblockquote %}
|
7
7
|
|
8
8
|
{% blockquote Bobby Jones %}
|
9
|
-
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. [How quickly](http://timecube.com) daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!
|
9
|
+
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. [How quickly](http://timecube.com) daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.
|
10
10
|
{% endblockquote %}
|
11
11
|
|
12
12
|
{% blockquote Bobby Jones, Some Book %}
|
13
|
-
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!
|
13
|
+
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.
|
14
14
|
{% endblockquote %}
|
15
15
|
|
16
|
-
{%
|
17
|
-
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!
|
18
|
-
{%
|
16
|
+
{% quote author:"Bobby Jones" url:http://foo.com/blahboogersblahasdfoasdfasdf title:"Some Article" %}
|
17
|
+
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.
|
18
|
+
{% endquote %}
|
19
19
|
|
20
20
|
{% blockquote Bobby Jones http://foo.com/blahboogersblahasdfoasdfasdf %}
|
21
|
-
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!
|
21
|
+
Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! "Now fax quiz Jack!" my brave ghost pled.
|
22
22
|
{% endblockquote %}
|
23
23
|
|
24
24
|
{% blockquote %}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-quote-tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubypants
|
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'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +124,7 @@ files:
|
|
110
124
|
- README.md
|
111
125
|
- Rakefile
|
112
126
|
- lib/octopress-quote-tag.rb
|
127
|
+
- lib/octopress-quote-tag/utils.rb
|
113
128
|
- lib/octopress-quote-tag/version.rb
|
114
129
|
- octopress-quote-tag.gemspec
|
115
130
|
- test/Gemfile
|