rabbit 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/doc/_config.yml +2 -2
  3. data/doc/en/faq.rd +5 -5
  4. data/doc/en/install/windows.rd +4 -49
  5. data/doc/en/news.rd +96 -0
  6. data/doc/en/slides.rd +2 -0
  7. data/doc/en/usage/rabbit-slide.rd +1 -1
  8. data/doc/ja/faq.rd +37 -32
  9. data/doc/ja/how-to-make/theme.rd +50 -50
  10. data/doc/ja/index.rd +35 -35
  11. data/doc/ja/install/windows.rd +4 -46
  12. data/doc/ja/news.rd +127 -30
  13. data/doc/ja/sample/hiki/rabbit.hiki +4 -4
  14. data/doc/ja/usage/rabbit-slide.rd +8 -8
  15. data/doc/ja/usage/rabbit-theme.rd +7 -7
  16. data/doc/ja/usage/rabbit.rd +124 -124
  17. data/lib/rabbit/action/basic.rb +1 -1
  18. data/lib/rabbit/canvas.rb +19 -19
  19. data/lib/rabbit/command/rabbit-slide.rb +5 -4
  20. data/lib/rabbit/command/rabbit.rb +2 -1
  21. data/lib/rabbit/cursor-manager.rb +14 -14
  22. data/lib/rabbit/element/poppler-slide.rb +6 -0
  23. data/lib/rabbit/element/poppler-title-slide.rb +6 -0
  24. data/lib/rabbit/element/slide-element.rb +4 -0
  25. data/lib/rabbit/element/text-renderer.rb +1 -1
  26. data/lib/rabbit/formatter.rb +9 -9
  27. data/lib/rabbit/frame.rb +5 -5
  28. data/lib/rabbit/front.rb +2 -2
  29. data/lib/rabbit/graffiti/processor.rb +9 -9
  30. data/lib/rabbit/html/template.erb +1 -1
  31. data/lib/rabbit/image/default.rb +2 -2
  32. data/lib/rabbit/image/eps.rb +5 -5
  33. data/lib/rabbit/image/pdf.rb +1 -1
  34. data/lib/rabbit/image/svg.rb +1 -1
  35. data/lib/rabbit/logger/base.rb +5 -5
  36. data/lib/rabbit/logger/stderr.rb +4 -1
  37. data/lib/rabbit/menu.rb +4 -4
  38. data/lib/rabbit/parser/ext/aafigure.rb +6 -4
  39. data/lib/rabbit/parser/ext/blockdiag.rb +5 -3
  40. data/lib/rabbit/parser/ext/entity.rb +26 -26
  41. data/lib/rabbit/parser/markdown.rb +42 -0
  42. data/lib/rabbit/parser/markdown/converter.rb +115 -18
  43. data/lib/rabbit/parser/pdf.rb +1 -5
  44. data/lib/rabbit/parser/rd/rt/rt2rabbit-lib.rb +2 -2
  45. data/lib/rabbit/rabbit.rb +1 -1
  46. data/lib/rabbit/renderer/base.rb +15 -23
  47. data/lib/rabbit/renderer/color.rb +3 -3
  48. data/lib/rabbit/renderer/display/base.rb +81 -6
  49. data/lib/rabbit/renderer/display/clutter-embed.rb +1 -1
  50. data/lib/rabbit/renderer/display/drawing-area-base.rb +2 -2
  51. data/lib/rabbit/renderer/display/drawing-area-primitive.rb +1 -1
  52. data/lib/rabbit/renderer/engine/cairo.rb +1 -70
  53. data/lib/rabbit/renderer/kernel.rb +11 -19
  54. data/lib/rabbit/renderer/pixmap/base.rb +3 -3
  55. data/lib/rabbit/renderer/print/base.rb +5 -5
  56. data/lib/rabbit/renderer/print/cairo.rb +10 -17
  57. data/lib/rabbit/renderer/print/layout.rb +6 -6
  58. data/lib/rabbit/renderer/print/multiple.rb +11 -14
  59. data/lib/rabbit/size.rb +65 -0
  60. data/lib/rabbit/soap/driver.rb +1 -1
  61. data/lib/rabbit/soap/server.rb +1 -1
  62. data/lib/rabbit/source/argf.rb +4 -4
  63. data/lib/rabbit/source/base.rb +2 -1
  64. data/lib/rabbit/source/file.rb +8 -8
  65. data/lib/rabbit/source/hiki.rb +1 -1
  66. data/lib/rabbit/source/memory.rb +2 -2
  67. data/lib/rabbit/source/uri.rb +4 -2
  68. data/lib/rabbit/theme/applier.rb +1 -0
  69. data/lib/rabbit/theme/default-block-quote/default-block-quote.rb +3 -1
  70. data/lib/rabbit/theme/pdf/pdf.rb +12 -6
  71. data/lib/rabbit/utils.rb +6 -6
  72. data/lib/rabbit/version.rb +1 -1
  73. data/lib/rabbit/xmlrpc/server.rb +1 -1
  74. data/po/en/rabbit.edit.po +29 -30
  75. data/po/fr/rabbit.edit.po +29 -30
  76. data/po/ja/rabbit.edit.po +29 -29
  77. data/sample/rabbit-en.hiki +3 -3
  78. data/sample/rabbit-en.md +27 -8
  79. data/sample/rabbit-en.rd +2 -2
  80. data/sample/rabbit.hiki +3 -3
  81. data/sample/rabbit.md +27 -8
  82. data/sample/rabbit.rd +2 -2
  83. data/test/parser/test-markdown.rb +210 -6
  84. data/test/test-size.rb +152 -0
  85. data/test/test-source.rb +17 -0
  86. metadata +5 -2
