rabbit 0.6.4 → 0.9.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/COPYING +1 -1
- data/NEWS.en +157 -2
- data/NEWS.ja +153 -1
- data/README.en +8 -1
- data/README.ja +8 -1
- data/Rakefile +4 -1
- data/TODO +17 -0
- data/bin/rabbiter +96 -0
- data/lib/rabbit/element/block-element.rb +0 -2
- data/lib/rabbit/element/block.rb +5 -4
- data/lib/rabbit/element/container-element.rb +2 -1
- data/lib/rabbit/element/description-list.rb +5 -2
- data/lib/rabbit/element/enum-list.rb +4 -0
- data/lib/rabbit/element/image.rb +41 -1
- data/lib/rabbit/element/item-list.rb +3 -0
- data/lib/rabbit/element/method-list.rb +2 -2
- data/lib/rabbit/element/poppler-page.rb +1 -0
- data/lib/rabbit/element/slide-element.rb +1 -0
- data/lib/rabbit/element/slide.rb +1 -1
- data/lib/rabbit/element/table.rb +7 -2
- data/lib/rabbit/element/tag.rb +1 -0
- data/lib/rabbit/element/text-block-element.rb +11 -0
- data/lib/rabbit/element/text-container-element.rb +4 -0
- data/lib/rabbit/element/text.rb +6 -3
- data/lib/rabbit/element/title-slide.rb +10 -10
- data/lib/rabbit/parser/ext/aafigure.rb +31 -0
- data/lib/rabbit/parser/rd.rb +2 -1
- data/lib/rabbit/parser/rd/ext/aafigure.rb +18 -0
- data/lib/rabbit/parser/rd/ext/block-verbatim.rb +27 -1
- data/lib/rabbit/parser/rd/ext/inline-verbatim.rb +16 -22
- data/lib/rabbit/parser/rd/rd2rabbit-lib.rb +8 -2
- data/lib/rabbit/parser/rd/rt/rt2rabbit-lib.rb +7 -1
- data/lib/rabbit/parser/wiki/output.rb +35 -6
- data/lib/rabbit/rabbit.rb +7 -1
- data/lib/rabbit/renderer/display/clutter-embed.rb +2 -0
- data/lib/rabbit/renderer/display/comment-drawing-area.rb +2 -0
- data/lib/rabbit/renderer/print/base.rb +6 -1
- data/lib/rabbit/theme/applier.rb +1 -1
- data/lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb +85 -0
- data/lib/rabbit/theme/body-background-image/body-background-image.rb +8 -0
- data/lib/rabbit/theme/clear-blue/clear-blue.rb +1 -1
- data/lib/rabbit/theme/default/default.rb +12 -4
- data/lib/rabbit/theme/per-slide-background-image/per-slide-background-image.rb +7 -35
- data/lib/rabbit/theme/table/table.rb +13 -11
- data/lib/rabbit/theme/tag/property.rb +4 -0
- data/lib/rabbit/theme/tag/tag.rb +35 -0
- data/lib/rabbit/theme/title-background-image/title-background-image.rb +19 -17
- data/sample/rabbit-en.rd +89 -1
- data/sample/rabbit.rd +91 -2
- data/sample/table.hiki +34 -0
- metadata +106 -32
data/lib/rabbit/element/block.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'rabbit/element/text-
|
2
|
-
require 'rabbit/element/container-element'
|
3
|
-
require 'rabbit/element/block-element'
|
1
|
+
require 'rabbit/element/text-block-element'
|
4
2
|
|
5
3
|
module Rabbit
|
6
4
|
module Element
|
7
5
|
class Container
|
8
6
|
include ContainerElement
|
7
|
+
include BlockElement
|
9
8
|
end
|
10
9
|
|
11
10
|
class BlockQuote
|
12
11
|
include ContainerElement
|
12
|
+
include BlockElement
|
13
13
|
include BlockHorizontalCentering
|
14
14
|
|
15
15
|
attr_reader :cite, :title
|
@@ -27,7 +27,7 @@ module Rabbit
|
|
27
27
|
end
|
28
28
|
|
29
29
|
class Paragraph
|
30
|
-
include
|
30
|
+
include TextBlockElement
|
31
31
|
|
32
32
|
def text
|
33
33
|
"#{super}\n"
|
@@ -44,6 +44,7 @@ module Rabbit
|
|
44
44
|
|
45
45
|
class WaitBlock
|
46
46
|
include ContainerElement
|
47
|
+
include BlockElement
|
47
48
|
|
48
49
|
def have_wait_tag?
|
49
50
|
true
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'rabbit/element/container-element'
|
2
|
-
require 'rabbit/element/text-
|
2
|
+
require 'rabbit/element/text-block-element'
|
3
3
|
|
4
4
|
module Rabbit
|
5
5
|
module Element
|
6
6
|
class DescriptionList
|
7
7
|
include ContainerElement
|
8
|
+
include BlockElement
|
8
9
|
|
9
10
|
def to_html(generator)
|
10
11
|
"<dl>\n#{super}\n</dl>"
|
@@ -13,6 +14,7 @@ module Rabbit
|
|
13
14
|
|
14
15
|
class DescriptionListItem
|
15
16
|
include ContainerElement
|
17
|
+
include BlockElement
|
16
18
|
|
17
19
|
attr_reader :term, :content
|
18
20
|
|
@@ -26,7 +28,7 @@ module Rabbit
|
|
26
28
|
end
|
27
29
|
|
28
30
|
class DescriptionTerm
|
29
|
-
include
|
31
|
+
include TextBlockElement
|
30
32
|
|
31
33
|
def to_rd
|
32
34
|
": #{text}"
|
@@ -39,6 +41,7 @@ module Rabbit
|
|
39
41
|
|
40
42
|
class DescriptionContent
|
41
43
|
include ContainerElement
|
44
|
+
include BlockElement
|
42
45
|
|
43
46
|
def text
|
44
47
|
super.gsub(/^/, " ")
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'rabbit/element/container-element'
|
2
|
+
require 'rabbit/element/block-element'
|
2
3
|
|
3
4
|
module Rabbit
|
4
5
|
module Element
|
5
6
|
class EnumList
|
6
7
|
include ContainerElement
|
8
|
+
include BlockElement
|
7
9
|
|
8
10
|
def to_html(generator)
|
9
11
|
"<ol>\n#{super}\n</ol>"
|
@@ -12,6 +14,8 @@ module Rabbit
|
|
12
14
|
|
13
15
|
class EnumListItem
|
14
16
|
include ContainerElement
|
17
|
+
include BlockElement
|
18
|
+
|
15
19
|
attr_accessor :order
|
16
20
|
|
17
21
|
def to_rd
|
data/lib/rabbit/element/image.rb
CHANGED
@@ -4,6 +4,7 @@ require 'rabbit/element/block-element'
|
|
4
4
|
module Rabbit
|
5
5
|
module Element
|
6
6
|
class Image
|
7
|
+
include Base
|
7
8
|
include BlockElement
|
8
9
|
include BlockHorizontalCentering
|
9
10
|
|
@@ -16,10 +17,19 @@ module Rabbit
|
|
16
17
|
attr_reader :caption
|
17
18
|
attr_reader :normalized_width, :normalized_height
|
18
19
|
attr_reader :relative_width, :relative_height
|
20
|
+
attr_reader :relative_margin_top, :relative_margin_bottom
|
21
|
+
attr_reader :relative_margin_left, :relative_margin_right
|
22
|
+
attr_reader :relative_padding_top, :relative_padding_bottom
|
23
|
+
attr_reader :relative_padding_left, :relative_padding_right
|
19
24
|
|
20
25
|
def initialize(filename, prop)
|
21
26
|
@filename = filename
|
22
27
|
super(filename, prop)
|
28
|
+
normalized_prop = {}
|
29
|
+
prop.each do |name, value|
|
30
|
+
normalized_prop[name.gsub(/-/, '_')] = value
|
31
|
+
end
|
32
|
+
prop = normalized_prop
|
23
33
|
%w(caption dither_mode).each do |name|
|
24
34
|
instance_variable_set("@#{name}", prop[name])
|
25
35
|
end
|
@@ -35,6 +45,10 @@ module Rabbit
|
|
35
45
|
x_dither y_dither
|
36
46
|
normalized_width normalized_height
|
37
47
|
relative_width relative_height
|
48
|
+
relative_margin_top relative_margin_bottom
|
49
|
+
relative_margin_left relative_margin_right
|
50
|
+
relative_padding_top relative_padding_bottom
|
51
|
+
relative_padding_left relative_padding_right
|
38
52
|
).each do |name|
|
39
53
|
begin
|
40
54
|
instance_variable_set("@#{name}", prop[name] && Integer(prop[name]))
|
@@ -42,6 +56,7 @@ module Rabbit
|
|
42
56
|
raise InvalidImageSizeError.new(filename, name, prop[name])
|
43
57
|
end
|
44
58
|
end
|
59
|
+
|
45
60
|
setup_draw_parameters(prop)
|
46
61
|
resize(@width, @height)
|
47
62
|
end
|
@@ -133,9 +148,34 @@ module Rabbit
|
|
133
148
|
[x, y + height, w, h - height]
|
134
149
|
end
|
135
150
|
|
151
|
+
def adjust_margin(w, h)
|
152
|
+
@margin_top =
|
153
|
+
make_relative_size(@relative_margin_top, h) || @margin_top
|
154
|
+
@margin_bottom =
|
155
|
+
make_relative_size(@relative_margin_bottom, h) || @margin_bottom
|
156
|
+
@margin_left =
|
157
|
+
make_relative_size(@relative_margin_left, w) || @margin_left
|
158
|
+
@margin_right =
|
159
|
+
make_relative_size(@relative_margin_right, w) || @margin_right
|
160
|
+
end
|
161
|
+
|
162
|
+
def adjust_padding(w, h)
|
163
|
+
@padding_top =
|
164
|
+
make_relative_size(@relative_padding_top, h) || @padding_top
|
165
|
+
@padding_bottom =
|
166
|
+
make_relative_size(@relative_padding_bottom, h) || @padding_bottom
|
167
|
+
@padding_left =
|
168
|
+
make_relative_size(@relative_padding_left, w) || @padding_left
|
169
|
+
@padding_right =
|
170
|
+
make_relative_size(@relative_padding_right, w) || @padding_right
|
171
|
+
end
|
172
|
+
|
136
173
|
def adjust_size(canvas, x, y, w, h)
|
137
174
|
base_w = w
|
138
|
-
base_h =
|
175
|
+
base_h = @oh || h
|
176
|
+
adjust_margin(base_w, base_h)
|
177
|
+
adjust_padding(base_w, base_h)
|
178
|
+
base_h = base_h - @padding_top - @padding_bottom
|
139
179
|
if @as_large_as_possible
|
140
180
|
iw = base_w - x
|
141
181
|
ih = base_h - y
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'rabbit/element/container-element'
|
2
|
+
require 'rabbit/element/block-element'
|
2
3
|
|
3
4
|
module Rabbit
|
4
5
|
module Element
|
5
6
|
class ItemList
|
6
7
|
include ContainerElement
|
8
|
+
include BlockElement
|
7
9
|
|
8
10
|
def to_html(generator)
|
9
11
|
"<ul>\n#{super}\n</ul>"
|
@@ -12,6 +14,7 @@ module Rabbit
|
|
12
14
|
|
13
15
|
class ItemListItem
|
14
16
|
include ContainerElement
|
17
|
+
include BlockElement
|
15
18
|
|
16
19
|
def to_rd
|
17
20
|
prefix = "* "
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rabbit/element/container-element'
|
2
|
-
require 'rabbit/element/text-
|
2
|
+
require 'rabbit/element/text-block-element'
|
3
3
|
|
4
4
|
module Rabbit
|
5
5
|
module Element
|
@@ -26,7 +26,7 @@ module Rabbit
|
|
26
26
|
end
|
27
27
|
|
28
28
|
class MethodTerm
|
29
|
-
include
|
29
|
+
include TextBlockElement
|
30
30
|
|
31
31
|
attr_accessor :name
|
32
32
|
end
|
data/lib/rabbit/element/slide.rb
CHANGED
data/lib/rabbit/element/table.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'rabbit/element/text-element'
|
2
2
|
require 'rabbit/element/container-element'
|
3
|
+
require 'rabbit/element/block-element'
|
3
4
|
|
4
5
|
module Rabbit
|
5
6
|
module Element
|
6
7
|
class Table
|
7
8
|
include ContainerElement
|
9
|
+
include BlockElement
|
8
10
|
|
9
11
|
attr_reader :caption
|
10
12
|
def initialize(prop={})
|
@@ -47,6 +49,7 @@ module Rabbit
|
|
47
49
|
|
48
50
|
class TableHead
|
49
51
|
include ContainerElement
|
52
|
+
include BlockElement
|
50
53
|
|
51
54
|
def text
|
52
55
|
"#{super}\n"
|
@@ -59,6 +62,7 @@ module Rabbit
|
|
59
62
|
|
60
63
|
class TableBody
|
61
64
|
include ContainerElement
|
65
|
+
include BlockElement
|
62
66
|
|
63
67
|
def to_html(generator)
|
64
68
|
"<tbody>\n#{super}\n</tbody>"
|
@@ -67,6 +71,7 @@ module Rabbit
|
|
67
71
|
|
68
72
|
class TableRow
|
69
73
|
include ContainerElement
|
74
|
+
include BlockElement
|
70
75
|
|
71
76
|
def text
|
72
77
|
super.gsub(/\n/, ", ")
|
@@ -82,7 +87,7 @@ module Rabbit
|
|
82
87
|
end
|
83
88
|
|
84
89
|
class TableHeader
|
85
|
-
include
|
90
|
+
include TextContainerElement
|
86
91
|
|
87
92
|
def to_html(generator)
|
88
93
|
"<th>#{super}</th>"
|
@@ -90,7 +95,7 @@ module Rabbit
|
|
90
95
|
end
|
91
96
|
|
92
97
|
class TableCell
|
93
|
-
include
|
98
|
+
include TextContainerElement
|
94
99
|
|
95
100
|
def to_html(generator)
|
96
101
|
"<td>#{super}</td>"
|
data/lib/rabbit/element/tag.rb
CHANGED
data/lib/rabbit/element/text.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rabbit/element/text-element'
|
2
2
|
require 'rabbit/element/text-container-element'
|
3
|
-
require 'rabbit/element/block-element'
|
3
|
+
require 'rabbit/element/text-block-element'
|
4
4
|
|
5
5
|
module Rabbit
|
6
6
|
module Element
|
@@ -12,9 +12,12 @@ module Rabbit
|
|
12
12
|
include TextContainerElement
|
13
13
|
end
|
14
14
|
|
15
|
+
class TextBlock
|
16
|
+
include TextBlockElement
|
17
|
+
end
|
18
|
+
|
15
19
|
class PreformattedBlock
|
16
|
-
include
|
17
|
-
include BlockHorizontalCentering
|
20
|
+
include TextBlockElement
|
18
21
|
|
19
22
|
def to_html(generator)
|
20
23
|
"<pre>#{super}</pre>"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rabbit/element/slide-element'
|
2
|
-
require 'rabbit/element/text-
|
2
|
+
require 'rabbit/element/text-block-element'
|
3
3
|
require 'rabbit/element/description-list'
|
4
4
|
|
5
5
|
module Rabbit
|
@@ -80,7 +80,7 @@ module Rabbit
|
|
80
80
|
end
|
81
81
|
|
82
82
|
class Title
|
83
|
-
include
|
83
|
+
include TextBlockElement
|
84
84
|
|
85
85
|
def to_rd
|
86
86
|
"= #{text}"
|
@@ -92,7 +92,7 @@ module Rabbit
|
|
92
92
|
end
|
93
93
|
|
94
94
|
class Subtitle
|
95
|
-
include
|
95
|
+
include TextBlockElement
|
96
96
|
|
97
97
|
def to_rd
|
98
98
|
": subtitle\n #{text}"
|
@@ -104,7 +104,7 @@ module Rabbit
|
|
104
104
|
end
|
105
105
|
|
106
106
|
class Author
|
107
|
-
include
|
107
|
+
include TextBlockElement
|
108
108
|
|
109
109
|
def to_rd
|
110
110
|
": author\n #{text}"
|
@@ -116,7 +116,7 @@ module Rabbit
|
|
116
116
|
end
|
117
117
|
|
118
118
|
class ContentSource
|
119
|
-
include
|
119
|
+
include TextBlockElement
|
120
120
|
|
121
121
|
def to_rd
|
122
122
|
": content-source\n #{text}"
|
@@ -128,7 +128,7 @@ module Rabbit
|
|
128
128
|
end
|
129
129
|
|
130
130
|
class Institution
|
131
|
-
include
|
131
|
+
include TextBlockElement
|
132
132
|
|
133
133
|
def to_rd
|
134
134
|
": institution\n #{text}"
|
@@ -140,7 +140,7 @@ module Rabbit
|
|
140
140
|
end
|
141
141
|
|
142
142
|
class Date
|
143
|
-
include
|
143
|
+
include TextBlockElement
|
144
144
|
|
145
145
|
def to_rd
|
146
146
|
": date\n #{text}"
|
@@ -152,7 +152,7 @@ module Rabbit
|
|
152
152
|
end
|
153
153
|
|
154
154
|
class Place
|
155
|
-
include
|
155
|
+
include TextBlockElement
|
156
156
|
|
157
157
|
def to_rd
|
158
158
|
": place\n #{text}"
|
@@ -164,7 +164,7 @@ module Rabbit
|
|
164
164
|
end
|
165
165
|
|
166
166
|
class When
|
167
|
-
include
|
167
|
+
include TextBlockElement
|
168
168
|
|
169
169
|
def to_rd
|
170
170
|
": when\n #{text}"
|
@@ -176,7 +176,7 @@ module Rabbit
|
|
176
176
|
end
|
177
177
|
|
178
178
|
class Where
|
179
|
-
include
|
179
|
+
include TextBlockElement
|
180
180
|
|
181
181
|
def to_rd
|
182
182
|
": where\n #{text}"
|