rabbit 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/Rakefile +46 -12
  2. data/data/locale/en/LC_MESSAGES/rabbit.mo +0 -0
  3. data/data/locale/fr/LC_MESSAGES/rabbit.mo +0 -0
  4. data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
  5. data/doc/_config.yml +3 -3
  6. data/doc/_layouts/en.html +10 -0
  7. data/doc/_layouts/ja.html +10 -0
  8. data/doc/css/rabbit.css +25 -4
  9. data/doc/en/index.rd +1 -1
  10. data/doc/en/news.rd +46 -0
  11. data/doc/images/rabbit-slide-show-logo.png +0 -0
  12. data/doc/images/rabbit-slide-show-logo.svg +597 -0
  13. data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
  14. data/doc/images/screenshots/en/blue-circle.png +0 -0
  15. data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
  16. data/doc/images/screenshots/en/clear-blue.png +0 -0
  17. data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
  18. data/doc/images/screenshots/en/cozmixng.png +0 -0
  19. data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
  20. data/doc/images/screenshots/en/dark-gradation.png +0 -0
  21. data/doc/images/screenshots/en/day-white-raw.png +0 -0
  22. data/doc/images/screenshots/en/day-white.png +0 -0
  23. data/doc/images/screenshots/en/debian-raw.png +0 -0
  24. data/doc/images/screenshots/en/debian.png +0 -0
  25. data/doc/images/screenshots/en/green-circle-raw.png +0 -0
  26. data/doc/images/screenshots/en/green-circle.png +0 -0
  27. data/doc/images/screenshots/en/night-black-raw.png +0 -0
  28. data/doc/images/screenshots/en/night-black.png +0 -0
  29. data/doc/images/screenshots/en/rabbit-raw.png +0 -0
  30. data/doc/images/screenshots/en/rabbit.png +0 -0
  31. data/doc/images/screenshots/en/ranguba-raw.png +0 -0
  32. data/doc/images/screenshots/en/ranguba.png +0 -0
  33. data/doc/images/screenshots/en/red-frame-raw.png +0 -0
  34. data/doc/images/screenshots/en/red-frame.png +0 -0
  35. data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
  36. data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
  37. data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
  38. data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
  39. data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
  40. data/doc/images/screenshots/ja/blue-circle.png +0 -0
  41. data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
  42. data/doc/images/screenshots/ja/clear-blue.png +0 -0
  43. data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
  44. data/doc/images/screenshots/ja/cozmixng.png +0 -0
  45. data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
  46. data/doc/images/screenshots/ja/dark-gradation.png +0 -0
  47. data/doc/images/screenshots/ja/day-white-raw.png +0 -0
  48. data/doc/images/screenshots/ja/day-white.png +0 -0
  49. data/doc/images/screenshots/ja/debian-raw.png +0 -0
  50. data/doc/images/screenshots/ja/debian.png +0 -0
  51. data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
  52. data/doc/images/screenshots/ja/green-circle.png +0 -0
  53. data/doc/images/screenshots/ja/night-black-raw.png +0 -0
  54. data/doc/images/screenshots/ja/night-black.png +0 -0
  55. data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
  56. data/doc/images/screenshots/ja/rabbit.png +0 -0
  57. data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
  58. data/doc/images/screenshots/ja/ranguba.png +0 -0
  59. data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
  60. data/doc/images/screenshots/ja/red-frame.png +0 -0
  61. data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
  62. data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
  63. data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
  64. data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
  65. data/doc/index.html.ja +2 -2
  66. data/doc/ja/how-to-make/rd.rd +30 -3
  67. data/doc/ja/index.rd +1 -1
  68. data/doc/ja/news.rd +46 -0
  69. data/doc/ja/slides.rd +1 -1
  70. data/doc/ja/usage/rabbit-theme.rd +1 -1
  71. data/doc/ja/users.rd +16 -2
  72. data/lib/rabbit/author-configuration.rb +6 -6
  73. data/lib/rabbit/command/rabbit-slide.rb +208 -161
  74. data/lib/rabbit/command/rabbit.rb +2 -2
  75. data/lib/rabbit/console.rb +1 -1
  76. data/lib/rabbit/element/text-renderer.rb +2 -2
  77. data/lib/rabbit/element/video.rb +167 -0
  78. data/lib/rabbit/image/pdf.rb +19 -10
  79. data/lib/rabbit/parser/ext/video.rb +18 -0
  80. data/lib/rabbit/parser/rd/ext/block-verbatim.rb +10 -0
  81. data/lib/rabbit/parser/rd/ext/video.rb +15 -0
  82. data/lib/rabbit/slide-configuration.rb +15 -8
  83. data/lib/rabbit/slideshare.rb +93 -13
  84. data/lib/rabbit/task/slide.rb +5 -4
  85. data/lib/rabbit/task/theme.rb +3 -1
  86. data/lib/rabbit/theme/applier.rb +1 -1
  87. data/lib/rabbit/theme/entry.rb +0 -29
  88. data/lib/rabbit/theme/title-shadow/title-shadow.rb +1 -1
  89. data/lib/rabbit/version.rb +1 -1
  90. data/lib/rabbit/video-window.rb +122 -0
  91. data/misc/github-post-receiver/config.ru +170 -0
  92. data/misc/github-post-receiver/config.yaml.sample +3 -0
  93. data/misc/github-post-receiver/tmp/restart.txt +0 -0
  94. data/po/en/rabbit.po~ +2567 -0
  95. data/po/fr/rabbit.po~ +2674 -0
  96. data/po/ja/rabbit.po~ +2695 -0
  97. data/po/rabbit.pot +1195 -1094
  98. data/rabbit.gemspec +1 -0
  99. data/test/test-author-configuration.rb +1 -0
  100. data/test/test-slide-configuration.rb +3 -0
  101. metadata +659 -640
  102. data/bin/rabbit-theme-manager +0 -133
  103. data/lib/rabbit/theme-browser.rb +0 -104
  104. data/lib/rabbit/theme-browser/default-tag.yaml +0 -89
  105. data/lib/rabbit/theme-browser/document.rb +0 -200
  106. data/lib/rabbit/theme-browser/ext/block-verbatim.rb +0 -39
  107. data/lib/rabbit/theme-browser/page.rb +0 -133
  108. data/lib/rabbit/theme-browser/rd2document-lib.rb +0 -181
  109. data/lib/rabbit/theme-browser/tag.rb +0 -67
  110. data/lib/rabbit/theme-browser/tree.rb +0 -91
