jarrett-quarto 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.0
data/lib/quarto.rb CHANGED
@@ -10,6 +10,7 @@ require 'quarto/config'
10
10
  require 'quarto/xml_doc'
11
11
  require 'quarto/inheritable_attributes'
12
12
  require 'quarto/url_helper'
13
+ require 'quarto/rails_helper'
13
14
  require 'quarto/element_wrapper'
14
15
  require 'quarto/children'
15
16
  require 'quarto/rendering'
@@ -130,9 +130,11 @@ module Quarto
130
130
  def render_to_s(template, locals, options = {})
131
131
  require urls_file_path
132
132
 
133
+ mixins = [Quarto::ProjectUrls, Quarto::RailsHelper, Quarto::UrlHelper]
134
+
133
135
  page_template_path = "#{@project_path}/pages/#{template}"
134
136
  page_template = ERB.new(File.read(page_template_path))
135
- page_content = Rendering.render(page_template, locals, [Quarto::ProjectUrls])
137
+ page_content = Rendering.render(page_template, locals, mixins)
136
138
 
137
139
  if options.has_key?(:layout)
138
140
  layout = options[:layout]
@@ -149,7 +151,7 @@ module Quarto
149
151
  layout_template_path = "#{@project_path}/layouts/#{layout}"
150
152
  raise ArgumentError, "Template doesn't exist: #{layout_template_path}" unless File.exists?(layout_template_path)
151
153
  layout_template = ERB.new(File.read(layout_template_path))
152
- Rendering.render(layout_template, locals, [Quarto::ProjectUrls]) do
154
+ Rendering.render(layout_template, locals, mixins) do
153
155
  page_content
154
156
  end
155
157
  else
@@ -0,0 +1,7 @@
1
+ module Quarto
2
+ module RailsHelper
3
+ def rails?
4
+ defined? RAILS_GEM_VERSION
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,5 @@
1
1
  module Quarto
2
2
  class Rendering # :nodoc: all
3
- include Quarto::UrlHelper
4
-
5
3
  def initialize(__erb_template, __locals, __mixins)
6
4
  unless __erb_template.is_a?(ERB)
7
5
  raise ArgumentError, "Expected ERB but got #{__erb_template.inspect}"
data/quarto.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{quarto}
5
- s.version = "1.2.1"
5
+ s.version = "1.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jarrett Colby"]
9
- s.date = %q{2009-06-09}
9
+ s.date = %q{2009-06-10}
10
10
  s.default_executable = %q{quarto}
11
11
  s.description = %q{Quarto is a Ruby framework for generating collections of documents from XML. It steps in where XSLT just won't cut it. Potential applications include web sites and e-books. It's built on top of ERB and REXML.}
12
12
  s.email = %q{jarrett@uchicago.edu}
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "lib/quarto/generator.rb",
27
27
  "lib/quarto/inheritable_attributes.rb",
28
28
  "lib/quarto/init_project.rb",
29
+ "lib/quarto/rails_helper.rb",
29
30
  "lib/quarto/rendering.rb",
30
31
  "lib/quarto/url_helper.rb",
31
32
  "lib/quarto/xml_doc.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarrett-quarto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Colby
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-09 00:00:00 -07:00
12
+ date: 2009-06-10 00:00:00 -07:00
13
13
  default_executable: quarto
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,6 +42,7 @@ files:
42
42
  - lib/quarto/generator.rb
43
43
  - lib/quarto/inheritable_attributes.rb
44
44
  - lib/quarto/init_project.rb
45
+ - lib/quarto/rails_helper.rb
45
46
  - lib/quarto/rendering.rb
46
47
  - lib/quarto/url_helper.rb
47
48
  - lib/quarto/xml_doc.rb