@@ -3,14 +3,6 @@ require "rabbit/renderer/color"
3
3
  module Rabbit
4
4
  module Renderer
5
5
  module Kernel
6
- def rsvg_available?
7
- false
8
- end
9
-
10
- def poppler_available?
11
- false
12
- end
13
-
14
6
  def make_color(color)
15
7
  return color if color.is_a?(Color)
16
8
  if color.nil?
@@ -65,11 +57,11 @@ module Rabbit
65
57
  def draw_circle(filled, x, y, w, h, color=nil, params={})
66
58
  draw_arc(filled, x, y, w, h, 0, 360, color, params)
67
59
  end
68
-
60
+
69
61
  def draw_circle_by_radius(filled, x, y, r, color=nil, params={})
70
62
  draw_arc_by_radius(filled, x, y, r, 0, 360, color, params)
71
63
  end
72
-
64
+
73
65
  def draw_flag(x, y, pole_height, params)
74
66
  if params["flag_type"] == "triangle"
75
67
  draw_triangle_flag(x, y, pole_height, params)
@@ -77,7 +69,7 @@ module Rabbit
77
69
  draw_rectangle_flag(x, y, pole_height, params)
78
70
  end
79
71
  end
80
-
72
+
81
73
  def draw_triangle_flag(x, y, pole_height, params)
82
74
  params = setup_flag_params(pole_height, 1.5, params)
83
75
 
@@ -184,36 +176,36 @@ module Rabbit
184
176
  def draw_cube(filled, x, y, z, size, color=nil)
185
177
  not_support_method("draw_cube")
186
178
  end
187
-
179
+
188
180
  def draw_sphere(filled, x, y, z, radius, slices, stacks, color=nil)
189
181
  not_support_method("draw_sphere")
190
182
  end
191
-
183
+
192
184
  def draw_cone(filled, x, y, z, base, height, slices, stacks, color=nil)
193
185
  not_support_method("draw_cone")
194
186
  end
195
-
187
+
196
188
  def draw_torus(filled, x, y, z, inner_radius, outer_radius,
197
189
  n_sides, rings, color=nil)
198
190
  not_support_method("draw_torus")
199
191
  end
200
-
192
+
201
193
  def draw_tetrahedron(filled, x, y, z, color=nil)
202
194
  not_support_method("draw_tetrahedron")
203
195
  end
204
-
196
+
205
197
  def draw_octahedron(filled, x, y, z, color=nil)
