TwP-webby 0.9.4 → 0.9.4.1
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/History.txt +21 -3
- data/Rakefile +11 -5
- data/examples/blog/content/css/blueprint/ie.css +26 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/readme.txt +32 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/screen.css +97 -0
- data/examples/blog/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/examples/blog/content/css/blueprint/plugins/fancy-type/screen.css +71 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/screen.css +40 -0
- data/examples/blog/content/css/blueprint/plugins/rtl/readme.txt +10 -0
- data/examples/blog/content/css/blueprint/plugins/rtl/screen.css +109 -0
- data/examples/blog/content/css/blueprint/print.css +30 -0
- data/examples/blog/content/css/blueprint/screen.css +251 -0
- data/examples/blog/content/css/blueprint/src/forms.css +49 -0
- data/examples/blog/content/css/blueprint/src/grid.css +212 -0
- data/examples/blog/content/css/blueprint/src/grid.png +0 -0
- data/examples/blog/content/css/blueprint/src/ie.css +59 -0
- data/examples/blog/content/css/blueprint/src/print.css +85 -0
- data/examples/blog/content/css/blueprint/src/reset.css +38 -0
- data/examples/blog/content/css/blueprint/src/typography.css +105 -0
- data/examples/blog/content/css/coderay.css +111 -0
- data/examples/blog/content/css/site.css +67 -0
- data/examples/blog/layouts/default.txt +61 -0
- data/examples/blog/tasks/blog.rake +1 -2
- data/examples/presentation/Sitefile +2 -2
- data/examples/tumblog/tasks/tumblog.rake +1 -2
- data/examples/webby/Sitefile +2 -2
- data/examples/webby/content/release-notes/rel-0-9-4/index.txt +33 -0
- data/examples/webby/content/sitemap.txt +2 -2
- data/examples/webby/content/user-manual/index.txt +3 -3
- data/lib/webby.rb +24 -101
- data/lib/webby/apps/generator.rb +2 -2
- data/lib/webby/apps/main.rb +32 -61
- data/lib/webby/config.rb +178 -0
- data/lib/webby/filters.rb +2 -0
- data/lib/webby/filters/haml.rb +13 -0
- data/lib/webby/filters/sass.rb +14 -0
- data/lib/webby/filters/slides.rb +2 -2
- data/lib/webby/filters/tidy.rb +5 -0
- data/lib/webby/helpers/coderay_helper.rb +27 -3
- data/lib/webby/helpers/graphviz_helper.rb +20 -3
- data/lib/webby/helpers/tex_img_helper.rb +25 -5
- data/lib/webby/helpers/ultraviolet_helper.rb +19 -5
- data/lib/webby/renderer.rb +9 -6
- data/lib/webby/resources.rb +2 -1
- data/lib/webby/resources/page.rb +4 -1
- data/lib/webby/tasks/create.rake +1 -4
- data/spec/data/site/tasks/tumblog.rake +5 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/webby/apps/generator_spec.rb +36 -3
- data/spec/webby/apps/main_spec.rb +2 -1
- data/spec/webby/filters/basepath_spec.rb +2 -2
- data/spec/webby/helpers/capture_helper_spec.rb +1 -1
- data/spec/webby/resources/db_spec.rb +24 -24
- data/spec/webby/resources/layout_spec.rb +1 -1
- data/spec/webby/resources/page_spec.rb +8 -2
- data/spec/webby/resources/resource_spec.rb +1 -1
- data/spec/webby/resources_spec.rb +1 -1
- metadata +60 -23
- data/Manifest.txt +0 -233
data/lib/webby/config.rb
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# These are the main configuration options for Webby. Options for specific
|
|
2
|
+
# filters and helpers are defined in those files. Even a few of the rake
|
|
3
|
+
# tasks in the "examples" folder have their own configuration options
|
|
4
|
+
# defined.
|
|
5
|
+
#
|
|
6
|
+
# The nice thing about Loquacious configurations is that all these options
|
|
7
|
+
# can be defined where they are used, but the descriptions can be viewed by
|
|
8
|
+
# the user in one handy page.
|
|
9
|
+
|
|
10
|
+
Loquacious.configuration_for(:webby) {
|
|
11
|
+
|
|
12
|
+
desc 'The generated website will be output to this directory.'
|
|
13
|
+
output_dir 'output'
|
|
14
|
+
|
|
15
|
+
desc <<-__
|
|
16
|
+
The directory containg the main site content - pages, partials, css
|
|
17
|
+
stylesheets, etc.
|
|
18
|
+
__
|
|
19
|
+
content_dir 'content'
|
|
20
|
+
|
|
21
|
+
desc 'The directory containing the layout files.'
|
|
22
|
+
layout_dir 'layouts'
|
|
23
|
+
|
|
24
|
+
desc <<-__
|
|
25
|
+
The directory where page templtes can be found. These templates are used
|
|
26
|
+
by the 'webby create' command to define the boiler-plate for new pages
|
|
27
|
+
(things like the meta-data or standard text).
|
|
28
|
+
__
|
|
29
|
+
template_dir 'templates'
|
|
30
|
+
|
|
31
|
+
desc <<-__
|
|
32
|
+
This is an array of regular expression patterns that will exclude files
|
|
33
|
+
from webby processing. The patterns will be joined using the regular
|
|
34
|
+
expression OR operator '|'.
|
|
35
|
+
__
|
|
36
|
+
exclude %w{tmp$ bak$ ~$ CVS \.svn}
|
|
37
|
+
|
|
38
|
+
desc <<-__
|
|
39
|
+
A set of default meta-data values that are added to every page rendered
|
|
40
|
+
by webby. Specific values in the page override the default values
|
|
41
|
+
defined here. For example, you could define a default set of filters
|
|
42
|
+
|
|
|
43
|
+
| SITE.page_defaults = {
|
|
44
|
+
| 'layout' => 'default',
|
|
45
|
+
| 'filter' => ['erb', 'textile']
|
|
46
|
+
| }
|
|
47
|
+
|
|
|
48
|
+
Now, every page will be run through the ERB filter and then the
|
|
49
|
+
Textile filter. Specific pages can override the set of filters or omit
|
|
50
|
+
them altogether as needed.
|
|
51
|
+
__
|
|
52
|
+
page_defaults({
|
|
53
|
+
'layout' => 'default'
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
desc <<-__
|
|
57
|
+
Defines the default page attribute that will be used by the
|
|
58
|
+
'link_to_page' method to find other pages in the site. If this value
|
|
59
|
+
is set to :title, then the title found in the page meta-data is
|
|
60
|
+
searched for a match. If this value is set to :filename, then the
|
|
61
|
+
filenames of pages are search for a match.
|
|
62
|
+
|
|
63
|
+
This value can be overridden on a case by case basis when the
|
|
64
|
+
'link_to_page' method is called.
|
|
65
|
+
__
|
|
66
|
+
find_by :title
|
|
67
|
+
|
|
68
|
+
desc <<-__
|
|
69
|
+
Using the 'webby create' task, new pages can either be created as a
|
|
70
|
+
normal page or as an index page in it's own directory. The latter
|
|
71
|
+
option allows your pages to have "nice" URLs:
|
|
72
|
+
|
|
|
73
|
+
| foo/bar/my-new-post.html <-- 'page'
|
|
74
|
+
| foo/bar/my-new-post/ <-- 'directory'
|
|
75
|
+
|
|
|
76
|
+
The two options supported by the 'create_mode' are either 'page'
|
|
77
|
+
or 'directory'.
|
|
78
|
+
__
|
|
79
|
+
create_mode 'page'
|
|
80
|
+
|
|
81
|
+
desc <<-__
|
|
82
|
+
When the 'webby create' task is used to create a new page in your site,
|
|
83
|
+
webby will automatically open your favorite editor. Use this option to
|
|
84
|
+
define which editor webby will start. Set this option to nil if you do
|
|
85
|
+
not want webby to launch an editor when you create new pages.
|
|
86
|
+
|
|
87
|
+
The default is taken from the environment as either 'WEBBY_EDITOR' or
|
|
88
|
+
'EDITOR', whichever is defined.
|
|
89
|
+
__
|
|
90
|
+
editor ENV['WEBBY_EDITOR'] || ENV['EDITOR']
|
|
91
|
+
|
|
92
|
+
desc <<-__
|
|
93
|
+
This flag determines whether or not the internal web server is launched
|
|
94
|
+
when the autobuild loop is running. The default is to launch the web
|
|
95
|
+
server. Set to false to disable.
|
|
96
|
+
__
|
|
97
|
+
use_web_server true
|
|
98
|
+
|
|
99
|
+
desc <<-__
|
|
100
|
+
Defines the port number the internal web server will use when the
|
|
101
|
+
autobuild loop is running.
|
|
102
|
+
__
|
|
103
|
+
web_port 4331
|
|
104
|
+
|
|
105
|
+
desc <<-__
|
|
106
|
+
The username that will be used when publishing a site to the remote host.
|
|
107
|
+
Login to the remote host will take the form 'user@host' where both 'user'
|
|
108
|
+
and 'host' are configuration options.
|
|
109
|
+
|
|
110
|
+
The default is taken from the environment as either 'USER' or
|
|
111
|
+
'USERNAME', whichever is defined.
|
|
112
|
+
__
|
|
113
|
+
user ENV['USER'] || ENV['USERNAME']
|
|
114
|
+
|
|
115
|
+
desc <<-__
|
|
116
|
+
The hostname that will be used when publishing a site to the remote host.
|
|
117
|
+
Login to the remote host will take the form 'user@host' where both 'user'
|
|
118
|
+
and 'host' are configuration options.
|
|
119
|
+
__
|
|
120
|
+
host 'example.com'
|
|
121
|
+
|
|
122
|
+
desc <<-__
|
|
123
|
+
The destination directory on the remote host where the site will
|
|
124
|
+
be published.
|
|
125
|
+
__
|
|
126
|
+
remote_dir '/dev/null'
|
|
127
|
+
|
|
128
|
+
desc <<-__
|
|
129
|
+
Arguments that will be passed to the rysnc command when deploying the
|
|
130
|
+
site to the remote host. This array of arguments will be joined together
|
|
131
|
+
by spaces.
|
|
132
|
+
__
|
|
133
|
+
rsync_args %w(-av)
|
|
134
|
+
|
|
135
|
+
desc <<-__
|
|
136
|
+
The list of URIs that will automatically pass validation when the webby
|
|
137
|
+
validate task is run.
|
|
138
|
+
__
|
|
139
|
+
valid_uris []
|
|
140
|
+
|
|
141
|
+
desc <<-__
|
|
142
|
+
The base URL of the site. This value is used by the 'basepath' filter to
|
|
143
|
+
replace leading slashes in URIs with this base value. The URIs to replace
|
|
144
|
+
are identified by the 'xpaths' option.
|
|
145
|
+
__
|
|
146
|
+
base nil
|
|
147
|
+
|
|
148
|
+
desc <<-__
|
|
149
|
+
The basepath filter is used to replace leading slashes in URIs with the
|
|
150
|
+
text from the 'base' option. Only those URIs identified by the XPaths
|
|
151
|
+
defined here will be altered. You can add to or remove XPaths from this
|
|
152
|
+
list depending on your needs.
|
|
153
|
+
__
|
|
154
|
+
xpaths %w{
|
|
155
|
+
/html/head//base[@href]
|
|
156
|
+
/html/head//link[@href]
|
|
157
|
+
//script[@src]
|
|
158
|
+
/html/body[@background]
|
|
159
|
+
/html/body//a[@href]
|
|
160
|
+
/html/body//object[@data]
|
|
161
|
+
/html/body//img[@src]
|
|
162
|
+
/html/body//area[@href]
|
|
163
|
+
/html/body//form[@action]
|
|
164
|
+
/html/body//input[@src]
|
|
165
|
+
}
|
|
166
|
+
# other possible XPaths to include for base path substitution
|
|
167
|
+
# /html/body//object[@usemap]
|
|
168
|
+
# /html/body//img[@usemap]
|
|
169
|
+
# /html/body//input[@usemap]
|
|
170
|
+
|
|
171
|
+
desc "The default directory where new blog posts will be created."
|
|
172
|
+
blog_dir 'blog'
|
|
173
|
+
|
|
174
|
+
desc "The default directory where new tumblog posts will be created."
|
|
175
|
+
tumblog_dir 'blog'
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
# EOF
|
data/lib/webby/filters.rb
CHANGED
data/lib/webby/filters/haml.rb
CHANGED
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
# Render text via the Haml library
|
|
3
3
|
if try_require('haml', 'haml')
|
|
4
4
|
|
|
5
|
+
Loquacious.configuration_for(:webby) {
|
|
6
|
+
desc <<-__
|
|
7
|
+
A hash of options that will be passed to the Haml::Engine when procesing
|
|
8
|
+
content through the 'haml' filter. See the Haml rdoc documentation for
|
|
9
|
+
the list of available options.
|
|
10
|
+
|
|
11
|
+
Note: webby will set the :filename to the current page being rendered.
|
|
12
|
+
__
|
|
13
|
+
haml_options Hash.new
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
Webby::Filters.register :haml do |input, cursor|
|
|
6
17
|
opts = ::Webby.site.haml_options.merge(cursor.page.haml_options || {})
|
|
18
|
+
opts = opts.symbolize_keys
|
|
19
|
+
opts.merge!(:filename => cursor.page.destination)
|
|
7
20
|
b = cursor.renderer.get_binding
|
|
8
21
|
Haml::Engine.new(input, opts).to_html(b)
|
|
9
22
|
end
|
data/lib/webby/filters/sass.rb
CHANGED
|
@@ -2,8 +2,22 @@
|
|
|
2
2
|
# Render text via the Sass library (part of Haml)
|
|
3
3
|
if try_require('sass', 'haml')
|
|
4
4
|
|
|
5
|
+
Loquacious.configuration_for(:webby) {
|
|
6
|
+
desc <<-__
|
|
7
|
+
A hash of options that will be passed to the Sass::Engine when procesing
|
|
8
|
+
content through the 'sass' filter. See the Sass rdoc documentation for
|
|
9
|
+
the list of available options (par of the haml gem).
|
|
10
|
+
|
|
11
|
+
Note: webby will set the :filename to the current page being rendered.
|
|
12
|
+
__
|
|
13
|
+
sass_options Hash.new
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
Webby::Filters.register :sass do |input, cursor|
|
|
6
17
|
opts = ::Webby.site.sass_options.merge(cursor.page.sass_options || {})
|
|
18
|
+
opts = opts.symbolize_keys
|
|
19
|
+
opts.merge!(:filename => cursor.page.destination)
|
|
20
|
+
opts[:style] = opts[:style].to_sym if opts.include? :style
|
|
7
21
|
Sass::Engine.new(input, opts).render
|
|
8
22
|
end
|
|
9
23
|
|
data/lib/webby/filters/slides.rb
CHANGED
|
@@ -35,9 +35,9 @@ class Slides
|
|
|
35
35
|
def filter
|
|
36
36
|
result = []
|
|
37
37
|
|
|
38
|
-
@str.split(%r/\<h1
|
|
38
|
+
@str.split(%r/\<h1/i).each do |slide|
|
|
39
39
|
next if slide.strip.empty?
|
|
40
|
-
result << START_SLIDE << '<h1
|
|
40
|
+
result << START_SLIDE << '<h1' << slide << END_SLIDE
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
result.join
|
data/lib/webby/filters/tidy.rb
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
if try_require 'coderay'
|
|
2
2
|
require 'enumerator'
|
|
3
3
|
|
|
4
|
+
Loquacious.configuration_for(:webby) {
|
|
5
|
+
desc <<-__
|
|
6
|
+
Options for CodeRay syntax highlighting. See the CodeRay home page
|
|
7
|
+
(http://coderay.rubychan.de/) for more information about the available
|
|
8
|
+
options.
|
|
9
|
+
__
|
|
10
|
+
coderay {
|
|
11
|
+
desc 'The language being highlighted (given as a symbol).'
|
|
12
|
+
lang :ruby
|
|
13
|
+
|
|
14
|
+
desc 'Include line numbers in :table, :inline, :list or nil (no line numbers).'
|
|
15
|
+
line_numbers nil
|
|
16
|
+
|
|
17
|
+
desc 'Where to start line number counting.'
|
|
18
|
+
line_number_start 1
|
|
19
|
+
|
|
20
|
+
desc 'Make every N-th number appear bold.'
|
|
21
|
+
bold_every 10
|
|
22
|
+
|
|
23
|
+
desc 'Tabs will be converted into this number of space characters.'
|
|
24
|
+
tab_width 8
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
module Webby::Helpers
|
|
5
29
|
module CodeRayHelper
|
|
6
30
|
|
|
@@ -35,7 +59,7 @@ module CodeRayHelper
|
|
|
35
59
|
return if text.empty?
|
|
36
60
|
|
|
37
61
|
defaults = ::Webby.site.coderay
|
|
38
|
-
lang = opts.getopt(:lang, defaults
|
|
62
|
+
lang = opts.getopt(:lang, defaults.lang).to_sym
|
|
39
63
|
|
|
40
64
|
cr_opts = {}
|
|
41
65
|
%w(line_numbers to_sym
|
|
@@ -49,9 +73,9 @@ module CodeRayHelper
|
|
|
49
73
|
end
|
|
50
74
|
|
|
51
75
|
#cr.swap(CodeRay.scan(text, lang).html(opts).div)
|
|
52
|
-
out =
|
|
76
|
+
out = %Q{<div class="CodeRay">\n<pre>}
|
|
53
77
|
out << ::CodeRay.scan(text, lang).html(cr_opts)
|
|
54
|
-
out <<
|
|
78
|
+
out << %Q{</pre>\n</div>}
|
|
55
79
|
|
|
56
80
|
# put some guards around the output (specifically for textile)
|
|
57
81
|
out = _guard(out)
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
2
|
require 'tempfile'
|
|
3
3
|
|
|
4
|
+
Loquacious.configuration_for(:webby) {
|
|
5
|
+
desc 'Options for graphviz processing.'
|
|
6
|
+
graphviz {
|
|
7
|
+
desc 'The path in the output folder where images are stored.'
|
|
8
|
+
path nil
|
|
9
|
+
|
|
10
|
+
desc <<-__
|
|
11
|
+
The graphviz command used to render the images.
|
|
12
|
+
(dot, neato, twopi, circo, fdp)
|
|
13
|
+
__
|
|
14
|
+
cmd 'dot'
|
|
15
|
+
|
|
16
|
+
desc 'The type of output image to generate (png, jpg, gif).'
|
|
17
|
+
type 'png'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
module Webby::Helpers
|
|
5
22
|
module GraphvizHelper
|
|
6
23
|
|
|
@@ -71,9 +88,9 @@ module GraphvizHelper
|
|
|
71
88
|
err.close
|
|
72
89
|
|
|
73
90
|
defaults = ::Webby.site.graphviz
|
|
74
|
-
path = opts.getopt(:path, defaults
|
|
75
|
-
cmd = opts.getopt(:cmd, defaults
|
|
76
|
-
type = opts.getopt(:type, defaults
|
|
91
|
+
path = opts.getopt(:path, defaults.path)
|
|
92
|
+
cmd = opts.getopt(:cmd, defaults.cmd)
|
|
93
|
+
type = opts.getopt(:type, defaults.type)
|
|
77
94
|
|
|
78
95
|
# pull the name of the graph|digraph out of the DOT script
|
|
79
96
|
name = text.match(%r/\A\s*(?:strict\s+)?(?:di)?graph\s+([A-Za-z_][A-Za-z0-9_]*)\s+\{/o)[1]
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
require Webby.libpath(*%w[webby stelan mktemp])
|
|
2
2
|
require 'fileutils'
|
|
3
3
|
|
|
4
|
+
Loquacious.configuration_for(:webby) {
|
|
5
|
+
desc "Options for processing TeX math formula into images."
|
|
6
|
+
tex2img {
|
|
7
|
+
desc 'Where generated images will be stored.'
|
|
8
|
+
path nil
|
|
9
|
+
|
|
10
|
+
desc 'The type of image to generate (png, jpeg, gif).'
|
|
11
|
+
type 'png'
|
|
12
|
+
|
|
13
|
+
desc 'The background color of the image (color name, TeX color spec, or #aabbcc)'
|
|
14
|
+
bg 'white'
|
|
15
|
+
|
|
16
|
+
desc 'The foreground color of the image (color name, TeX color spec, or #aabbcc)'
|
|
17
|
+
fg 'black'
|
|
18
|
+
|
|
19
|
+
desc 'The desired resolution in dpi (HxV)'
|
|
20
|
+
resolution '150x150'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
4
24
|
module Webby::Helpers
|
|
5
25
|
module TexImgHelper
|
|
6
26
|
|
|
@@ -45,11 +65,11 @@ module TexImgHelper
|
|
|
45
65
|
return if text.empty?
|
|
46
66
|
|
|
47
67
|
defaults = ::Webby.site.tex2img
|
|
48
|
-
path = opts.getopt(:path, defaults
|
|
49
|
-
type = opts.getopt(:type, defaults
|
|
50
|
-
bg = opts.getopt(:bg, defaults
|
|
51
|
-
fg = opts.getopt(:fg, defaults
|
|
52
|
-
res = opts.getopt(:resolution, defaults
|
|
68
|
+
path = opts.getopt(:path, defaults.path)
|
|
69
|
+
type = opts.getopt(:type, defaults.type)
|
|
70
|
+
bg = opts.getopt(:bg, defaults.bg)
|
|
71
|
+
fg = opts.getopt(:fg, defaults.fg)
|
|
72
|
+
res = opts.getopt(:resolution, defaults.resolution)
|
|
53
73
|
|
|
54
74
|
# fix color escaping
|
|
55
75
|
fg = fg =~ %r/^[a-zA-Z]+$/ ? fg : "\"#{fg}\""
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
|
|
4
4
|
if try_require 'uv'
|
|
5
5
|
|
|
6
|
+
Loquacious.configuration_for(:webby) {
|
|
7
|
+
desc "Options for UltraViolet syntax highlighting."
|
|
8
|
+
uv {
|
|
9
|
+
desc 'The language to highlight (ruby, c, html, ...).'
|
|
10
|
+
lang 'ruby'
|
|
11
|
+
|
|
12
|
+
desc 'Display line numbers (true, false).'
|
|
13
|
+
line_numbers false
|
|
14
|
+
|
|
15
|
+
desc 'See the UltraViolet documentation for a list of available themes.'
|
|
16
|
+
theme 'mac_classic'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
module Webby::Helpers
|
|
7
21
|
module UltraVioletHelper
|
|
8
22
|
|
|
@@ -39,13 +53,13 @@ module UltraVioletHelper
|
|
|
39
53
|
return if text.empty?
|
|
40
54
|
|
|
41
55
|
defaults = ::Webby.site.uv
|
|
42
|
-
lang = opts.getopt(:lang, defaults
|
|
43
|
-
line_numbers = opts.getopt(:line_numbers, defaults
|
|
44
|
-
theme = opts.getopt(:theme, defaults
|
|
56
|
+
lang = opts.getopt(:lang, defaults.lang)
|
|
57
|
+
line_numbers = opts.getopt(:line_numbers, defaults.line_numbers)
|
|
58
|
+
theme = opts.getopt(:theme, defaults.theme)
|
|
45
59
|
|
|
46
|
-
out =
|
|
60
|
+
out = %Q{<div class="UltraViolet">\n}
|
|
47
61
|
out << Uv.parse(text, "xhtml", lang, line_numbers, theme)
|
|
48
|
-
out <<
|
|
62
|
+
out << %Q{\n</div>}
|
|
49
63
|
|
|
50
64
|
# put some guards around the output (specifically for textile)
|
|
51
65
|
out = _guard(out)
|
data/lib/webby/renderer.rb
CHANGED
|
@@ -36,12 +36,15 @@ class Renderer
|
|
|
36
36
|
renderer = self.new(page)
|
|
37
37
|
|
|
38
38
|
loop {
|
|
39
|
-
|
|
39
|
+
dest = page.destination
|
|
40
|
+
FileUtils.mkdir_p ::File.dirname(dest)
|
|
40
41
|
journal.create_or_update(page)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
text = renderer._layout_page
|
|
44
|
+
unless text.nil?
|
|
45
|
+
::File.open(dest, 'w') {|fd| fd.write(text)}
|
|
44
46
|
end
|
|
47
|
+
|
|
45
48
|
break unless renderer._next_page
|
|
46
49
|
}
|
|
47
50
|
end
|
|
@@ -234,10 +237,10 @@ class Renderer
|
|
|
234
237
|
rescue ::Webby::Error => err
|
|
235
238
|
logger.error "while rendering page '#{@page.path}'"
|
|
236
239
|
logger.error err.message
|
|
237
|
-
|
|
240
|
+
return nil
|
|
241
|
+
rescue Exception => err
|
|
238
242
|
logger.error "while rendering page '#{@page.path}'"
|
|
239
243
|
logger.fatal err
|
|
240
|
-
exit 1
|
|
241
244
|
ensure
|
|
242
245
|
@content = nil
|
|
243
246
|
@@stack.clear
|
|
@@ -336,7 +339,7 @@ class Renderer
|
|
|
336
339
|
# the partial. If a full path is given, then the partial is searched for
|
|
337
340
|
# in that directory.
|
|
338
341
|
#
|
|
339
|
-
#
|
|
342
|
+
# Raises a Webby::Error if the partial could not be found.
|
|
340
343
|
#
|
|
341
344
|
def _find_partial( part )
|
|
342
345
|
case part
|