Skip to content
This repository

Support RDoc 4 #168

Merged
merged 4 commits into from over 1 year ago

3 participants

Magnus Holm Ryan Tomayko Konstantin Haase
Magnus Holm
Collaborator

Thoughts on the implementation?

Ryan Tomayko
Owner

Works for me. Maybe add some light comments about this being written to work under a few different RDoc versions?

Magnus Holm
Collaborator
Konstantin Haase
Collaborator

Also, fixing Tilt on Travis would be cool.

judofyr added some commits
Magnus Holm judofyr Add comment about RDoc 4.0 hack a25e8af
Magnus Holm judofyr Tweak RDoc dependency:
* Add the rdoc gem as development dependency
* Make rdoc overridable in Gemfile
* Add RDoc ~>3.0 to Travis
714ab6b
Magnus Holm
Collaborator

I tweaked the RDoc dependency a bit (see last commit) so now we test RDoc 3 and 4 on Travis: https://travis-ci.org/rtomayko/tilt/builds/5064446

Magnus Holm judofyr merged commit 714ab6b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 4 unique commits by 1 author.

Feb 25, 2013
Magnus Holm judofyr Make RDoc tests less specific aaffdb1
Magnus Holm judofyr Support RDoc 4.0 d0132af
Feb 26, 2013
Magnus Holm judofyr Add comment about RDoc 4.0 hack a25e8af
Magnus Holm judofyr Tweak RDoc dependency:
* Add the rdoc gem as development dependency
* Make rdoc overridable in Gemfile
* Add RDoc ~>3.0 to Travis
714ab6b
This page is out of date. Refresh to see the latest.
5 .travis.yml
@@ -6,3 +6,8 @@ rvm:
6 6 - 2.0.0
7 7 - jruby
8 8 - rbx
  9 +
  10 +matrix:
  11 + include:
  12 + - rvm: 1.9.3
  13 + env: RDOC_VERSION="~>3.0"
3  Gemfile
... ... @@ -1,3 +1,6 @@
1 1 source "http://rubygems.org"
2 2 gem 'rake'
3 3 gemspec
  4 +
  5 +gem 'rdoc', ENV['RDOC_VERSION'] if ENV['RDOC_VERSION']
  6 +
14 lib/tilt/rdoc.rb
@@ -11,7 +11,7 @@ class RDocTemplate < Template
11 11 self.default_mime_type = 'text/html'
12 12
13 13 def self.engine_initialized?
14   - defined? ::RDoc::Markup
  14 + defined? ::RDoc::Markup::ToHtml
15 15 end
16 16
17 17 def initialize_engine
@@ -20,8 +20,18 @@ def initialize_engine
20 20 require_template_library 'rdoc/markup/to_html'
21 21 end
22 22
  23 + def markup
  24 + begin
  25 + # RDoc 4.0
  26 + require 'rdoc/options'
  27 + RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
  28 + rescue ArgumentError
  29 + # RDoc < 4.0
  30 + RDoc::Markup::ToHtml.new
  31 + end
  32 + end
  33 +
23 34 def prepare
24   - markup = RDoc::Markup::ToHtml.new
25 35 @engine = markup.convert(data)
26 36 @output = nil
27 37 end
10 test/tilt_rdoctemplate_test.rb
@@ -12,12 +12,18 @@ class RDocTemplateTest < Test::Unit::TestCase
12 12
13 13 test "preparing and evaluating the template with #render" do
14 14 template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
15   - assert_equal "<h1 id=\"label-Hello+World%21\">Hello World!</h1>", template.render.strip
  15 + result = template.render.strip
  16 + assert_match /<h1/, result
  17 + assert_match />Hello World!</, result
16 18 end
17 19
18 20 test "can be rendered more than once" do
19 21 template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
20   - 3.times { assert_equal "<h1 id=\"label-Hello+World%21\">Hello World!</h1>", template.render.strip }
  22 + 3.times do
  23 + result = template.render.strip
  24 + assert_match /<h1/, result
  25 + assert_match />Hello World!</, result
  26 + end
21 27 end
22 28 end
23 29 rescue LoadError => boom
1  tilt.gemspec
@@ -103,6 +103,7 @@ Gem::Specification.new do |s|
103 103 s.add_development_dependency 'sass'
104 104 s.add_development_dependency 'wikicloth'
105 105 s.add_development_dependency 'yajl-ruby'
  106 + s.add_development_dependency 'rdoc'
106 107
107 108 s.homepage = "http://github.com/rtomayko/tilt/"
108 109 s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tilt", "--main", "Tilt"]

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.