Skip to content

Commit

Permalink
Merge pull request #41 from jedcn/add-description
Browse files Browse the repository at this point in the history
Add "description" and "generator" meta tags
  • Loading branch information
jedcn committed May 10, 2015
2 parents 0235731 + 35021c8 commit 472e2b6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
17 changes: 13 additions & 4 deletions features/generate-with-config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Feature: The capabilities of config.yml
Scenario: Generating slides with a template and config.yml
Given a file named "config.yml" with:
"""
title: "Awesome Title"
author: "Awesome Author"
theme: "night"
transition: "page"
title: "Awesome Title"
author: "Awesome Author"
theme: "night"
transition: "page"
description: "My beautiful slides"
"""
Given a file named "slides.haml" with:
"""
Expand All @@ -42,6 +43,14 @@ Feature: The capabilities of config.yml
"""
And the file "slides/index.html" should contain:
"""
<meta name="description" content="My beautiful slides">
"""
And the file "slides/index.html" should contain:
"""
<meta name="generator" content="reveal-ck
"""
And the file "slides/index.html" should contain:
"""
<link rel="stylesheet" href="css/theme/night.css" id="theme">
"""
And the file "slides/index.html" should contain:
Expand Down
3 changes: 2 additions & 1 deletion files/reveal-ck/templates/index.html/head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

<title><%= config.title %></title>

<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="description" content="<%= config.description %>">
<meta name="author" content="<%= config.author %>">
<meta name="generator" content="reveal-ck <%= RevealCK::VERSION %>">

<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
Expand Down
9 changes: 5 additions & 4 deletions lib/reveal-ck/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ def defaults

def core_defaults
{
'title' => 'Slides',
'author' => '',
'theme' => 'black',
'transition' => 'default',
'title' => 'Slides',
'description' => '',
'author' => '',
'theme' => 'black',
'transition' => 'default',
'data' => {

}
Expand Down
13 changes: 13 additions & 0 deletions spec/lib/reveal-ck/builders/index_html_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'spec_helper'

module RevealCK
VERSION = '1.0'

module Builders
describe IndexHtml do
let :index_html_erb do
Expand All @@ -15,6 +17,7 @@ module Builders
let :config do
config = Config.new
config.title = 'Sample Title'
config.description = 'Sample Description'
config.author = 'Sample Author'
config.theme = 'night'
config.transition = 'page'
Expand All @@ -41,11 +44,21 @@ module Builders
.to include('<html lang="en">')
end

it 'prints the program name and version in the generator tag' do
expect(rendered_content)
.to include('<meta name="generator" content="reveal-ck 1.0">')
end

it 'supports replacing the configured title' do
expect(rendered_content)
.to include('<title>Sample Title</title>')
end

it 'support replacing the configured description' do
expect(rendered_content)
.to include('<meta name="description" content="Sample Description">')
end

it 'supports replacing the configured author' do
expect(rendered_content)
.to include('<meta name="author" content="Sample Author">')
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/reveal-ck/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ module RevealCK
expect(config.title).to eq 'My Presentation'
end

it 'supplies a default description' do
expect(config.description).to eq ''
end

it 'supplies a #description, and #description=' do
config.description = 'My beautiful slides'
expect(config.description).to eq 'My beautiful slides'
end

it 'supplies a default transition' do
expect(config.transition).to eq 'default'
end
Expand Down

0 comments on commit 472e2b6

Please sign in to comment.