rote 0.3.0.2 → 0.3.2
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/CONTRIBUTORS +1 -0
- data/DONE +6 -0
- data/LICENSE +1 -1
- data/README +10 -3
- data/Rakefile +1 -3
- data/TODO +18 -11
- data/doc/pages/guide/index.html +291 -87
- data/doc/res/stylesheets/normal.css +46 -4
- data/lib/rote.rb +2 -2
- data/lib/rote/app.rb +1 -1
- data/lib/rote/cache.rb +144 -0
- data/lib/rote/filters.rb +20 -4
- data/lib/rote/filters/base.rb +1 -1
- data/lib/rote/filters/bluecloth.rb +40 -0
- data/lib/rote/filters/eval.rb +58 -0
- data/lib/rote/filters/exec.rb +42 -0
- data/lib/rote/filters/rdoc.rb +1 -1
- data/lib/rote/filters/redcloth.rb +11 -9
- 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 +68 -41
- data/lib/rote/project/Rakefile +4 -5
- data/lib/rote/rotetasks.rb +1 -1
- data/test/layouts/nestme.rb +2 -0
- data/test/layouts/nestme.txt +1 -0
- data/test/pages/nestedlayout.rb +5 -0
- data/test/pages/nestedlayout.txt +1 -0
- data/test/test_cache.rb +67 -0
- data/test/{test_formatting.rb → test_filters.rb} +82 -4
- data/test/test_html_page.rb +1 -5
- data/test/test_page.rb +26 -8
- metadata +13 -8
- data/test/pages/markdown.txt +0 -8
- data/test/pages/rdoc.txt +0 -6
- data/test/pages/textile.rb +0 -3
- data/test/pages/textile.txt +0 -1
@@ -12,6 +12,7 @@ body {
|
|
12
12
|
margin: 0px 0px 0px 0px;
|
13
13
|
}
|
14
14
|
|
15
|
+
/* * linky links *** */
|
15
16
|
a:link {
|
16
17
|
color: #cc3030;
|
17
18
|
text-decoration: none;
|
@@ -60,8 +61,9 @@ a.nav:visited {
|
|
60
61
|
background: auto;
|
61
62
|
}
|
62
63
|
|
63
|
-
/* outer
|
64
|
+
/* * outer layout ** */
|
64
65
|
table.topbar {
|
66
|
+
/* outer div top bar on pages */
|
65
67
|
background: #f5f5f5;
|
66
68
|
color: #000000;
|
67
69
|
width: 100%;
|
@@ -92,8 +94,6 @@ img.navicon {
|
|
92
94
|
height: 22px;
|
93
95
|
}
|
94
96
|
|
95
|
-
/* ***************** */
|
96
|
-
|
97
97
|
div.frontcopyright {
|
98
98
|
/* Copyright bit on front page */
|
99
99
|
color: #909090;
|
@@ -120,6 +120,8 @@ div.main {
|
|
120
120
|
margin: 50px 12% 50px 8%;
|
121
121
|
}
|
122
122
|
|
123
|
+
/* * layout imgs *** */
|
124
|
+
|
123
125
|
img.smallrpotlogo {
|
124
126
|
width: 210px;
|
125
127
|
height: 47px;
|
@@ -140,6 +142,8 @@ img.smalllogo {
|
|
140
142
|
height: 68px;
|
141
143
|
}
|
142
144
|
|
145
|
+
/* * page styles *** */
|
146
|
+
|
143
147
|
h3 {
|
144
148
|
border-bottom: thin #959595 solid;
|
145
149
|
}
|
@@ -148,7 +152,24 @@ h4 {
|
|
148
152
|
border-bottom: thin #b8c8c8 solid;
|
149
153
|
}
|
150
154
|
|
151
|
-
|
155
|
+
h6 {
|
156
|
+
border-bottom: thin #c0c0d8 solid;
|
157
|
+
}
|
158
|
+
|
159
|
+
div.note {
|
160
|
+
background: #e8e8fa;
|
161
|
+
border: thin dashed #3e5972;
|
162
|
+
position: relative;
|
163
|
+
width: 90%;
|
164
|
+
left: 5%;
|
165
|
+
right: 5%;
|
166
|
+
text-align: right;
|
167
|
+
font-size: 10pt;
|
168
|
+
padding: 5px;
|
169
|
+
margin-bottom: 5px;
|
170
|
+
}
|
171
|
+
|
172
|
+
/* * syntax ******** */
|
152
173
|
pre.ruby {
|
153
174
|
background: #f5f5f5;
|
154
175
|
border: thin dashed #3e5972;
|
@@ -156,6 +177,10 @@ pre.ruby {
|
|
156
177
|
margin-left: 2em;
|
157
178
|
}
|
158
179
|
|
180
|
+
pre.ruby span.normal {
|
181
|
+
color: #000000;
|
182
|
+
}
|
183
|
+
|
159
184
|
pre.ruby span.comment {
|
160
185
|
color: #789a86;
|
161
186
|
text-decoration: oblique;
|
@@ -188,6 +213,15 @@ pre.ruby span.string {
|
|
188
213
|
color: #2020f0;
|
189
214
|
}
|
190
215
|
|
216
|
+
pre.ruby span.char {
|
217
|
+
color: #2020f0;
|
218
|
+
font-weight: bold;
|
219
|
+
}
|
220
|
+
|
221
|
+
pre.ruby span.number {
|
222
|
+
color: #aa1010;
|
223
|
+
}
|
224
|
+
|
191
225
|
pre.ruby span.regex {
|
192
226
|
color: #552090;
|
193
227
|
}
|
@@ -210,3 +244,11 @@ pre.ruby span.method {
|
|
210
244
|
color: #aa1010;
|
211
245
|
}
|
212
246
|
|
247
|
+
pre.ruby span.attribute {
|
248
|
+
color: #3e5972;
|
249
|
+
}
|
250
|
+
|
251
|
+
pre.ruby span.escape {
|
252
|
+
color: #2020f0;
|
253
|
+
font-weight: bold;
|
254
|
+
}
|
data/lib/rote.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# rote.rb - main Rote module
|
2
2
|
# Copyright (c) 2005 Ross Bamford (and contributors)
|
3
|
-
# $Id: rote.rb
|
3
|
+
# $Id: rote.rb 145 2005-12-14 19:19:58 +0000 (Wed, 14 Dec 2005) 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.2'
|
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:24 +0000 (Mon, 12 Dec 2005) roscopeco $
|
6
6
|
require 'getoptlong'
|
7
7
|
|
8
8
|
module Rote
|
data/lib/rote/cache.rb
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# Dependency caching / memoize to disk for Rake / Rote
|
2
|
+
# Contributed by Jonathan Paisley (very slightly modified)
|
3
|
+
#--
|
4
|
+
# (c)2005, 2006 Ross Bamford (and contributors)
|
5
|
+
#
|
6
|
+
# See 'rote.rb' or LICENSE for licence information.
|
7
|
+
# $Id: cache.rb 150 2006-01-02 00:39:41 +0000 (Mon, 02 Jan 2006) roscopeco $
|
8
|
+
#++
|
9
|
+
# This file adds dynamic dependency tracking and caching for
|
10
|
+
# incremental builds, by adding methods to the Rake module
|
11
|
+
# and Task class. The primary intention is to allow pages
|
12
|
+
# to register layout files, and other dynamic dependencies
|
13
|
+
# to allow them to be checked on the next incremental build.
|
14
|
+
# To use, simply require this in your Rakefile, and call
|
15
|
+
# Rake.register_dependency from your page (e.g. when applying
|
16
|
+
# layout).
|
17
|
+
#
|
18
|
+
# Eventually this registration may become implicit with layout.
|
19
|
+
|
20
|
+
require 'md5'
|
21
|
+
require 'yaml'
|
22
|
+
require 'pathname'
|
23
|
+
require 'rake'
|
24
|
+
|
25
|
+
module Rake
|
26
|
+
class << self
|
27
|
+
# Directory for storing Rake dependency cache
|
28
|
+
def cache_dir=(val); @cache_dir = val; end
|
29
|
+
def cache_dir; @cache_dir ||= ".rake_cache"; end
|
30
|
+
def dependencies_file; File.join(cache_dir,"dependencies.yaml"); end
|
31
|
+
# Hash of current cached dependencies
|
32
|
+
def cached_dependencies; @cached_dependencies ||= {}; end
|
33
|
+
# Array representing current tasks being executed
|
34
|
+
def task_stack; @tasks ||= []; end
|
35
|
+
# Reference to current task being executed
|
36
|
+
def current_task; task_stack.last; end
|
37
|
+
|
38
|
+
# Use this method to dynamically register one or more files
|
39
|
+
# as dependencies of the currently executing task.
|
40
|
+
def register_dependency(deps, t = nil)
|
41
|
+
t = (current_task.name if current_task) unless t
|
42
|
+
if t then
|
43
|
+
file t => deps
|
44
|
+
(cached_dependencies[t] ||= []) << deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Task
|
50
|
+
alias :pre_autodep_invoke :invoke
|
51
|
+
|
52
|
+
# Invoke the task, loading cached dependencies if not already
|
53
|
+
# loaded, and handling the task stack. The argument controls
|
54
|
+
# whether or not cached dependencies are loaded and should not
|
55
|
+
# be set false except in testing.
|
56
|
+
def invoke(do_cache = true)
|
57
|
+
# Invoke patched to record task stack and
|
58
|
+
# load cached dependencies on first go.
|
59
|
+
Rake.load_cached_dependencies if do_cache && !$CACHEDEPS_LOADED
|
60
|
+
|
61
|
+
begin
|
62
|
+
Rake.task_stack << self
|
63
|
+
|
64
|
+
# TODO what's going on here?
|
65
|
+
# Rake.cached_dependencies[name] = [] if Rake.cached_dependencies[name]
|
66
|
+
|
67
|
+
pre_autodep_invoke
|
68
|
+
ensure
|
69
|
+
Rake.task_stack.pop
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Memoize the result of the block with respect to the
|
74
|
+
# file-based dependencies. Specify a description and
|
75
|
+
# dependencies like a Task:
|
76
|
+
#
|
77
|
+
# Rake::Task.memoize :task_name => [fn1,fn2] { ... }
|
78
|
+
#
|
79
|
+
# If the cached result is up-to-date with respect to the
|
80
|
+
# dependencies then the block will not be executed. Instead,
|
81
|
+
# the result will be unmarshalled from disk.
|
82
|
+
def self.memoize(args, &block)
|
83
|
+
task_name, deps = resolve_args(args)
|
84
|
+
fn = File.join(Rake.cache_dir, MD5.new(deps.inspect).to_s + "." + task_name)
|
85
|
+
Rake.register_dependency(deps)
|
86
|
+
|
87
|
+
result = nil
|
88
|
+
# This file task isn't ever used other than manually below with t.invoke
|
89
|
+
t = file fn => deps do
|
90
|
+
result = block.call
|
91
|
+
mkdir_p Rake.cache_dir unless File.exists?(Rake.cache_dir)
|
92
|
+
File.open(fn,"w") { |fp| Marshal.dump(result,fp) }
|
93
|
+
end
|
94
|
+
if t.needed? then
|
95
|
+
t.invoke
|
96
|
+
result
|
97
|
+
else
|
98
|
+
Marshal.load(File.read(fn))
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
protected
|
104
|
+
|
105
|
+
# Load cached dependencies, unless they're already
|
106
|
+
# loaded. This method is called during task invocation,
|
107
|
+
# with the effect that cached deps are loaded from yaml
|
108
|
+
# on the first invoke.
|
109
|
+
#
|
110
|
+
# An at_exit handler is installed to save the dependencies
|
111
|
+
# when rake exits.
|
112
|
+
def self.load_cached_dependencies
|
113
|
+
at_exit { self.save_cached_dependencies }
|
114
|
+
|
115
|
+
return unless File.exists?(dependencies_file)
|
116
|
+
YAML.load(File.read(dependencies_file)).each do |task,deps|
|
117
|
+
deps.each do |dep|
|
118
|
+
register_dependency(dep, task)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
$CACHEDEPS_LOADED = true
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.save_cached_dependencies
|
126
|
+
return if cached_dependencies.empty?
|
127
|
+
mkdir_p cache_dir unless File.exists?(cache_dir)
|
128
|
+
deps = {}
|
129
|
+
cached_dependencies.each do |k,v|
|
130
|
+
deps[k] = v.flatten.uniq
|
131
|
+
end
|
132
|
+
File.open(dependencies_file,"w") { |fp| fp.write YAML.dump(deps) }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
task :clean => :clean_cached_dependencies
|
137
|
+
task :clean_cached_dependencies do
|
138
|
+
|
139
|
+
# careful now...
|
140
|
+
rm_rf Rake.cache_dir unless Rake.cache_dir == '.'
|
141
|
+
|
142
|
+
Rake.cached_dependencies.clear
|
143
|
+
end
|
144
|
+
|
data/lib/rote/filters.rb
CHANGED
@@ -1,10 +1,26 @@
|
|
1
1
|
#--
|
2
2
|
# Require all filters
|
3
|
-
# (c)2005 Ross Bamford (and contributors)
|
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 128 2005-12-12 02:45:24 +0000 (Mon, 12 Dec 2005) roscopeco $
|
7
7
|
#++
|
8
8
|
|
9
|
-
#
|
10
|
-
|
9
|
+
# Everyone requires this, we need to get it loaded first.
|
10
|
+
require 'rote/filters/base'
|
11
|
+
|
12
|
+
# This now requires conservatively, ignoring any filters that
|
13
|
+
# throw a LoadError. This allows a simple 'require rote/filters' to
|
14
|
+
# be used to load all filters _for which dependencies are
|
15
|
+
# available_.
|
16
|
+
Dir[File.join(File.dirname(__FILE__), 'filters/*.rb')].each do |fn|
|
17
|
+
begin
|
18
|
+
require fn unless fn =~ /[\\\/]base.rb$/
|
19
|
+
rescue LoadError
|
20
|
+
|
21
|
+
# ignore, different filters require different library
|
22
|
+
# support.
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
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:21 +0000 (Wed, 14 Dec 2005) roscopeco $
|
7
7
|
#++
|
8
8
|
module Rote
|
9
9
|
module Filters
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# Rote filter for BlueCloth
|
3
|
+
# (c)2006 Ross Bamford (and contributors)
|
4
|
+
#
|
5
|
+
# See 'rote.rb' or LICENSE for licence information.
|
6
|
+
# $Id: bluecloth.rb 155 2006-01-05 00:50:32 +0000 (Thu, 05 Jan 2006) roscopeco $
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'bluecloth'
|
10
|
+
require 'rote/filters/base'
|
11
|
+
|
12
|
+
module Rote
|
13
|
+
module Filters
|
14
|
+
#####
|
15
|
+
## Page filter that converts markdown formatting to HTML using
|
16
|
+
## BlueCloth.
|
17
|
+
class BlueCloth < TextFilter
|
18
|
+
|
19
|
+
# Create a new filter instance. The supplied restrictions (if any)
|
20
|
+
# are passed directly to BlueCloth. See BlueCloth docs for
|
21
|
+
# details of supported restrictions.
|
22
|
+
#
|
23
|
+
# If a block is supplied, it will be passed the BlueCloth string
|
24
|
+
# at render time, along with the page being rendered. It is
|
25
|
+
# expected to return the rendered content.
|
26
|
+
# If no block is supplied, to_html is called implicitly.
|
27
|
+
def initialize(*restrictions, &blk)
|
28
|
+
super()
|
29
|
+
@restrictions = restrictions
|
30
|
+
@blk = blk || lambda { |bc, page| bc.to_html }
|
31
|
+
end
|
32
|
+
|
33
|
+
def handler(text,page)
|
34
|
+
bc = ::BlueCloth.new(text)
|
35
|
+
@blk.call(bc, page)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#--
|
2
|
+
# Rote filter that runs macro body as code.
|
3
|
+
# (c)2005, 2006 Ross Bamford (and contributors)
|
4
|
+
#
|
5
|
+
# See 'rote.rb' or LICENSE for licence information.
|
6
|
+
# $Id: syntax.rb 135 2005-12-12 15:01:07 +0000 (Mon, 12 Dec 2005) roscopeco $
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'stringio'
|
10
|
+
require 'rote/filters/base'
|
11
|
+
|
12
|
+
module Rote
|
13
|
+
module Filters
|
14
|
+
|
15
|
+
#####
|
16
|
+
## Page filter that evaluates Ruby code in it's body in the
|
17
|
+
## current interpreter. The code is directly evaluated, and
|
18
|
+
## anything it writes to standard out becomes the macro
|
19
|
+
## replacement.
|
20
|
+
##
|
21
|
+
## Obviously you can place Ruby code directly in your pages,
|
22
|
+
## using ERB, and for many cases that is the route you should
|
23
|
+
## take. There is a (somewhat) subtle difference between the
|
24
|
+
## to alternatives however: ERB is always evaluated right
|
25
|
+
## at the start of rendering, before any Text Filters are
|
26
|
+
## run, whereas #:eval# code is executed during the page filter
|
27
|
+
## stage, which happens after ERB and text filtering, but
|
28
|
+
## before layout is applied.
|
29
|
+
##
|
30
|
+
class Eval < MacroFilter
|
31
|
+
def initialize(macro_re = MACRO_RE)
|
32
|
+
super([],macro_re)
|
33
|
+
end
|
34
|
+
|
35
|
+
def macro_eval(cmd,body,raw)
|
36
|
+
# no need to fiddle with $SAFE here is there?
|
37
|
+
|
38
|
+
# FIXME this is a hack.
|
39
|
+
|
40
|
+
# Utility is still limited I guess, since current Page isn't
|
41
|
+
# readily available to the macro code. We can probably fix
|
42
|
+
# that though.
|
43
|
+
|
44
|
+
# If thread safety becomes an issue, this'll probably need
|
45
|
+
# to be critical sectioned.
|
46
|
+
|
47
|
+
begin
|
48
|
+
oldsio, $stdout = $stdout, StringIO.new
|
49
|
+
eval body
|
50
|
+
$stdout.rewind
|
51
|
+
$stdout.read
|
52
|
+
ensure
|
53
|
+
$stdout = oldsio
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#--
|
2
|
+
# Rote filter that passes body to an external command
|
3
|
+
# (c)2005, 2006 Ross Bamford (and contributors)
|
4
|
+
#
|
5
|
+
# See 'rote.rb' or LICENSE for licence information.
|
6
|
+
# $Id: syntax.rb 135 2005-12-12 15:01:07 +0000 (Mon, 12 Dec 2005) roscopeco $
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'rote/filters/base'
|
10
|
+
|
11
|
+
module Rote
|
12
|
+
module Filters
|
13
|
+
|
14
|
+
#####
|
15
|
+
## Page filter that runs it's body through the specified
|
16
|
+
## command, and captures the output. E.g.:
|
17
|
+
##
|
18
|
+
## #:exec#python#
|
19
|
+
## print "Hello, World!"
|
20
|
+
## #:exec#
|
21
|
+
##
|
22
|
+
## Although this filter can be used to execute Ruby code,
|
23
|
+
## you must bear in mind that this will happen in a separate
|
24
|
+
## interpreter process, so no variables or requires from the
|
25
|
+
## current environment will be available.
|
26
|
+
## If you wish to evaluate Ruby code in your pages, you should
|
27
|
+
## use either ERB (evaluated at the beginning of the render),
|
28
|
+
## or the Eval filter (evaluated near the end).
|
29
|
+
class Exec < MacroFilter
|
30
|
+
def initialize(macro_re = MACRO_RE)
|
31
|
+
super([],macro_re)
|
32
|
+
end
|
33
|
+
|
34
|
+
def macro_exec(cmd,body,raw)
|
35
|
+
res = IO.popen(cmd, 'w+') do |io|
|
36
|
+
Thread.new { io.write body; io.close_write }
|
37
|
+
io.read
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|