206
198
  not_support_method("draw_octahedron")
207
199
  end
208
-
200
+
209
201
  def draw_dodecahedron(filled, x, y, z, color=nil)
210
202
  not_support_method("draw_dodecahedron")
211
203
  end
212
-
204
+
213
205
  def draw_icosahedron(filled, x, y, z, color=nil)
214
206
  not_support_method("draw_icosahedron")
215
207
  end
216
-
208
+
217
209
  def draw_teapot(filled, x, y, z, scale, color=nil)
218
210
  not_support_method("draw_teapot")
219
211
  end
@@ -10,11 +10,11 @@ module Rabbit
10
10
  include Renderer::Base
11
11
 
12
12
  @@depth = nil
13
-
13
+
14
14
  attr_accessor :width, :height, :pango_context
15
-
15
+
16
16
  attr_accessor :filename
17
-
17
+
18
18
  def initialize(canvas, width=nil, height=nil)
19
19
  super(canvas)
20
20
  @width = width
@@ -10,7 +10,7 @@ module Rabbit
10
10
 
11
11
  attr_writer :filename
12
12
  attr_accessor :show_page
13
-
13
+
14
14
  def initialize(canvas)
15
15
  super
16
16
  @filename = nil
@@ -19,11 +19,11 @@ module Rabbit
19
19
  def page_width
20
20
  @page_width - page_margin_left - page_margin_right
21
21
  end
22
-
22
+
23
23
  def page_height
24
24
  @page_height - page_margin_top - page_margin_bottom
25
25
  end
26
-
26
+
27
27
  def width
28
28
  page_width
29
29
  end
@@ -36,12 +36,12 @@ module Rabbit
36
36
  super
37
37
  init_paper
38
38
  end
39
-
39
+
40
40
  def paper_height=(value)
41
41
  super
42
42
  init_paper
43
43
  end
44
-
44
+
45
45
  def pre_print(slide_size)
46
46
  @show_page = true
47
47
  end
@@ -15,8 +15,6 @@ module Rabbit
15
15
  module Print
16
16
  class Cairo
17
17
  include Engine::Cairo
18
- alias_method :cairo_rsvg_available?, :rsvg_available?
19
- alias_method :cairo_poppler_available?, :poppler_available?
20
18
  include Base
21
19
 
22
20
  class << self
@@ -28,7 +26,7 @@ module Rabbit
28
26
  end
29
27
  end
30
28
  end
31
-
29
+
32
30
  def initialize(canvas)
33
31
  super
34
32
  init_paper
@@ -44,19 +42,19 @@ module Rabbit
44
42
  return if canceled
45
43
  @context.target.finish
46
44
  end
47
-
45
+
48
46
  def pre_parse
49
47
  end
50
-
48
+
51
49
  def post_parse
52
50
  end
53
-
51
+
54
52
  def post_apply_theme
55
53
  end
56
-
54
+
57
55
  def post_move(old_index, index)
58
56
  end
59
-
57
+
60
58
  def post_move_in_slide(old_index, index)
61
59
  end
62
60
 
@@ -75,14 +73,6 @@ module Rabbit
75
73
  draw_rectangle(true, x, y, w, h, @background)
76
74
  end
77
75
 
78
- def rsvg_available?
79
- cairo_rsvg_available?
80
- end
81
-
82
- def poppler_available?
83
- cairo_poppler_available?
84
- end
85
-
86
76
  private
87
77
  def init_paper
88
78
  default_width_mm = 360
@@ -90,7 +80,7 @@ module Rabbit
90
80
  @page_width = @paper_width || default_width_mm
91
81
  @page_height = @paper_height || default_height_mm
92
82
  end
93
-
83
+
94
84
  def init_color
95
85
  super
96
86
  @foreground = make_color("black")
@@ -126,6 +116,9 @@ module Rabbit
126
116
  surface = ::Cairo::SVGSurface.new(*args)
127
117
  surface.restrict_to_version(::Cairo::SVG_VERSION_1_2)
128
118
  surface
