Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use smartify filter #117

Merged
merged 1 commit into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ There are several ways to convey author-specific information. Author information
author: benbalter
```

* `image` - URL of an image that is representative of the post.
* `image` - URL of an image that is representative of the post.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the noise. My text editor strips trailing space on save 😕


### Meta tags

The plugin exposes a helper tag to expose the appropriate meta tags to support automated discovery of your feed. Simply place `{% feed_meta %}` someplace in your template's `<head>` section, to output the necessary metadata.

### SmartyPants

The plugin uses [Jekyll's `smartify` filter](https://jekyllrb.com/docs/templates/) for processing the site title and post titles. This will translate plain ASCII punctuation into "smart" typographic punctuation. This will not render or strip any Markdown you may be using in a title.

## Why Atom, and not RSS?

Great question. In short, Atom is a better format. Think of it like RSS 3.0. For more information, see [this discussion on why we chose Atom over RSS 2.0](https://github.com/jekyll/jekyll-rss-feed/issues/2).
Expand Down
2 changes: 1 addition & 1 deletion jekyll-feed.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "jekyll", ">= 3.0.0", "< 3.2.0"
spec.add_development_dependency "jekyll", ">= 3.1.0", "< 3.2.0"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
Expand Down
6 changes: 3 additions & 3 deletions lib/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<id>{{ url_base | xml_escape }}/</id>

{% if site.title %}
<title>{{ site.title | xml_escape }}</title>
<title>{{ site.title | smartify | xml_escape }}</title>
{% elsif site.name %}
<title>{{ site.name | xml_escape }}</title>
<title>{{ site.name | smartify | xml_escape }}</title>
{% endif %}

{% if site.description %}
Expand All @@ -41,7 +41,7 @@
{% for post in site.posts limit: 10 %}
{% unless post.draft %}
<entry{% if post.lang %} xml:lang="{{ post.lang }}"{% endif %}>
<title>{{ post.title | markdownify | strip_html | replace: '\n', ' ' | strip | xml_escape }}</title>
<title>{{ post.title | smartify | strip_html | replace: '\n', ' ' | strip | xml_escape }}</title>
<link href="{{ post.url | prepend: url_base }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
<published>{{ post.date | date_to_xmlschema }}</published>
{% if post.last_modified_at %}
Expand Down
10 changes: 10 additions & 0 deletions spec/jekyll-feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@
end
end

context "smartify" do
let(:site_title) { "Pat's Site" }
let(:overrides) { { "title" => site_title } }
let(:feed) { RSS::Parser.parse(contents) }

it "processes site title with SmartyPants" do
expect(feed.title.content).to eql("Pat’s Site")
end
end

context "validation" do
it "validates" do
# See https://validator.w3.org/docs/api.html
Expand Down