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,133 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- ruby -*-
3
-
4
- require "fileutils"
5
-
6
- require "rabbit/console"
7
-
8
- COMMANDS = %w(generate browse)
9
-
10
- def parse(args=ARGV, logger=nil)
11
- Rabbit::Console.parse!(args, logger) do |parser, options|
12
- options.startup_theme = nil
13
- options.theme_doc_dir = "theme-doc"
14
- options.locale_dir = nil
15
- options.locales = [N_("en"), N_("ja"), N_("fr")]
16
- options.width = 600
17
- options.height = 400
18
-
19
-
20
- parser.banner = "#{parser.banner} [COMMAND]"
21
-
22
- parser.separator _("[COMMAND] is one of them: [%s]") % COMMANDS.join(', ')
23
- parser.separator "(#{COMMANDS.first})"
24
- parser.separator ""
25
-
26
- parser.on("-I", "--include [PATH]",
27
- _("Add [PATH] to load path.")) do |path|
28
- $LOAD_PATH.unshift(path)
29
- end
30
-
31
- parser.separator ""
32
-
33
- parser.on("--startup-theme [THEME]",
34
- _("Show [THEME] when startup."),
35
- "(#{options.startup_theme})") do |theme|
36
- options.startup_theme = theme
37
- end
38
-
39
- parser.separator ""
40
-
41
- parser.on("-w", "--width [WIDTH]",
42
- Integer,
43
- _("Set window width to [WIDTH]."),
44
- "(#{options.width})") do |width|
45
- options.width = width
46
- end
47
-
48
- parser.on("-h", "--height [HEIGHT]",
49
- Integer,
50
- _("Set window height to [HEIGHT]."),
51
- "(#{options.height})") do |height|
52
- options.height = height
53
- end
54
-
55
- message = _("Set window width and height to\n" \
56
- "[WIDTH] and [HEIGHT].")
57
- message = message.split(/\n/) + ["(#{options.width},#{options.height})"]
58
- parser.on("-S", "--size [WIDTH],[HEIGHT]",
59
- Array,
60
- *message) do |size|
61
- width, height = size.collect{|x| Integer(x)}
62
- options.width = width
63
- options.height = height
64
- end
65
-
66
- parser.separator ""
67
-
68
- parser.on("--theme-doc-dir [DIR]",
69
- _("Specify theme document directory as [DIR].")) do |dir|
70
- options.theme_doc_dir = dir
71
- end
72
-
73
- parser.separator ""
74
-
75
- parser.on("--locales [LOC1,LOC2,...]",
76
- _("Specify target locales as [LOC1,LOC2,...]."),
77
- "([#{options.locales.join(', ')}])") do |locales|
78
- options.locales = locales
79
- end
80
- end
81
- end
82
-
83
- def do_generate(options, logger)
84
- require 'rabbit/theme/searcher'
85
-
86
- current_locale = Rabbit::Locale.get
87
-
88
- themes = Rabbit::Theme::Searcher.collect_theme
89
- options.locales.each do |locale|
90
- Rabbit::GetText.locale = current_locale
91
- logger.info(_("Generating documents for locale <%s>...") % locale)
92
- Rabbit::GetText.locale = locale
93
- output_dir = File.join(options.theme_doc_dir, locale)
94
- FileUtils.mkdir_p(output_dir)
95
- themes.each do |theme|
96
- file = File.join(output_dir, "#{theme.name}.rd")
97
- File.open(file, "w") do |f|
98
- f.print(theme.to_rd)
99
- end
100
- end
101
- end
102
- end
103
-
104
- def do_browse(options, logger)
105
- require 'rabbit/theme-browser'
106
-
107
- Rabbit.gui_init
108
-
109
- args = [logger, options.locales, options.startup_theme]
110
- browser = Rabbit::ThemeBrowser.new(*args)
111
- browser.set_window_size(options.width, options.height)
112
- browser.run
113
-
114
- Gtk.main
115
- end
116
-
117
- def main
118
- options, logger = parse
119
-
120
- command = ARGV.first
121
- if command.nil?
122
- command = COMMANDS.first
123
- elsif !COMMANDS.include?(command)
124
- logger.error(_("Unknown command: %s") % command)
125
- logger.info(_("Available commands: %s") % COMMANDS.join(', '))
126
- exit(1)
127
- end
128
- command = command.downcase
129
-
130
- __send__("do_#{command}", options, logger)
131
- end
132
-
133
- main
@@ -1,104 +0,0 @@
1
- require 'gtk2'
2
-
3
- require 'rabbit/rabbit'
4
- require 'rabbit/image'
5
- require 'rabbit/theme/searcher'
6
- require 'rabbit/theme-browser/page'
7
-
8
- module Rabbit
9
- class ThemeBrowser
10
- include GetText
11
-
12
- attr_reader :logger, :themes
13
-
14
- def initialize(logger, locales, startup_theme=nil)
15
- @logger = logger
16
- @locales = locales
17
- @pages = {}
18
- @startup_theme = startup_theme
19
- load_themes
20
- init_gui
21
- end
22
-
23
- def set_window_size(width, height)
24
- @window.set_default_size(width, height)
25
- @pages.each_value do |page|
26
- page.default_size_changed(width, height)
27
- end
28
- end
29
-
30
- def run
31
- Document.load_tag_table(@themes)
32
- @window.show_all
33
- @notebook.page = @init_page_number
34
- page.change_tree(@startup_theme, "theme") if @startup_theme
35
- end
36
-
37
- def load_themes
38
- Theme::Entry.reload_template
39
- @themes = Theme::Searcher.collect_all_theme
40
- end
41
-
42
- def page
43
- current_locale = @locales[@notebook.page]
44
- @pages[current_locale]
45
- end
46
-
47
- private
48
- def init_gui
49
- init_window
50
- current_locale = Locale.get
51
- @init_page_number = 0
52
- @locales.each_with_index do |locale, i|
53
- @init_page_number = i if /#{locale}/ =~ current_locale
54
-
55
- GetText.locale = current_locale
56
- locale_name_for_the_locale = _(locale)
57
- GetText.locale = locale
58
- page = Page.new(self)
59
- @pages[locale] = page
60
- label = Gtk::Label.new(locale_name_for_the_locale)
61
- @notebook.append_page(page.widget, label)
62
- end
63
- end
64
-
65
- def init_window
66
- @window = Gtk::Window.new
67
- @window.signal_connect("destroy") do
68
- Gtk.main_quit
69
- end
70
- @window.signal_connect("key_press_event") do |widget, event|
71
- if event.state.control_mask?
72
- case event.keyval
73
- when Gdk::Keyval::GDK_KEY_q
74
- @window.destroy
75
- when Gdk::Keyval::GDK_KEY_r
76
- page.reload
77
- end
78
- end
79
- false
80
- end
81
- init_icon_list
82
- init_notebook
83
- end
84
-
85
- def init_icon_list
86
- image_theme = Theme::Searcher.find_theme("rabbit-images", true)
87
- file = Theme::Searcher.find_file("lavie-icon.png", [image_theme])
88
- loader = ImageLoader.new(file)
89
- @window.icon_list = [loader.pixbuf]
90
- rescue LoadError
91
- @logger.warn($!)
92
- end
93
-
94
- def init_notebook
95
- @notebook = Gtk::Notebook.new
96
- @notebook.signal_connect("switch-page") do |book, page, n|
97
- @current_locale = @locales[n]
98
- GetText.locale = @current_locale
99
- false
100
- end
101
- @window.add(@notebook)
102
- end
103
- end
104
- end
@@ -1,89 +0,0 @@
1
- body:
2
- size: 10
3
- left-margin: 20
4
- right-margin: 20
5
-
6
- heading1:
7
- weight: bold
8
- pixels-above-lines: 10
9
- pixels-below-lines: 10
10
- left-margin: 5
11
- size: 20
12
-
13
- heading2:
14
- pixels-above-lines: 10
15
- pixels-below-lines: 5
16
- left-margin: 7
17
- size: 17
18
-
19
- heading3:
20
- pixels-above-lines: 10
21
- pixels-below-lines: 3
22
- left-margin: 10
23
- size: 14
24
-
25
- item:
26
- pixels-above-lines: 2
27
- pixels-below-lines: 2
28
-
29
- item-content:
30
-
31
- link:
32
- foreground: blue
33
- underline: single
34
-
35
- code:
36
- family: Monospace
37
- foreground: "#2E8B57"
38
- weight: bold
39
-
40
- variable:
41
- family: Monospace
42
- foreground: "#ab940e"
43
-
44
- description:
45
- pixels-below-lines: 4
46
-
47
- description-term:
48
- family: Monospace
49
- size: 12
50
- weight: bold
51
- pixels-below-lines: 4
52
-
53
- description-content:
54
- left-margin: 30
55
- pixels-below-lines: 8
56
-
57
- parameter:
58
- pixels-below-lines: 4
59
-
60
- parameter-name:
61
- foreground: red
62
- family: Monospace
63
-
64
- parameter-default:
65
- foreground: gray
66
- family: Monospace
67
- style: italic
68
-
69
- parameter-description:
70
- left-margin: 40
71
- right-margin: 40
72
-
73
- paragraph:
74
-
75
- top-level-paragraph:
76
- pixels-above-lines: 5
77
-
78
- verbatim-block:
79
- left-margin: 40
80
- right-margin: 40
81
- background: yellow
82
-
83
- image:
84
- pixels-above-lines: 5
85
- pixels-below-lines: 5
86
-
87
- image-description:
88
- foreground: gray
89
-
@@ -1,200 +0,0 @@
1
- require 'English'
2
- require 'forwardable'
3
-
4
- require 'gtk2'
5
- require "rd/rdfmt"
6
-
7
- require 'rabbit/rabbit'
8
- require 'rabbit/image'
9
- require 'rabbit/theme/searcher'
10
- require 'rabbit/theme-browser/rd2document-lib'
11
-
12
- module Rabbit
13
- class ThemeBrowser
14
- class Document
15
- extend Forwardable
16
- include GetText
17
-
18
- @@tag_table = nil
19
- class << self
20
- def load_tag_table(themes)
21
- @@tag_table = Gtk::TextTagTable.new
22
- theme_infos = themes.collect do |entry|
23
- ["theme-link-#{entry.name}", {}]
24
- end
25
- [theme_infos, Tag::INFOS].each do |infos|
26
- infos.each do |name, properties|
27
- tag = Gtk::TextTag.new(name)
28
- properties.each do |key, value|
29
- tag.set_property(key, value)
30
- end
31
- @@tag_table.add(tag)
32
- end
33
- end
34
- end
35
- end
36
-
37
- def_delegators(:@page, :logger)
38
-
39
- attr_reader :view, :name, :type
40
-
41
- def initialize(page)
42
- @page = page
43
- @name = nil
44
- @type = nil
45
- @hovering = false
46
- @category_buffers = {}
47
- @theme_buffers = {}
48
- load_cursor
49
- init_gui
50
- end
51
-
52
- def change_buffer(name, type)
53
- @name, @type = name, type
54
- __send__("change_to_#{type}_buffer", name)
55
- end
56
-
57
- private
58
- def init_gui
59
- @view = Gtk::TextView.new
60
- @view.wrap_mode = Gtk::TextTag::WRAP_WORD
61
- @view.editable = false
62
- @view.signal_connect("event-after") do |_, *args|
63
- event_after(*args)
64
- end
65
- @view.signal_connect("motion-notify-event") do |_, *args|
66
- motion_notify_event(*args)
67
- end
68
- end
69
-
70
- def load_cursor
71
- @hand_cursor = Gdk::Cursor.new(Gdk::Cursor::HAND2)
72
- @regular_cursor = Gdk::Cursor.new(Gdk::Cursor::XTERM)
73
- end
74
-
75
- def update_buffer(name, buffers)
76
- buffer = buffers[name]
77
- if buffer.nil?
78
- buffer = Gtk::TextBuffer.new(@@tag_table)
79
- buffers[name] = buffer
80
- yield(buffer)
81
- end
82
- @view.buffer = buffer
83
- end
84
-
85
- def rd2document(buffer, iter, source)
86
- tree = RD::RDTree.new("=begin\n#{source}\n=end\n")
87
- visitor = RD2DocumentVisitor.new(buffer, iter, logger)
88
- visitor.visit(tree)
89
- end
90
-
91
- def change_to_category_buffer(name)
92
- update_buffer(name, @category_buffers) do |buffer|
93
- source = "= #{_(name)}\n"
94
- @page.themes.each do |entry|
95
- if entry.category == name
96
- source << " * ((<#{_(entry.title)}|#{entry.name}>))\n"
97
- end
98
- end
99
- iter = buffer.start_iter
100
- rd2document(buffer, iter, source)
101
- end
102
- end
103
-
104
- def change_to_theme_buffer(name)
105
- update_buffer(name, @theme_buffers) do |buffer|
106
- entry = @page.themes.find {|entry| entry.name == name}
107
- iter = buffer.start_iter
108
- rd = entry.to_rd
109
- if entry.image_theme?
110
- rd << "== %s\n" % _("Images")
111
- entry.files.each do |name|
112
- rd << "\n"
113
- rd << "=== #{File.basename(name)}\n"
114
- rd << "\n"
115
- rd << " # image\n"
116
- rd << " # src = file://#{name}\n"
117
- rd << " # keep_ratio = true\n"
118
- rd << " # height = 100\n"
119
- rd << "\n"
120
- end
121
- end
122
- rd2document(buffer, iter, rd)
123
- end
124
- end
125
-
126
- def event_after(event)
127
- unless event.kind_of?(Gdk::EventButton) and
128
- event.button == 1 and
129
- event.event_type == Gdk::Event::BUTTON_RELEASE
130
- return false
131
- end
132
-
133
- buffer = @view.buffer
134
- range = buffer.selection_bounds
135
- if range and range[0].offset != range[1].offset
136
- return false
137
- end
138
-
139
- x, y = view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
140
- event.x, event.y)
141
- iter = @view.get_iter_at_location(x, y)
142
- follow_if_link(iter)
143
- false
144
- end
145
-
146
- def follow_if_link(iter)
147
- iter.tags.each do |tag|
148
- name, type = link_tag_info(tag)
149
- if name and type
150
- @page.change_tree(name, type)
151
- break
152
- end
153
- end
154
- end
155
-
156
- def set_cursor_if_appropriate(x, y)
157
- buffer = @view.buffer
158
- iter = @view.get_iter_at_location(x, y)
159
-
160
- hovering = false
161
-
162
- iter.tags.each do |tag|
163
- if link_tag?(tag)
164
- hovering = true
165
- break
166
- end
167
- end
168
-
169
- if hovering != @hovering
170
- @hovering = hovering
171
- window = @view.get_window(Gtk::TextView::WINDOW_TEXT)
172
- if @hovering
173
- cursor = @hand_cursor
174
- else
175
- cursor = @regular_cursor
176
- end
177
- window.cursor = cursor
178
- end
179
- end
180
-
181
- def motion_notify_event(event)
182
- x, y = @view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET,
183
- event.x, event.y)
184
- set_cursor_if_appropriate(x, y)
185
- @view.window.pointer
186
- false
187
- end
188
-
189
- def link_tag?(tag)
190
- /-?link-?/ =~ tag.name
191
- end
192
-
193
- def link_tag_info(tag)
194
- if /^(theme|category)-link-/ =~ tag.name
195
- [$POSTMATCH, $1]
196
- end
197
- end
198
- end
199
- end
200
- end