119
+ when /\.cs/i
120
+ args[0] = ::Cairo::ScriptDevice.new(args[0])
121
+ ::Cairo::ScriptSurface.new(*args)
129
122
  else
130
123
  @canvas.logger.warn(_("can't find printer for %s") % filename)
131
124
  args[0] = "default.ps"
@@ -33,7 +33,7 @@ module Rabbit
33
33
  @margin_bottom = renderer.margin_bottom
34
34
  end
35
35
  end
36
-
36
+
37
37
  class Layout2 < LayoutBase
38
38
 
39
39
  def initialize(renderer)
@@ -43,7 +43,7 @@ module Rabbit
43
43
  @margin_top ||= 30
44
44
  @margin_bottom ||= 30
45
45
  end
46
-
46
+
47
47
  def slide_width
48
48
  page_width - @margin_left - @margin_right
49
49
  end
@@ -51,7 +51,7 @@ module Rabbit
51
51
  def slide_height
52
52
  (page_height / 2) - @margin_top - @margin_bottom
53
53
  end
54
-
54
+
55
55
  def normalize_x(x)
56
56
  x + @margin_left
57
57
  end
@@ -69,7 +69,7 @@ module Rabbit
69
69
  (current_index % 2) == 1
70
70
  end
71
71
  end
72
-
72
+
73
73
  class LayoutMore < LayoutBase
74
74
  def initialize(renderer)
75
75
  super
@@ -78,7 +78,7 @@ module Rabbit
78
78
  @margin_top ||= 10
79
79
  @margin_bottom ||= 10
80
80
  end
81
-
81
+
82
82
  def slide_width
83
83
  (page_width / 2) - @margin_left - @margin_right
84
84
  end
@@ -87,7 +87,7 @@ module Rabbit
87
87
  base = page_height / (slides_per_page / 2.0).ceil
88
88
  base - @margin_top - @margin_bottom
89
89
  end
90
-
90
+
91
91
  def normalize_x(x)
92
92
  base = @margin_left
93
93
  unless left?
@@ -11,17 +11,17 @@ module Rabbit
11
11
  include Base
12
12
  include Kernel
13
13
  extend Forwardable
14
-
14
+
15
15
  def_delegators(:@canvas, :current_index)
16
-
16
+
17
17
  def_delegators(:@print, :filename, :filename=)
18
18
  def_delegators(:@print, :foreground=, :background=)
19
19
  def_delegators(:@print, :background_image=)
20
-
20
+
21
21
  def_delegators(:@print, :page_width, :page_width=)
22
22
  def_delegators(:@print, :page_height, :page_height=)
23
23
  def_delegators(:@print, :width, :height)
24
-
24
+
25
25
  def_delegators(:@print, :pre_print, :post_print, :post_apply_theme)
26
26
  def_delegators(:@print, :post_move, :post_move_in_slide, :post_iconify)
27
27
  def_delegators(:@print, :post_fullscreen, :post_unfullscreen)
@@ -31,17 +31,14 @@ module Rabbit
31
31
 
32
32
  def_delegators(:@print, :make_color, :make_layout)
33
33
  def_delegators(:@print, :create_pango_context)
34
-
35
- def_delegators(:@print, :clear_theme)
36
34
 
37
- def_delegators(:@print, :rsvg_available?, :poppler_available?)
38
- def_delegators(:@print, :rsvg_available?, :poppler_available?)
35
+ def_delegators(:@print, :clear_theme)
39
36
 
40
37
  def initialize(canvas)
41
38
  @print = Print.new(canvas)
42
39
  super
43
40
  end
44
-
41
+
45
42
  def width
46
43
  @slide_width ||= @layout.slide_width
47
44
  end
@@ -59,12 +56,12 @@ module Rabbit
59
56
  super
60
57
  @print.page_margin_right = margin
61
58
  end
62
-
59
+
63
60
  def page_margin_top=(margin)
64
61
  super
65
62
  @print.page_margin_top = margin
66
63
  end
67
-
64
+
68
65
  def page_margin_bottom=(margin)
69
66
  super
70
67
  @print.page_margin_bottom = margin
