rabbit 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -1
- data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
- data/doc/_config.yml +2 -2
- data/doc/_layouts/skeleton.html +0 -7
- data/doc/en/install/homebrew.rd +8 -13
- data/doc/en/news.rd +67 -0
- data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/en/blue-circle.png +0 -0
- data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/en/clear-blue.png +0 -0
- data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/en/cozmixng.png +0 -0
- data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/en/dark-gradation.png +0 -0
- data/doc/images/screenshots/en/day-white-raw.png +0 -0
- data/doc/images/screenshots/en/day-white.png +0 -0
- data/doc/images/screenshots/en/debian-raw.png +0 -0
- data/doc/images/screenshots/en/debian.png +0 -0
- data/doc/images/screenshots/en/green-circle-raw.png +0 -0
- data/doc/images/screenshots/en/green-circle.png +0 -0
- data/doc/images/screenshots/en/night-black-raw.png +0 -0
- data/doc/images/screenshots/en/night-black.png +0 -0
- data/doc/images/screenshots/en/rabbit-raw.png +0 -0
- data/doc/images/screenshots/en/rabbit.png +0 -0
- data/doc/images/screenshots/en/ranguba-raw.png +0 -0
- data/doc/images/screenshots/en/ranguba.png +0 -0
- data/doc/images/screenshots/en/red-frame-raw.png +0 -0
- data/doc/images/screenshots/en/red-frame.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
- data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/blue-circle.png +0 -0
- data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/ja/clear-blue.png +0 -0
- data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/ja/cozmixng.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation.png +0 -0
- data/doc/images/screenshots/ja/day-white-raw.png +0 -0
- data/doc/images/screenshots/ja/day-white.png +0 -0
- data/doc/images/screenshots/ja/debian-raw.png +0 -0
- data/doc/images/screenshots/ja/debian.png +0 -0
- data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/green-circle.png +0 -0
- data/doc/images/screenshots/ja/night-black-raw.png +0 -0
- data/doc/images/screenshots/ja/night-black.png +0 -0
- data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
- data/doc/images/screenshots/ja/rabbit.png +0 -0
- data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
- data/doc/images/screenshots/ja/ranguba.png +0 -0
- data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
- data/doc/images/screenshots/ja/red-frame.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
- data/doc/ja/install/homebrew.rd +8 -12
- data/doc/ja/news.rd +67 -0
- data/lib/rabbit/canvas.rb +7 -5
- data/lib/rabbit/element/base.rb +1 -5
- data/lib/rabbit/element/image.rb +70 -4
- data/lib/rabbit/error.rb +7 -1
- data/lib/rabbit/formatter.rb +1 -1
- data/lib/rabbit/gem-pusher.rb +2 -1
- data/lib/rabbit/image/base.rb +67 -3
- data/lib/rabbit/image/dia.rb +7 -15
- data/lib/rabbit/image/mermaid.rb +73 -0
- data/lib/rabbit/image/pdf.rb +21 -5
- data/lib/rabbit/image.rb +3 -2
- data/lib/rabbit/parser/base.rb +2 -1
- data/lib/rabbit/parser/ext/blockdiag.rb +16 -14
- data/lib/rabbit/parser/ext/image.rb +36 -9
- data/lib/rabbit/parser/markdown/converter.rb +36 -30
- data/lib/rabbit/parser/rd/ext/block-verbatim.rb +23 -33
- data/lib/rabbit/parser/rd/ext/image.rb +23 -4
- data/lib/rabbit/parser/rd/rd2rabbit-lib.rb +3 -1
- data/lib/rabbit/parser/rd.rb +1 -1
- data/lib/rabbit/parser/wiki/output.rb +9 -9
- data/lib/rabbit/parser.rb +2 -2
- data/lib/rabbit/properties.rb +14 -1
- data/lib/rabbit/renderer/display/drawing-area-base.rb +1 -1
- data/lib/rabbit/slide-configuration.rb +4 -0
- data/lib/rabbit/task/slide.rb +4 -31
- data/lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb +38 -0
- data/lib/rabbit/theme/clear-blue/clear-blue.rb +1 -1
- data/lib/rabbit/theme/image/image.rb +3 -0
- data/lib/rabbit/theme/image-slide-number/image-slide-number.rb +7 -2
- data/lib/rabbit/theme/image-timer/image-timer.rb +8 -3
- data/lib/rabbit/theme/pdf/pdf.rb +1 -1
- data/lib/rabbit/utils.rb +25 -2
- data/lib/rabbit/version.rb +2 -2
- data/po/en/rabbit.edit.po +50 -66
- data/po/en/rabbit.po +12 -24
- data/po/fr/rabbit.edit.po +50 -66
- data/po/fr/rabbit.po +12 -24
- data/po/ja/rabbit.edit.po +82 -94
- data/po/ja/rabbit.po +18 -30
- data/rabbit.gemspec +0 -1
- data/sample/rabbit-en.md +13 -0
- data/sample/rabbit-en.rd +10 -0
- data/sample/rabbit.md +21 -0
- data/sample/rabbit.rd +20 -0
- data/test/command/test-rabbit.rb +1 -0
- data/test/parser/test-markdown.rb +2 -2
- data/test/test-slide-configuration.rb +2 -1
- metadata +7 -26
- data/doc/css/jquery-ui/themes/ui-lightness.css +0 -573
- data/doc/javascripts/jquery-ui.js +0 -11544
- data/doc/javascripts/jquery.js +0 -7179
- data/lib/rabbit/slideshare.rb +0 -192
- data/test/test-slideshare.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc7a134517bbe5f63d57298ef2843ca3acddbe99a995b7f41ba179a94ef1a97
|
4
|
+
data.tar.gz: 30b19d488840c4db1056eb8108c4b0581ebdcf486da9386d22669cc04730758e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e0421868ffce5e36d65b0260999808b898b16152e2d9e7be4db94633922c80d37b89ca4a24494f77aa0f508e2186208c7bd23abebb1ff06ff83a31117291b2
|
7
|
+
data.tar.gz: 42766ca67a7e70a5b5c31ffeafae3aaab515be534a1a97fe977da864d42781e6700562d643c47ec34af6ad991352c9ff2386ee52967ff7c8a63ce83bb377915f
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2008-
|
3
|
+
# Copyright (C) 2008-2023 Kouhei Sutou <kou@cozmixng.org>
|
4
4
|
#
|
5
5
|
# This program is free software; you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU General Public License as published by
|
@@ -58,6 +58,7 @@ end
|
|
58
58
|
GetText::Tools::Task.define do |task|
|
59
59
|
task.spec = spec
|
60
60
|
task.files -= Dir.glob("sample/**/*.*")
|
61
|
+
task.files -= Dir.glob("test/**/*.*")
|
61
62
|
task.mo_base_directory = "data/locale"
|
62
63
|
end
|
63
64
|
|
Binary file
|
data/doc/_config.yml
CHANGED
data/doc/_layouts/skeleton.html
CHANGED
@@ -7,8 +7,6 @@
|
|
7
7
|
<link rel="shortcut icon" href="/favicon.ico"
|
8
8
|
type="image/vnd.microsfot.icon">
|
9
9
|
<link rel="icon" href="/favicon.png" type="image/png">
|
10
|
-
<link rel="stylesheet" href="/css/jquery-ui/themes/ui-lightness.css"
|
11
|
-
type="text/css">
|
12
10
|
<link rel="stylesheet" href="/css/syntax.css" type="text/css">
|
13
11
|
<link rel="stylesheet" href="/css/rabbit.css" type="text/css">
|
14
12
|
<meta property="fb:page_id" content="rabbit.shocker">
|
@@ -17,11 +15,6 @@
|
|
17
15
|
<meta property="og:image"
|
18
16
|
content="http://rabbit-shocker.org/images/lavie.png">
|
19
17
|
<meta property="og:site_name" content="Rabbit">
|
20
|
-
<script type="text/javascript" src="/javascripts/jquery.js"></script>
|
21
|
-
<script type="text/javascript" src="/javascripts/jquery-ui.js"></script>
|
22
|
-
<!--[if lt IE 9]>
|
23
|
-
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
24
|
-
<![endif]-->
|
25
18
|
<script>
|
26
19
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
27
20
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
data/doc/en/install/homebrew.rd
CHANGED
@@ -2,38 +2,33 @@
|
|
2
2
|
layout: en
|
3
3
|
title: Install with Homebrew
|
4
4
|
---
|
5
|
-
== How to install Rabbit with Homebrew on
|
5
|
+
== How to install Rabbit with Homebrew on macOS
|
6
6
|
|
7
|
-
This document describes how to install Rabbit with Homebrew and RubyGems on
|
7
|
+
This document describes how to install Rabbit with Homebrew and RubyGems on macOS.
|
8
8
|
|
9
9
|
=== Requirements
|
10
10
|
|
11
|
-
*
|
12
|
-
* OS X Leopard or higher
|
11
|
+
* A macOS machine
|
13
12
|
* Xcode with X11 (XQuartz is required)
|
14
13
|
|
15
14
|
=== Install Homebrew
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
Then add /usr/local/bin to your PATH.
|
16
|
+
Follow the instruction on ((<URL:https://brew.sh>)).
|
20
17
|
|
21
18
|
=== Install softwares Rabbit needs
|
22
19
|
|
23
20
|
$ brew install cairo
|
24
|
-
$ brew link cairo
|
25
|
-
$ brew link --overwrite pixman
|
26
21
|
$ brew install pango
|
27
22
|
$ brew install gtk+
|
28
|
-
$ brew install
|
29
|
-
$ brew install
|
23
|
+
$ brew install gobject-introspection
|
24
|
+
$ brew install poppler
|
30
25
|
|
31
26
|
=== Install Rabbit
|
32
27
|
|
33
28
|
Exec gem install.
|
34
29
|
|
35
|
-
$
|
36
|
-
$
|
30
|
+
$ gem install rabbit
|
31
|
+
$ gem install rabbiter # If you want to use Twitter related features
|
37
32
|
|
38
33
|
=== Set environment variable
|
39
34
|
|
data/doc/en/news.rd
CHANGED
@@ -4,6 +4,73 @@ title: News
|
|
4
4
|
---
|
5
5
|
{% raw %}
|
6
6
|
|
7
|
+
== 3.0.2: 2023-06-25
|
8
|
+
|
9
|
+
Image drawing support release.
|
10
|
+
|
11
|
+
=== Improvements
|
12
|
+
|
13
|
+
==== rabbit
|
14
|
+
|
15
|
+
* image: Added support for drawing on image.
|
16
|
+
|
17
|
+
* image: Added support for (({align=right})).
|
18
|
+
|
19
|
+
* Added support for Mermaid.
|
20
|
+
|
21
|
+
* blockdiag: Added support for (({blockdiag3})) command.
|
22
|
+
|
23
|
+
==== rabbit-slide
|
24
|
+
|
25
|
+
* config: Added (({source_code_uri})).
|
26
|
+
((<GH-144|URL:https://github.com/rabbit-shocker/rabbit/issues/144>))
|
27
|
+
[Patch by Yusuke Nakamura]
|
28
|
+
|
29
|
+
* Dropped support for uploading to SlideShare. Because SlideShare
|
30
|
+
API dropped support for uploading a slideshow.
|
31
|
+
|
32
|
+
==== Theme
|
33
|
+
|
34
|
+
* image-slide-number: Changed to render images back to the main
|
35
|
+
content. It prevents hiding the main content.
|
36
|
+
|
37
|
+
* image-timer: Changed to render images back to the main
|
38
|
+
content. It prevents hiding the main content.
|
39
|
+
|
40
|
+
* background-image-toolkit: Added support for caption.
|
41
|
+
|
42
|
+
* clear-blue: Changed to replace (({\n})) with a space character
|
43
|
+
instead of just removing it in footer.
|
44
|
+
|
45
|
+
* pdf: Changed to use (({./theme.rb})) instead of (({canvas.title}))
|
46
|
+
theme by default.
|
47
|
+
|
48
|
+
==== Document
|
49
|
+
|
50
|
+
* macos Homebrew: Updated how to install document.
|
51
|
+
((<GH-150|URL:https://github.com/rabbit-shocker/rabbit/issues/150>))
|
52
|
+
[Patch by Yusuke Nakamura]
|
53
|
+
|
54
|
+
=== Fixes
|
55
|
+
|
56
|
+
==== rabbit
|
57
|
+
|
58
|
+
* formatter HTML: Fixed a bug that weight configuration is missing.
|
59
|
+
((<GH-146|URL:https://github.com/rabbit-shocker/rabbit/issues/146>))
|
60
|
+
[Patch by HASUMI Hitoshi]
|
61
|
+
|
62
|
+
==== Theme
|
63
|
+
|
64
|
+
* image-timer: Fixed a bug that images aren't showed with PDF.
|
65
|
+
|
66
|
+
* image-slide-number: Fixed a bug that images aren't showed with PDF.
|
67
|
+
|
68
|
+
=== Thanks
|
69
|
+
|
70
|
+
* Yusuke Nakamura
|
71
|
+
|
72
|
+
* HASUMI Hitoshi
|
73
|
+
|
7
74
|
== 3.0.1: 2021-09-25
|
8
75
|
|
9
76
|
Ruby 3.0 support release.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/ja/install/homebrew.rd
CHANGED
@@ -2,37 +2,33 @@
|
|
2
2
|
layout: ja
|
3
3
|
title: Homebrewでインストール
|
4
4
|
---
|
5
|
-
==
|
5
|
+
== macOSでHomebrewを使ったインストール方法
|
6
6
|
|
7
|
-
|
7
|
+
macOS のパッケージ管理システムのひとつである Homebrew と RubyGems を利用して
|
8
8
|
Rabbit をインストール、利用する手順について説明します。
|
9
9
|
|
10
10
|
=== 事前に準備するもの
|
11
11
|
|
12
|
-
*
|
13
|
-
* Mac OS X Leopard 以上
|
12
|
+
* macOS
|
14
13
|
* Xcode と X11(XQuartzをインストール)
|
15
14
|
|
16
15
|
=== Homebrew のインストール
|
17
16
|
|
18
|
-
|
17
|
+
((<URL:https://brew.sh/>)) に記載の方法に従ってインストールしてください。
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
==== brew install と brew link の実行
|
19
|
+
==== brew install の実行
|
23
20
|
|
24
21
|
$ brew install cairo
|
25
|
-
$ brew link cairo
|
26
|
-
$ brew link --overwrite pixman
|
27
22
|
$ brew install pango
|
28
23
|
$ brew install gtk+
|
29
|
-
$ brew install
|
24
|
+
$ brew install gobject-introspection
|
25
|
+
$ brew install poppler
|
30
26
|
|
31
27
|
=== Rabbit のインストール
|
32
28
|
|
33
29
|
gem install を実行します。
|
34
30
|
|
35
|
-
$ sudo
|
31
|
+
$ sudo gem install rabbit
|
36
32
|
$ sudo gem install rabbiter # Twitter連携機能を使う場合
|
37
33
|
|
38
34
|
=== 環境変数の設定
|
data/doc/ja/news.rd
CHANGED
@@ -5,6 +5,73 @@ apply_data: false
|
|
5
5
|
---
|
6
6
|
{% raw %}
|
7
7
|
|
8
|
+
== 3.0.2: 2023-06-25
|
9
|
+
|
10
|
+
画像への描画をサポートしたリリース。
|
11
|
+
|
12
|
+
=== 改良
|
13
|
+
|
14
|
+
==== rabbit
|
15
|
+
|
16
|
+
* image: 画像への描画をサポート。
|
17
|
+
|
18
|
+
* image: (({align=right}))をサポート。
|
19
|
+
|
20
|
+
* Mermaidをサポート。
|
21
|
+
|
22
|
+
* blockdiag: (({blockdiag3}))コマンドをサポート。
|
23
|
+
|
24
|
+
==== rabbit-slide
|
25
|
+
|
26
|
+
* config: (({source_code_uri}))を追加。
|
27
|
+
((<GH-144|URL:https://github.com/rabbit-shocker/rabbit/issues/144>))
|
28
|
+
[Yusuke Nakamuraさんがパッチ提供]
|
29
|
+
|
30
|
+
* SlideShareへのアップロード機能を削除。これはSlideShareのAPIからス
|
31
|
+
ライドアップロード機能が削除されたからです。
|
32
|
+
|
33
|
+
==== テーマ
|
34
|
+
|
35
|
+
* image-slide-number: メインコンテンツの後ろに画像を描画するように変
|
36
|
+
更。これによりメインコンテンツを隠すことがなくなります。
|
37
|
+
|
38
|
+
* image-timer: メインコンテンツの後ろに画像を描画するように変更。こ
|
39
|
+
れによりメインコンテンツを隠すことがなくなります。
|
40
|
+
|
41
|
+
* background-image-toolkit: キャプションをサポート。
|
42
|
+
|
43
|
+
* clear-blue: フッターの(({\n}))を削除するのではなく空白文字に置換す
|
44
|
+
るように変更。
|
45
|
+
|
46
|
+
* pdf: デフォルトで(({canvas.title}))テーマではなく(({./theme.rb}))
|
47
|
+
テーマを使うように変更。
|
48
|
+
|
49
|
+
==== ドキュメント
|
50
|
+
|
51
|
+
* macos Homebrew: インストールドキュメントを更新。
|
52
|
+
((<GH-150|URL:https://github.com/rabbit-shocker/rabbit/issues/150>))
|
53
|
+
[Yusuke Nakamuraさんがパッチ提供]
|
54
|
+
|
55
|
+
=== 修正
|
56
|
+
|
57
|
+
==== rabbit
|
58
|
+
|
59
|
+
* formatter HTML: 重みの設定が反映されない問題を修正。
|
60
|
+
((<GH-146|URL:https://github.com/rabbit-shocker/rabbit/issues/146>))
|
61
|
+
[HASUMI Hitoshiさんがパッチ提供]
|
62
|
+
|
63
|
+
==== テーマ
|
64
|
+
|
65
|
+
* image-timer: PDFで画像が表示されない問題を修正。
|
66
|
+
|
67
|
+
* image-slide-number: PDFで画像が表示されない問題を修正。
|
68
|
+
|
69
|
+
=== 感謝
|
70
|
+
|
71
|
+
* Yusuke Nakamuraさん
|
72
|
+
|
73
|
+
* HASUMI Hitoshiさん
|
74
|
+
|
8
75
|
== 3.0.1: 2021-09-25
|
9
76
|
|
10
77
|
Ruby 3.0をサポートしたリリース。
|
data/lib/rabbit/canvas.rb
CHANGED
@@ -83,6 +83,8 @@ module Rabbit
|
|
83
83
|
def_delegators(:@renderer, :shear_context)
|
84
84
|
def_delegators(:@renderer, :save_context, :restore_context)
|
85
85
|
def_delegators(:@renderer, :draw_line, :draw_rectangle, :draw_arc)
|
86
|
+
def_delegators(:@renderer, :draw_lines)
|
87
|
+
def_delegators(:@renderer, :draw_polygon)
|
86
88
|
def_delegators(:@renderer, :draw_circle, :draw_layout, :draw_pixbuf)
|
87
89
|
def_delegators(:@renderer, :draw_arc_by_radius, :draw_circle_by_radius)
|
88
90
|
def_delegators(:@renderer, :draw_slide, :draw_polygon, :draw_flag)
|
@@ -345,7 +347,7 @@ module Rabbit
|
|
345
347
|
apply_theme(@theme_name, &block)
|
346
348
|
end
|
347
349
|
|
348
|
-
def parse(source=nil,
|
350
|
+
def parse(source=nil, progress=nil, &block)
|
349
351
|
id = Object.new.__id__
|
350
352
|
@parse_request_queue.push(id)
|
351
353
|
@source = source || @source
|
@@ -355,7 +357,7 @@ module Rabbit
|
|
355
357
|
keep_index do
|
356
358
|
@renderer.pre_parse
|
357
359
|
clear
|
358
|
-
Parser.parse(self, @source)
|
360
|
+
Parser.parse(self, @source, progress: progress)
|
359
361
|
new_allotted_time = allotted_time
|
360
362
|
reset_timer if new_allotted_time != current_allotted_time
|
361
363
|
apply_timer
|
@@ -364,7 +366,7 @@ module Rabbit
|
|
364
366
|
if @parse_request_queue.last != id
|
365
367
|
raise ParseFinish
|
366
368
|
end
|
367
|
-
|
369
|
+
progress.call if progress
|
368
370
|
end
|
369
371
|
@renderer.post_parse
|
370
372
|
index = current_index
|
@@ -382,9 +384,9 @@ module Rabbit
|
|
382
384
|
end
|
383
385
|
end
|
384
386
|
|
385
|
-
def reload_source(
|
387
|
+
def reload_source(progress=nil, &block)
|
386
388
|
if need_reload_source?
|
387
|
-
parse(nil,
|
389
|
+
parse(nil, progress, &block)
|
388
390
|
end
|
389
391
|
end
|
390
392
|
|
data/lib/rabbit/element/base.rb
CHANGED
@@ -430,11 +430,7 @@ module Rabbit
|
|
430
430
|
|
431
431
|
def make_prop_value(name, *values)
|
432
432
|
formatter_name = to_class_name(name)
|
433
|
-
|
434
|
-
unless Format.const_defined?(formatter_name)
|
435
|
-
raise NameError
|
436
|
-
end
|
437
|
-
rescue NameError
|
433
|
+
unless Format.const_defined?(formatter_name)
|
438
434
|
raise UnknownPropertyError.new(name)
|
439
435
|
end
|
440
436
|
Format.const_get(formatter_name).new(*values)
|
data/lib/rabbit/element/image.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2004-
|
1
|
+
# Copyright (C) 2004-2021 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -29,21 +29,27 @@ module Rabbit
|
|
29
29
|
alias image_draw draw
|
30
30
|
alias draw element_draw
|
31
31
|
|
32
|
-
def initialize(filename, props)
|
33
|
-
super(filename, props)
|
32
|
+
def initialize(filename, props, canvas: nil)
|
33
|
+
super(filename, props, canvas: canvas)
|
34
34
|
setup_draw_parameters
|
35
35
|
resize(properties.get_size("width", @filename),
|
36
36
|
properties.get_size("height", @filename))
|
37
37
|
end
|
38
38
|
|
39
39
|
def draw_element(canvas, x, y, w, h, simulation)
|
40
|
-
draw_image(canvas, x, y, w, h, simulation)
|
40
|
+
result = draw_image(canvas, x, y, w, h, simulation)
|
41
|
+
draw_properties(canvas, x, y, w, h) unless simulation
|
42
|
+
result
|
41
43
|
end
|
42
44
|
|
43
45
|
def caption
|
44
46
|
self["caption"]
|
45
47
|
end
|
46
48
|
|
49
|
+
def caption_font_size
|
50
|
+
properties.get_float("caption-font-size")
|
51
|
+
end
|
52
|
+
|
47
53
|
def text
|
48
54
|
caption.to_s
|
49
55
|
end
|
@@ -113,10 +119,12 @@ module Rabbit
|
|
113
119
|
adjust_size(canvas, @x, @y, @w, @h)
|
114
120
|
end
|
115
121
|
|
122
|
+
alias_method :width_without_padding, :width
|
116
123
|
def width
|
117
124
|
super + @padding_left + @padding_right
|
118
125
|
end
|
119
126
|
|
127
|
+
alias_method :height_without_padding, :height
|
120
128
|
def height
|
121
129
|
super + @padding_top + @padding_bottom
|
122
130
|
end
|
@@ -191,6 +199,64 @@ module Rabbit
|
|
191
199
|
end
|
192
200
|
resize(iw, ih)
|
193
201
|
end
|
202
|
+
|
203
|
+
def draw_properties(canvas, base_x, base_y, base_w, base_h)
|
204
|
+
properties.draws.each do |type, *args|
|
205
|
+
case type
|
206
|
+
when "line"
|
207
|
+
if args.last.is_a?(Hash)
|
208
|
+
params = args.pop
|
209
|
+
else
|
210
|
+
params = nil
|
211
|
+
end
|
212
|
+
points = args.each_slice(2).collect do |x, y|
|
213
|
+
x = (x * width_without_padding) + base_x
|
214
|
+
y = (y * height_without_padding) + base_y
|
215
|
+
[x, y]
|
216
|
+
end
|
217
|
+
params = normalize_params(params)
|
218
|
+
color = params.delete(:color) || "black"
|
219
|
+
canvas.draw_lines(points, color, params)
|
220
|
+
when "rectangle"
|
221
|
+
filled, x, y, w, h, params = args
|
222
|
+
x = (x * width_without_padding) + base_x
|
223
|
+
y = (y * height_without_padding) + base_y
|
224
|
+
w = (w * width_without_padding)
|
225
|
+
h = (h * height_without_padding)
|
226
|
+
params = normalize_params(params)
|
227
|
+
color = params.delete(:color) || "black"
|
228
|
+
canvas.draw_rectangle(filled, x, y, w, h, color, params)
|
229
|
+
when "text"
|
230
|
+
text, x, y, params = args
|
231
|
+
params = normalize_params(params)
|
232
|
+
layout = canvas.make_layout(markup_text(text, params))
|
233
|
+
x = (x * width_without_padding) + base_x
|
234
|
+
y = (y * height_without_padding) + base_y
|
235
|
+
color = params.delete(:color) || "black"
|
236
|
+
canvas.draw_layout(layout, x, y, color, params)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def normalize_params(params)
|
242
|
+
return {} if params.nil?
|
243
|
+
normalized_params = {}
|
244
|
+
params.each do |key, value|
|
245
|
+
normalized_params[key.to_sym] = value
|
246
|
+
end
|
247
|
+
normalized_params
|
248
|
+
end
|
249
|
+
|
250
|
+
def markup_text(text, props)
|
251
|
+
props.each do |name, value|
|
252
|
+
formatter_name = Utils.to_class_name(name.to_s)
|
253
|
+
next unless Format.const_defined?(formatter_name)
|
254
|
+
formatter = Format.const_get(formatter_name).new(value)
|
255
|
+
next unless formatter.text_formatter?
|
256
|
+
text = formatter.format(text)
|
257
|
+
end
|
258
|
+
text
|
259
|
+
end
|
194
260
|
end
|
195
261
|
end
|
196
262
|
end
|
data/lib/rabbit/error.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2004-
|
1
|
+
# Copyright (C) 2004-2022 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -87,6 +87,12 @@ module Rabbit
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
class MermaidCanNotHandleError < ImageLoadWithExternalCommandError
|
91
|
+
def initialize(command, additional_info=nil)
|
92
|
+
super("Mermaid", command, additional_info)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
90
96
|
class UnknownPropertyError < Error
|
91
97
|
attr_reader :name
|
92
98
|
def initialize(name)
|
data/lib/rabbit/formatter.rb
CHANGED
data/lib/rabbit/gem-pusher.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016-
|
1
|
+
# Copyright (C) 2016-2023 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -41,6 +41,7 @@ module Rabbit
|
|
41
41
|
end
|
42
42
|
unless credentials.key?(@user.to_sym)
|
43
43
|
credentials[@user.to_sym] = retrieve_api_key
|
44
|
+
FileUtils.mkdir_p(File.dirname(credentials_path))
|
44
45
|
File.open(credentials_path, "w") do |credentials_file|
|
45
46
|
credentials_file.print(credentials.to_yaml)
|
46
47
|
end
|