@@ -1,39 +0,0 @@
1
- require 'rabbit/parser/rd'
2
-
3
- module Rabbit
4
- class ThemeBrowser
5
- module Ext
6
- class BlockVerbatim < Parser::RD::Ext::Base
7
- include Parser::RD::Ext::Image
8
-
9
- def default_ext_block_verbatim(label, source, content, visitor)
10
- Proc.new do
11
- visitor.tag("verbatim-block") do
12
- visitor.insert(content)
13
- end
14
- end
15
- end
16
-
17
- def ext_block_verb_img(label, source, content, visitor)
18
- return nil unless /^(?:image|img)$/i =~ label
19
- src, prop = parse_source(source)
20
- return nil if prop['src'].nil?
21
- image = make_image(visitor, prop['src'], prop)
22
- return nil if image.nil?
23
- Proc.new do
24
- visitor.tag("image-description") do
25
- w = image.original_width
26
- h = image.original_height
27
- visitor.insert("(#{w}x#{h})")
28
- visitor.insert("\n")
29
- end
30
- visitor.tag("image") do
31
- visitor.insert(image.pixbuf)
32
- visitor.insert("\n")
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,133 +0,0 @@
1
- require 'forwardable'
2
-
3
- require 'gtk2'
4
-
5
- require 'rabbit/rabbit'
6
- require 'rabbit/theme-browser/tree'
7
- require 'rabbit/theme-browser/document'
8
-
9
- module Rabbit
10
- class ThemeBrowser
11
- class Page
12
- extend Forwardable
13
-
14
- def_delegators(:@browser, :logger)
15
-
16
- attr_reader :widget
17
-
18
- def initialize(browser)
19
- super()
20
- @browser = browser
21
- @back_paths = []
22
- @forward_paths = []
23
- @forwarding = true
24
- init_gui
25
- end
26
-
27
- def change_document(name, type)
28
- prev_name = @document.name
29
- unless prev_name.nil?
30
- paths = @forwarding ? @back_paths : @forward_paths
31
- paths.push([prev_name, @document.type])
32
- end
33
- update_move_button
34
- @document.change_buffer(name, type)
35
- @up.sensitive = @document.type == "theme"
36
- end
37
-
38
- def change_tree(name, type)
39
- @tree.select(name, type)
40
- end
41
-
42
- def themes
43
- @browser.themes
44
- end
45
-
46
- def default_size_changed(width, height)
47
- @hpaned.position = width * 0.25
48
- end
49
-
50
- def reload
51
- position = @hpaned.position
52
- name, type = @document.name, @document.type
53
- @widget.remove(@hpaned)
54
- @browser.load_themes
55
-
56
- Tag.reload_tag_infos
57
- init_view
58
-
59
- @hpaned.position = position
60
- @hpaned.show_all
61
- change_tree(name, type) if name and type
62
- end
63
-
64
- private
65
- def init_gui
66
- @widget = Gtk::VBox.new
67
- init_toolbar
68
- @widget.pack_start(@toolbar, false)
69
- init_view
70
- end
71
-
72
- def init_toolbar
73
- @toolbar = Gtk::Toolbar.new
74
- @toolbar.toolbar_style = Gtk::Toolbar::ICONS
75
-
76
- append_move_button
77
- @toolbar.append_space
78
-
79
- append_up_button
80
- @up.sensitive = false
81
- @toolbar.append_space
82
-
83
- append_reload_button
84
- end
85
-
86
- def init_view
87
- @hpaned = Gtk::HPaned.new
88
- @widget.pack_start(@hpaned)
89
- @tree = Tree.new(self)
90
- @document = Document.new(self)
91
- @hpaned.add1(wrap_by_scrolled_window(@tree.view))
92
- @hpaned.add2(wrap_by_scrolled_window(@document.view))
93
- end
94
-
95
- def append_move_button
96
- @back = @toolbar.append(Gtk::Stock::GO_BACK, _("Go back")) do
97
- @forwarding = false
98
- change_tree(*@back_paths.pop)
99
- @forwarding = true
100
- end
101
- @forward = @toolbar.append(Gtk::Stock::GO_FORWARD, _("Go forward")) do
102
- change_tree(*@forward_paths.pop)
103
- end
104
- end
105
-
106
- def update_move_button
107
- @back.sensitive = !@back_paths.empty?
108
- @forward.sensitive = !@forward_paths.empty?
109
- end
110
-
111
- def append_up_button
112
- @up = @toolbar.append(Gtk::Stock::GO_UP, _("Go up")) do
113
- entry = themes.find {|e| e.name == @document.name}
114
- change_tree(entry.category, "category")
115
- end
116
- end
117
-
118
- def append_reload_button
119
- @reload = @toolbar.append(Gtk::Stock::REFRESH, _("Reload")) do
120
- reload
121
- end
122
- end
123
-
124
- def wrap_by_scrolled_window(widget)
125
- scrolled_window = Gtk::ScrolledWindow.new
126
- scrolled_window.set_policy(Gtk::PolicyType::AUTOMATIC,
127
- Gtk::PolicyType::AUTOMATIC)
128
- scrolled_window.add(widget)
129
- scrolled_window
130
- end
131
- end
132
- end
133
- end
@@ -1,181 +0,0 @@
1
- require "rabbit/parser/rd"
2
- require "rabbit/element"
3
- require 'rabbit/theme-browser/tag'
4
- require 'rabbit/theme-browser/ext/block-verbatim'
5
-
6
- module Rabbit
7
- class ThemeBrowser
8
- class RD2DocumentVisitor < Parser::RD::Visitor
9
- EXTENSIONS = {
10
- "block_verbatim" => Ext::BlockVerbatim,
11
- }
12
-
13
- @@itemize_icon = nil
14
-
15
- attr_reader :logger
16
- def initialize(buffer, iter, logger)
17
- @buffer = buffer
18
- @iter = iter
19
- @logger = logger
20
- load_itemize_icon
21
- super()
22
- end
23
-
24
- def apply_to_DocumentElement(element, contents)
25
- tag("body") do
26
- insert_children(contents, "top-level-")
27
- end
28
- end
29
-
30
- def apply_to_Headline(element, contents)
31
- Proc.new do |*args|
32
- tag("heading#{element.level}") do
33
- insert_children(contents)
34
- insert("\n")
35
- end
36
- end
37
- end
38
-
39
- def apply_to_ItemList(element, items)
40
- Proc.new do |*args|
41
- items.each do |item|
42
- tag("item") do
43
- @buffer.insert(@iter, @@itemize_icon)
44
- @buffer.insert(@iter, " ")
45
- tag("item-content") do
46
- item.call
47
- end
48
- end
49
- end
50
- end
51
- end
52
-
53
- def apply_to_DescList(element, items)
54
- Proc.new do |*args|
55
- items.each do |item|
56
- tag("description") do
57
- item.call
58
- end
59
- end
60
- end
61
- end
62
-
63
- def apply_to_ItemListItem(element, contents)
64
- Proc.new do |*args|
65
- contents.each do |content|
66
- content.call
67
- end
68
- end
69
- end
70
-
71
- def apply_to_DescListItem(element, term, description)
72
- Proc.new do |*args|
73
- tag("description-term") do
74
- insert_children(term)
75
- end
76
- @buffer.insert(@iter, "\n")
77
- tag("description-content") do
78
- insert_children(description)
79
- end
80
- end
81
- end
82
-
83
- def apply_to_TextBlock(element, contents)
84
- Proc.new do |*args|
85
- prefix, = args
86
- tag("#{prefix}paragraph") do
87
- insert_children(contents)
88
- insert("\n")
89
- end
90
- end
91
- end
92
-
93
- def apply_to_Verbatim(element)
94
- content = []
95
- element.each_line do |line|
96
- content << line
97
- end
98
- content_str = content.join("")
99
- /\A#\s*([^\n]+)(?:\n)?(?m:(.*)?)\z/ =~ content_str
100
- apply_to_extension("block_verbatim", $1, $2.to_s, content_str)
101
- end
102
-
103
- def apply_to_StringElement(element)
104
- element.content.gsub(/\n\s*/, '')
105
- end
106
-
107
- def apply_to_Reference_with_RDLabel(element, contents)
108
- source = []
109
- contents.each do |elem|
110
- if elem.respond_to?(:call)
111
- elem.call
112
- else
113
- source << elem
114
- end
115
- end
116
- source = source.join("")
117
- Proc.new do |*args|
118
- insert_link(element.label.element_label, source)
119
- end
120
- end
121
-
122
- def apply_to_Code(element, contents)
123
- Proc.new do |*args|
124
- tag("code") do
125
- insert_children(contents)
126
- end
127
- end
128
- end
129
-
130
- def apply_to_Var(element, contents)
131
- Proc.new do |*args|
132
- tag("variable") do
133
- insert_children(contents)
134
- end
135
- end
136
- end
137
-
138
- def insert(text, *args)
139
- @buffer.insert(@iter, text, *args)
140
- end
141
-
142
-
143
- def insert_link(name, text=nil)
144
- text ||= _(name)
145
- tag("theme-link-#{name}") do
146
- insert(text, "link")
147
- end
148
- end
149
-
150
- def tag(name)
151
- start_offset = @iter.offset
152
- yield
153
- @buffer.apply_tag(name,
154
- @buffer.get_iter_at_offset(start_offset),
155
- @iter)
156
- end
157
-
158
- def insert_children(children, *args)
159
- children.each do |child|
160
- if child.respond_to?(:call)
161
- child.call(*args)
162
- else
163
- insert(child)
164
- end
165
- end
166
- end
167
-
168
- private
169
- def load_itemize_icon
170
- unless @@itemize_icon
171
- image_theme = Theme::Searcher.find_theme("rabbit-images", true)
172
- icon_file = Theme::Searcher.find_file("green-item.png",
173
- [image_theme])
174
- loader = ImageLoader.new(icon_file)
175
- loader.resize(10, 10)
176
- @@itemize_icon = loader.pixbuf
177
- end
178
- end
179
- end
180
- end
181
- end
@@ -1,67 +0,0 @@
1
- require 'yaml'
2
-
3
- require 'gtk2'
4
-
5
- require 'rabbit/rabbit'
6
- require 'rabbit/utils'
7
-
8
- module Rabbit
9
- class ThemeBrowser
10
- module Tag
11
- INFOS = {}
12
-
13
- module_function
14
- def update_info_by_yaml_file(filename, *args)
15
- filename = File.join(filename, *args)
16
- if File.exist?(filename)
17
- target = filename
18
- else
19
- target = Utils.find_path_in_load_path(filename)
20
- end
21
- raise NotExistError.new(filename) if target.nil?
22
- result = File.open(target) do |f|
23
- YAML.load(f.read)
24
- end
25
- INFOS.update(infos_pangoize(result))
26
- end
27
-
28
- def infos_pangoize(infos)
29
- result = {}
30
- infos.each_key do |name|
31
- props = {}
32
- result[name] = props
33
- (infos[name] || {}).each do |key, value|
34
- case key
35
- when "size"
36
- prop_value = value * Pango::SCALE
37
- when "weight"
38
- weight = "WEIGHT_#{value.upcase}"
39
- prop_value = Pango::FontDescription.const_get(weight)
40
- when "style"
41
- style = "STYLE_#{value.upcase}"
42
- prop_value = Pango::FontDescription.const_get(style)
43
- when "underline"
44
- underline = value.upcase
45
- prop_value = Pango::AttrUnderline.const_get(underline)
46
- else
47
- prop_value = value
48
- end
49
- props[key] = prop_value
50
- end
51
- end
52
- result
53
- end
54
-
55
- def reload_tag_infos
56
- INFOS.clear
57
- update_info_by_yaml_file("rabbit", "theme-browser", "default-tag.yaml")
58
- begin
59
- update_info_by_yaml_file("rabbit", "theme-browser", "tag.yaml")
60
- rescue NotExistError
61
- end
62
- end
63
-
64
- reload_tag_infos
65
- end
66
- end
67
- end
@@ -1,91 +0,0 @@
1
- require 'gtk2'
2
-
3
- require 'rabbit/rabbit'
4
-
5
- module Rabbit
6
- class ThemeBrowser
7
- class Tree
8
- include GetText
9
-
10
- MODEL = [
11
- [:name, String],
12
- [:title, String],
13
- [:type, String],
14
- ]
15
-
16
- attr_reader :view
17
-
18
- def initialize(page)
19
- @page = page
20
- init_gui
21
- end
22
-
23
- def select(name, type)
24
- name_column = column(:name)
25
- depth = type == "category" ? 1 : 2
26
- @view.model.each do |model, path, iter|
27
- if depth == path.depth and name == iter.get_value(name_column)
28
- @view.expand_to_path(path)
29
- @view.selection.select_iter(iter)
30
- break
31
- end
32
- end
33
- end
34
-
35
- private
36
- def column(key)
37
- MODEL.index(MODEL.assoc(key))
38
- end
39
-
40
- def init_gui
41
- @view = Gtk::TreeView.new
42
- model_types = MODEL.collect {|key, type| type}
43
- model = Gtk::TreeStore.new(*model_types)
44
- @view.set_model(model)
45
- init_columns
46
- init_model
47
- end
48
-
49
- def init_columns
50
- renderer = Gtk::CellRendererText.new
51
- params = {
52
- "text" => column(:title),
53
- }
54
- @view.insert_column(-1, _("Theme"), renderer, params)
55
- @view.selection.signal_connect("changed") do |selection|
56
- iter = selection.selected
57
- if iter
58
- name = iter.get_value(column(:name))
59
- type = iter.get_value(column(:type))
60
- @page.change_document(name, type)
61
- end
62
- false
63
- end
64
- end
65
-
66
- def init_model
67
- model = @view.model
68
- type = column(:type)
69
- name = column(:name)
70
- title = column(:title)
71
- categories = {}
72
- @page.themes.each do |entry|
73
- category = entry.category
74
- iter = categories[category]
75
- if iter.nil?
76
- iter = model.append(nil)
77
- categories[category] = iter
78
- iter[type] = "category"
79
- iter[name] = category
80
- iter[title] = _(category)
81
- end
82
- child_iter = model.append(iter)
83
- child_iter[type] = "theme"
84
- child_iter[name] = entry.name
85
- child_iter[title] = _(entry.title)
86
- end
87
- # @view.expand_all
88
- end
89
- end
90
- end
91
- end