@@ -79,18 +76,18 @@ module Rabbit
79
76
  super
80
77
  @print.margin_right = margin
81
78
  end
82
-
79
+
83
80
  def margin_top=(margin)
84
81
  super
85
82
  @print.margin_top = margin
86
83
  end
87
-
84
+
88
85
  def margin_bottom=(margin)
89
86
  super
90
87
  @print.margin_bottom = margin
91
88
  end
92
89
 
93
-
90
+
94
91
  def draw_slide(slide, simulation)
95
92
  @print.show_page = need_show_page?
96
93
  @print.internal_draw_slide(slide, simulation) do
@@ -0,0 +1,65 @@
1
+ module Rabbit
2
+ class Size
3
+ attr_reader :real_width
4
+ attr_reader :real_height
5
+ attr_reader :logical_width
6
+ attr_reader :logical_height
7
+ attr_reader :logical_margin_left
8
+ attr_reader :logical_margin_right
9
+ attr_reader :logical_margin_top
10
+ attr_reader :logical_margin_bottom
11
+ attr_reader :ratio
12
+ def initialize(width, height, ratio)
13
+ @real_width = width
14
+ @real_height = height
15
+ @ratio = ratio
16
+ compute_logical_size
17
+ end
18
+
19
+ def have_logical_margin_x?
20
+ @logical_margin_left > 0 or
21
+ @logical_margin_right > 0
22
+ end
23
+
24
+ def have_logical_margin_y?
25
+ @logical_margin_top > 0 or
26
+ @logical_margin_bottom > 0
27
+ end
28
+
29
+ def have_logical_margin?
30
+ have_logical_margin_x? or have_logical_margin_y?
31
+ end
32
+
33
+ private
34
+ def compute_logical_size
35
+ real_ratio = @real_width.to_f / @real_height.to_f
36
+ if real_ratio == @ratio
37
+ @logical_width = @real_width
38
+ @logical_height = @real_height
39
+ @logical_margin_left = 0
40
+ @logical_margin_right = 0
41
+ @logical_margin_top = 0
42
+ @logical_margin_bottom = 0
43
+ return
44
+ end
45
+
46
+ if real_ratio > @ratio
47
+ @logical_width = @real_width * (@ratio / real_ratio)
48
+ @logical_height = @real_height
49
+ width_margin = @real_width - @logical_width
50
+ @logical_margin_left = width_margin / 2
51
+ @logical_margin_right = width_margin / 2
52
+ @logical_margin_top = 0
53
+ @logical_margin_bottom = 0
54
+ else
55
+ @logical_width = @real_width
56
+ @logical_height = @real_height * (real_ratio / @ratio)
57
+ height_margin = @real_height - @logical_height
58
+ @logical_margin_left = 0
59
+ @logical_margin_right = 0
60
+ @logical_margin_top = height_margin / 2
61
+ @logical_margin_bottom = height_margin / 2
62
+ end
63
+ end
64
+ end
65
+ end
@@ -15,7 +15,7 @@ module Rabbit
15
15
  info.concat(Utils.arg_list(Front.instance_method(name).arity))
16
16
  @@method_infos << info
17
17
  end
18
-
18
+
19
19
  def initialize(end_point, soap_action=nil)
20
20
  super(end_point, Rabbit::SOAP::NS, soap_action)
21
21
 
@@ -28,6 +28,6 @@ EOS
28
28
  add_rpc_servant(front)
29
29
  end
30
30
  end
31
-
31
+
32
32
  end
33
33
  end
@@ -3,18 +3,18 @@ require "rabbit/source/base"
3
3
  module Rabbit
4
4
  module Source
5
5
  class ARGF
6
-
6
+
7
7
  include Base
8
-
8
+
9
9
  def self.initial_args_description
10
10
  N_("none (get from STDIN) or [FILE_NAMES]")
11
11
  end
12
-
12
+
13
13
  def initialize(encoding, logger, argf)
14
14
  super(encoding, logger)
15
15
  @argf = argf
16
16
  end
17
-
17
+
18
18
  private
19
19
  def _read
20
20
  begin