rote 0.3.2.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS +2 -0
- data/README +2 -7
- data/Rakefile +14 -6
- data/TODO +4 -1
- data/doc/pages/guide/index.html +16 -0
- data/doc/pages/index.html +1 -1
- data/lib/rote.rb +3 -3
- data/lib/rote/app.rb +1 -1
- data/lib/rote/cache.rb +17 -13
- data/lib/rote/extratasks.rb +105 -0
- data/lib/rote/filters.rb +1 -1
- data/lib/rote/filters/base.rb +1 -1
- data/lib/rote/filters/bluecloth.rb +1 -1
- data/lib/rote/filters/rdoc.rb +2 -1
- data/lib/rote/filters/redcloth.rb +41 -1
- data/lib/rote/filters/syntax.rb +1 -1
- data/lib/rote/filters/tidy.rb +1 -1
- data/lib/rote/filters/toc.rb +1 -1
- data/lib/rote/format.rb +1 -1
- data/lib/rote/format/html.rb +1 -1
- data/lib/rote/page.rb +1 -1
- data/lib/rote/project/Rakefile +1 -1
- data/lib/rote/rotetasks.rb +15 -9
- data/test/test_filters.rb +1 -7
- data/test/test_page.rb +1 -1
- metadata +5 -3
data/CONTRIBUTORS
CHANGED
data/README
CHANGED
@@ -132,10 +132,5 @@ probably be totally useless to anyone but me. Keeping a list like this
|
|
132
132
|
accurate and up to date is a recipe for disaster, so I'll take the safe
|
133
133
|
option and say 'thanks, everyone' :)
|
134
134
|
|
135
|
-
Thanks also to Yukihiro Matsumoto for a remarkable platform,
|
136
|
-
|
137
|
-
for making markup easy in Ruby. Thanks to the authors of all the libraries and
|
138
|
-
tools used by Rote, and thanks too to the many people who've contributed
|
139
|
-
and improved these things over the years - as ever, we stand on the shoulders
|
140
|
-
of giants.
|
141
|
-
|
135
|
+
Thanks also to Yukihiro Matsumoto for a remarkable platform, and all those
|
136
|
+
who write and contribute to the libraries Rote depends on.
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# This Rakefile is heavily based on Rake's own Rakefile.
|
7
7
|
# Portions copyright (c)2003, 2004 Jim Weirich (jim <AT> weirichhouse.org)
|
8
8
|
#
|
9
|
-
# $Id: Rakefile
|
9
|
+
# $Id: Rakefile 185 2006-10-26 19:41:31Z roscopeco $
|
10
10
|
#
|
11
11
|
|
12
12
|
begin
|
@@ -19,7 +19,6 @@ end
|
|
19
19
|
require 'rake/clean'
|
20
20
|
require 'rake/testtask'
|
21
21
|
require 'rake/rdoctask'
|
22
|
-
|
23
22
|
# This needs to go at the front of the libpath
|
24
23
|
# Otherwise, any pre-installed rote gets found,
|
25
24
|
# and used from there. This is only necessary
|
@@ -31,6 +30,7 @@ require 'rote/filters/redcloth'
|
|
31
30
|
require 'rote/filters/syntax'
|
32
31
|
require 'rote/filters/tidy'
|
33
32
|
require 'rote/format/html'
|
33
|
+
require 'rote/extratasks'
|
34
34
|
include Rote
|
35
35
|
|
36
36
|
CLEAN.include('tidy.log')
|
@@ -108,7 +108,7 @@ end
|
|
108
108
|
# Website / Doc tasks ------------------------------------------------
|
109
109
|
|
110
110
|
# Create a task to build the RDOC documentation tree.
|
111
|
-
rd = Rake::RDocTask.new(
|
111
|
+
rd = Rake::RDocTask.new(:rdoc) { |rdoc|
|
112
112
|
rdoc.rdoc_dir = 'html/rdoc'
|
113
113
|
# rdoc.template = 'kilmer'
|
114
114
|
# rdoc.template = 'css2'
|
@@ -121,6 +121,14 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
|
121
121
|
rdoc.rdoc_files.exclude('lib/rote/project/**/*')
|
122
122
|
}
|
123
123
|
|
124
|
+
# Code coverage report
|
125
|
+
Rote::RCovTask.new { |rcov|
|
126
|
+
rcov.test_files.include 'test/gem*.rb'
|
127
|
+
rcov.source_files.include 'lib/**/*.rb'
|
128
|
+
rcov.profile = true
|
129
|
+
rcov.output_dir = 'html/coverage'
|
130
|
+
}
|
131
|
+
|
124
132
|
# Create a task build the website / docs
|
125
133
|
ws = Rote::DocTask.new(:doc) { |site|
|
126
134
|
site.output_dir = 'html'
|
@@ -148,8 +156,8 @@ ws = Rote::DocTask.new(:doc) { |site|
|
|
148
156
|
site.res.include('**/*.css')
|
149
157
|
}
|
150
158
|
|
151
|
-
# add rdoc
|
152
|
-
task :doc => [:rdoc]
|
159
|
+
# add rdoc/rcov deps to doc task
|
160
|
+
task :doc => [:rdoc, :rcov]
|
153
161
|
|
154
162
|
desc "Publish the documentation and web site"
|
155
163
|
task :doc_upload => [ :doc ] do
|
@@ -161,7 +169,7 @@ task :doc_upload => [ :doc ] do
|
|
161
169
|
"html"
|
162
170
|
).upload
|
163
171
|
else
|
164
|
-
|
172
|
+
$stderr << "Skipping documentation upload - Need to set RUBYFORGE_ACCT to your rubyforge.org user name"
|
165
173
|
end
|
166
174
|
end
|
167
175
|
|
data/TODO
CHANGED
@@ -8,7 +8,10 @@ Send any suggestions or patches (preferably as/with tests) to:
|
|
8
8
|
== For 0.3.x
|
9
9
|
* Plugins, maybe allow pseudo-sections to be created
|
10
10
|
in COMMON.rb, that get their pages from some supplied code.
|
11
|
-
Anything else then stays out of Rote, which is what's needed.
|
11
|
+
Anything else then stays out of Rote, which is what's needed.
|
12
|
+
|
13
|
+
* Add ability to use external sources in syntax plugin, e.g.
|
14
|
+
with a 'source' arg to macro.
|
12
15
|
|
13
16
|
== For 0.3.x or 0.4
|
14
17
|
* Ability to have multiple views of a section, e.g. user guide (separate
|
data/doc/pages/guide/index.html
CHANGED
@@ -599,6 +599,22 @@ doc.ext_mapping(/(html)/, '$1') do |page|
|
|
599
599
|
end
|
600
600
|
#:code#
|
601
601
|
|
602
|
+
Extension mappings also support per-extension output directories, which
|
603
|
+
can be supplied as a third parameter to the @ext_mapping@ method:
|
604
|
+
|
605
|
+
doc.output_dir = 'html'
|
606
|
+
|
607
|
+
#:code#ruby#
|
608
|
+
doc.ext_mapping(/ttxt/, 'txt', 'plaintext') do |page|
|
609
|
+
|
610
|
+
# do stuff
|
611
|
+
|
612
|
+
end
|
613
|
+
#:code#
|
614
|
+
|
615
|
+
Where no output directory is supplied, the default output directory will
|
616
|
+
be used.
|
617
|
+
|
602
618
|
<%= section 4, 'Defining additional tasks' %>
|
603
619
|
|
604
620
|
The command-line build will automatically look for a file in the top-level
|
data/doc/pages/index.html
CHANGED
@@ -50,6 +50,6 @@ A link to the latest stable release can be found from the "project page":http://
|
|
50
50
|
You can also grab the latest code from Subversion . The trunk always has the most up to date development code
|
51
51
|
while the latest release, while can be found on the appropriate tag for that version. Although every effort
|
52
52
|
is made to ensure that this development code works, it cannot of course be guaranteed to be complete or bug
|
53
|
-
free. If that
|
53
|
+
free. If that's okay with you (maybe you're pretty happy-go-lucky in general...) then see our
|
54
54
|
"SCM page":http://rubyforge.org/scm/?group_id=1120 at Rubyforge for everything you need to get going with
|
55
55
|
the SVN version.
|
data/lib/rote.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# rote.rb - main Rote module
|
2
|
-
# Copyright (c) 2005 Ross Bamford (and contributors)
|
3
|
-
# $Id: rote.rb
|
2
|
+
# Copyright (c) 2005, 2006 Ross Bamford (and contributors)
|
3
|
+
# $Id: rote.rb 186 2006-10-26 19:44:00Z roscopeco $
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -41,7 +41,7 @@ end
|
|
41
41
|
require 'rake'
|
42
42
|
|
43
43
|
# Master Rote version. Manage this from the Rake release support.
|
44
|
-
ROTEVERSION = '0.3.
|
44
|
+
ROTEVERSION = '0.3.4'
|
45
45
|
|
46
46
|
#####
|
47
47
|
## *Rote* is a Rake (http://rake.rubyforge.org) based build tool for static
|
data/lib/rote/app.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# (c)2005 Ross Bamford (and contributors)
|
3
3
|
#
|
4
4
|
# See 'rote.rb' or LICENSE for licence information.
|
5
|
-
# $Id: app.rb
|
5
|
+
# $Id: app.rb 128 2005-12-12 02:45:24Z roscopeco $
|
6
6
|
require 'getoptlong'
|
7
7
|
|
8
8
|
module Rote
|
data/lib/rote/cache.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# (c)2005, 2006 Ross Bamford (and contributors)
|
5
5
|
#
|
6
6
|
# See 'rote.rb' or LICENSE for licence information.
|
7
|
-
# $Id: cache.rb
|
7
|
+
# $Id: cache.rb 179 2006-02-28 18:33:54Z roscopeco $
|
8
8
|
#++
|
9
9
|
# This file adds dynamic dependency tracking and caching for
|
10
10
|
# incremental builds, by adding methods to the Rake module
|
@@ -58,23 +58,27 @@ module Rake
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
# Patch load_imports so cached dependencies will be loaded
|
63
|
+
# after the main rakefile but before the tasks are executed
|
64
|
+
class Application
|
65
|
+
old_load_imports = instance_method(:load_imports)
|
66
|
+
define_method(:load_imports) do
|
67
|
+
Rake.load_cached_dependencies
|
68
|
+
old_load_imports.bind(self).call
|
69
|
+
end
|
70
|
+
end
|
61
71
|
|
62
72
|
class Task
|
63
|
-
|
73
|
+
old_execute = instance_method(:execute)
|
64
74
|
|
65
|
-
#
|
66
|
-
# loaded, and handling the task stack.
|
67
|
-
|
68
|
-
# be set false except in testing.
|
69
|
-
def invoke
|
70
|
-
# Invoke patched to record task stack and
|
71
|
-
# load cached dependencies on first go.
|
72
|
-
Rake.load_cached_dependencies if Rake.cache_enabled?
|
73
|
-
|
75
|
+
# Execute the task, loading cached dependencies if not already
|
76
|
+
# loaded, and handling the task stack.
|
77
|
+
define_method(:execute) do
|
74
78
|
begin
|
75
79
|
Rake.task_stack << self
|
76
80
|
Rake.cached_dependencies[name] = [] if Rake.cached_dependencies[name]
|
77
|
-
|
81
|
+
old_execute.bind(self).call
|
78
82
|
ensure
|
79
83
|
Rake.task_stack.pop
|
80
84
|
end
|
@@ -120,7 +124,7 @@ module Rake
|
|
120
124
|
# An at_exit handler is installed to save the dependencies
|
121
125
|
# when rake exits.
|
122
126
|
def self.load_cached_dependencies
|
123
|
-
return
|
127
|
+
return unless !$CACHEDEPS_LOADED and Rake.cache_enabled?
|
124
128
|
|
125
129
|
at_exit { self.save_cached_dependencies }
|
126
130
|
|
@@ -0,0 +1,105 @@
|
|
1
|
+
#--
|
2
|
+
# Extra bonus Rake tasklibs for Rote and elsewhere
|
3
|
+
# (c)2005, 2006 Ross Bamford (and contributors)
|
4
|
+
#
|
5
|
+
# See 'rote.rb' or LICENSE for licence information.
|
6
|
+
# $Id$
|
7
|
+
#++
|
8
|
+
require 'rake'
|
9
|
+
|
10
|
+
module Rote
|
11
|
+
#####
|
12
|
+
## Rake task library that allows code-coverage reports to be
|
13
|
+
## generated using RCov (http://eigenclass.org/hiki.rb?rcov).
|
14
|
+
class RCovTask < Rake::TaskLib
|
15
|
+
# The base name for the generated task [:rcov]
|
16
|
+
attr_reader :taskname
|
17
|
+
|
18
|
+
# The command that runs RCov ['rcov']
|
19
|
+
attr_accessor :rcov_cmd
|
20
|
+
|
21
|
+
# A +Rake::FileList+ holding unit-test filenames and globs.
|
22
|
+
# RCov will execute these to generate the report.
|
23
|
+
attr_accessor :test_files
|
24
|
+
|
25
|
+
# A +Rake::FileList+ holding Ruby source filenames that are
|
26
|
+
# included in the coverage report. This is *optional* - RCov
|
27
|
+
# finds sources by running them. However, if you do specify
|
28
|
+
# your files here then the coverage report will only be
|
29
|
+
# generated when they change.
|
30
|
+
attr_accessor :source_files
|
31
|
+
|
32
|
+
# The path to which RCov should generate output [./coverage]
|
33
|
+
attr_accessor :output_dir
|
34
|
+
|
35
|
+
# Extra load-paths that should be appended to $: when running
|
36
|
+
# the test cases. [none]
|
37
|
+
attr_accessor :load_paths
|
38
|
+
|
39
|
+
# If true, RCov will generate colorblind-safe output. [false]
|
40
|
+
attr_accessor :no_color
|
41
|
+
|
42
|
+
# Set of glob patterns that should be excluded from the test
|
43
|
+
# run. [none]
|
44
|
+
attr_accessor :excludes
|
45
|
+
|
46
|
+
# Determines whether bogo-profiling is enabled [false]
|
47
|
+
attr_accessor :profile
|
48
|
+
|
49
|
+
# The color scale range for profiling output (dB) [not used]
|
50
|
+
attr_accessor :range
|
51
|
+
|
52
|
+
# Create a new RCovTask, using the supplied block for configuration,
|
53
|
+
# and define tasks with the specified base-name within Rake.
|
54
|
+
#
|
55
|
+
# Note that the named task just invokes a file task for the output
|
56
|
+
# directory, which is dependent on test (and source, if specified)
|
57
|
+
# file changes.
|
58
|
+
def initialize(name = :rcov) # :yield: self if block_given?
|
59
|
+
@taskname = name
|
60
|
+
@rcov_cmd = 'rcov'
|
61
|
+
@test_files = Rake::FileList.new
|
62
|
+
@source_files = Rake::FileList.new
|
63
|
+
@load_paths = []
|
64
|
+
@excludes = []
|
65
|
+
@output_dir = './coverage'
|
66
|
+
|
67
|
+
yield self if block_given?
|
68
|
+
|
69
|
+
define(name)
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def define(name)
|
75
|
+
unless @test_files.empty?
|
76
|
+
if defined? CLOBBER
|
77
|
+
CLOBBER.include @output_dir
|
78
|
+
elsif defined? CLEAN
|
79
|
+
CLEAN.include @output_dir
|
80
|
+
end
|
81
|
+
|
82
|
+
(@test_files + @source_files).each { |fn| file fn }
|
83
|
+
|
84
|
+
file @output_dir => (@test_files + @source_files) do
|
85
|
+
cmd = "#{rcov_cmd}" <<
|
86
|
+
"#{" -o #{@output_dir}" if @output_dir}" <<
|
87
|
+
"#{" -I #{@load_paths.join(':')}" unless @load_paths.empty?}" <<
|
88
|
+
"#{" -n" if @no_color}" <<
|
89
|
+
"#{" -x #{@excludes.join(':')}" unless @excludes.empty?}" <<
|
90
|
+
"#{" -p" if @profile}" <<
|
91
|
+
"#{" -r #{@range}" if @range}" <<
|
92
|
+
" " << @test_files.join(' ')
|
93
|
+
|
94
|
+
puts cmd
|
95
|
+
unless system(cmd)
|
96
|
+
fail "RCov command '#{rcov_cmd}' failed (status #{$?.exitstatus})"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
task name => @output_dir
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
data/lib/rote/filters.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2005, 2006 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: filters.rb
|
6
|
+
# $Id: filters.rb 163 2006-01-05 21:15:54Z roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
9
|
# Everyone requires this, we need to get it loaded first.
|
data/lib/rote/filters/base.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2005 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: base.rb
|
6
|
+
# $Id: base.rb 144 2005-12-14 19:17:21Z roscopeco $
|
7
7
|
#++
|
8
8
|
module Rote
|
9
9
|
module Filters
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2006 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: bluecloth.rb
|
6
|
+
# $Id: bluecloth.rb 160 2006-01-05 21:05:44Z roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
9
|
require 'bluecloth'
|
data/lib/rote/filters/rdoc.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
# (c)2005 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: rdoc.rb
|
6
|
+
# $Id: rdoc.rb 177 2006-02-26 19:59:11Z roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
|
+
require 'rote/filters/base'
|
9
10
|
require 'rdoc/markup/simple_markup'
|
10
11
|
require 'rdoc/markup/simple_markup/to_html'
|
11
12
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2005, 2006 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: redcloth.rb
|
6
|
+
# $Id: redcloth.rb 180 2006-10-26 19:38:30Z roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
9
|
require 'redcloth'
|
@@ -37,6 +37,46 @@ module Rote
|
|
37
37
|
rc.to_html(*@redcloth_opts)
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
# Redcloth filter that adds a table of contents at the top of the given text
|
42
|
+
# and sufficent hyperlinks to access the various headings in the text. This
|
43
|
+
# can be used instead of the standard TOC filter to get TOC capabilities
|
44
|
+
# during page (rather than layout) rendering.
|
45
|
+
#
|
46
|
+
# Contributed by Suraj Kurapati.
|
47
|
+
class RedCloth_WithToc < RedCloth
|
48
|
+
Heading = Struct.new(:depth, :anchor, :title) unless const_defined?(:Heading)
|
49
|
+
|
50
|
+
def handler text, *args
|
51
|
+
# determine structure of content and insert anchors where necessary
|
52
|
+
headings = []
|
53
|
+
|
54
|
+
text = text.gsub /^(\s*h(\d))(.*?)(\.(.*))$/ do
|
55
|
+
target = $~.dup
|
56
|
+
|
57
|
+
if target[3] =~ /#([^#]+)\)/
|
58
|
+
anchor = $1
|
59
|
+
result = target.to_s
|
60
|
+
else
|
61
|
+
anchor = headings.length
|
62
|
+
result = "#{target[1]}#{target[3]}(##{anchor})#{target[4]}"
|
63
|
+
end
|
64
|
+
|
65
|
+
headings << Heading.new( target[2].to_i, anchor, target[5] )
|
66
|
+
result
|
67
|
+
end
|
68
|
+
|
69
|
+
# add table of contents at top of text
|
70
|
+
toc = headings.map do |h|
|
71
|
+
%{#{'*' * h.depth} "#{h.title}":##{h.anchor}}
|
72
|
+
end.join("\n")
|
73
|
+
|
74
|
+
text.insert 0, "\n\n\n"
|
75
|
+
text.insert 0, toc
|
76
|
+
|
77
|
+
super text, *args
|
78
|
+
end
|
79
|
+
end
|
40
80
|
end
|
41
81
|
end
|
42
82
|
|
data/lib/rote/filters/syntax.rb
CHANGED
data/lib/rote/filters/tidy.rb
CHANGED
data/lib/rote/filters/toc.rb
CHANGED
data/lib/rote/format.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2005 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: format.rb
|
6
|
+
# $Id: format.rb 128 2005-12-12 02:45:24Z roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
9
|
Dir[File.join(File.dirname(__FILE__), 'format/*.rb')].each { |f| require f }
|
data/lib/rote/format/html.rb
CHANGED
data/lib/rote/page.rb
CHANGED
data/lib/rote/project/Rakefile
CHANGED
data/lib/rote/rotetasks.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# (c)2005 Ross Bamford (and contributors)
|
4
4
|
#
|
5
5
|
# See 'rote.rb' or LICENSE for licence information.
|
6
|
-
# $Id: rotetasks.rb
|
6
|
+
# $Id: rotetasks.rb 182 2006-10-26 19:40:08Z roscopeco $
|
7
7
|
#++
|
8
8
|
require 'rake'
|
9
9
|
require 'rake/tasklib'
|
@@ -127,7 +127,10 @@ module Rote
|
|
127
127
|
attr_reader :name
|
128
128
|
|
129
129
|
# Base directories used by the task.
|
130
|
-
attr_accessor :
|
130
|
+
attr_accessor :default_output_dir, :layout_dir
|
131
|
+
|
132
|
+
alias :output_dir :default_output_dir
|
133
|
+
alias :output_dir= :default_output_dir=
|
131
134
|
|
132
135
|
# Globs for the +FileList+ that supplies the pages to transform. You
|
133
136
|
# should configure the +pages_dir+ and +include+ at least one entry
|
@@ -149,8 +152,8 @@ module Rote
|
|
149
152
|
# file extensions. Keys are regexps that are matched in order
|
150
153
|
# against the search key.
|
151
154
|
#
|
152
|
-
# The values are [extension, ({ |page| ...})] . If a mapping
|
153
|
-
# block, it is executed when pages with a matching extension are,
|
155
|
+
# The values are [extension, ({ |page| ...}), out_dir] . If a mapping
|
156
|
+
# has a block, it is executed when pages with a matching extension are,
|
154
157
|
# instantiated (before common and page code). It can be used to apply
|
155
158
|
# filters, for example, on a per-extension basis.
|
156
159
|
attr_reader :ext_mappings
|
@@ -158,8 +161,12 @@ module Rote
|
|
158
161
|
# Define an extension mapping for the specified regex, which will
|
159
162
|
# be replaced with the specified extension. If a block is supplied
|
160
163
|
# it will be called with each matching +Page+ as it's created.
|
161
|
-
|
162
|
-
|
164
|
+
#
|
165
|
+
# Extension mappings also allow the output directory to be specified
|
166
|
+
# on a per-extension basis. If no output directory is specified, the
|
167
|
+
# default output directory is used.
|
168
|
+
def ext_mapping(match, extension, output_dir = self.default_output_dir, &block)
|
169
|
+
@ext_mappings[match] = [extension,block,output_dir]
|
163
170
|
end
|
164
171
|
|
165
172
|
# If +show_page_tasks+ is +true+, then the file tasks created for each
|
@@ -211,10 +218,9 @@ module Rote
|
|
211
218
|
#
|
212
219
|
# Returns [target_fn, ({ |page| ...})]
|
213
220
|
def target_fn(dir_rx, fn)
|
221
|
+
ext = File.extname(fn).sub(/^\./,'') # strip leading dot
|
222
|
+
new_ext, blk, output_dir = ext_mappings[ext] || [ext,nil,self.default_output_dir]
|
214
223
|
tfn = fn.sub(dir_rx, output_dir)
|
215
|
-
ext = File.extname(tfn)
|
216
|
-
ext.sub!(/^\./,'') # strip leading dot
|
217
|
-
new_ext, blk = ext_mappings[ext] || [ext,nil]
|
218
224
|
[tfn.sub(/#{ext}$/,new_ext),blk]
|
219
225
|
end
|
220
226
|
|
data/test/test_filters.rb
CHANGED
@@ -9,13 +9,7 @@ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
|
|
9
9
|
|
10
10
|
require 'test/unit'
|
11
11
|
require 'rote/page'
|
12
|
-
require 'rote/filters
|
13
|
-
require 'rote/filters/bluecloth'
|
14
|
-
require 'rote/filters/rdoc'
|
15
|
-
require 'rote/filters/toc'
|
16
|
-
require 'rote/filters/syntax'
|
17
|
-
require 'rote/filters/exec'
|
18
|
-
require 'rote/filters/eval'
|
12
|
+
require 'rote/filters'
|
19
13
|
|
20
14
|
SYNTEST = <<-EOM
|
21
15
|
<p>Non-code</p>
|
data/test/test_page.rb
CHANGED
@@ -200,7 +200,7 @@ module Rote
|
|
200
200
|
assert_equal 'layout some text and some other text for a change.', t
|
201
201
|
end
|
202
202
|
|
203
|
-
def
|
203
|
+
def test_render_layout_nested
|
204
204
|
t = new_test_page('nestedlayout').render.chomp
|
205
205
|
assert_equal "layout with nested: 'some text and some other text' for a change.", t
|
206
206
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: rote
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.3.4
|
7
|
+
date: 2006-10-26 00:00:00 +01:00
|
8
8
|
summary: Adds template-based doc support to Rake.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
+
post_install_message:
|
28
29
|
authors:
|
29
30
|
- Ross Bamford
|
30
31
|
files:
|
@@ -37,6 +38,7 @@ files:
|
|
37
38
|
- CONTRIBUTORS
|
38
39
|
- bin/rote
|
39
40
|
- lib/rote.rb
|
41
|
+
- lib/rote/extratasks.rb
|
40
42
|
- lib/rote/rotetasks.rb
|
41
43
|
- lib/rote/page.rb
|
42
44
|
- lib/rote/cache.rb
|