mahjong-render 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.ja.md +3 -3
- data/README.md +3 -3
- data/docs/api.md +2 -1
- data/lib/mahjong_render/asciidoctor.rb +8 -2
- data/lib/mahjong_render/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2db0d057ecd91d7f1dcd61f8a0cddb94ebf2f2d185150654fb44ef706d843dca
|
|
4
|
+
data.tar.gz: 767cd4073a98a9713f6919dc8db625ac1002c064ebb2407a1e0bea4abf138610
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ec43b9857f9dc92eef96244d7d8305a6d9bace79e1a27ee69309d07603669be49a4a61f4355c920090860e13aa10bd887a1642017b223cbd02cc124185d5e5e
|
|
7
|
+
data.tar.gz: 96ac7c126a790c7d7a52d69fa85b9a22f55f0ab61720486204722847e4aadabbd2f554c7fccf105a9615b8095f49819567cb8312a60faeea798ee11a0ebcf0c0
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes will be recorded here. Versions follow Semantic Versioning.
|
|
4
4
|
|
|
5
|
+
## 0.2.2 — 2026-09-25
|
|
6
|
+
|
|
7
|
+
- Support standard AsciiDoc block titles on the `mahjong` block macro while continuing to reject unsupported macro attributes.
|
|
8
|
+
|
|
5
9
|
## 0.2.1 — 2026-09-25
|
|
6
10
|
|
|
7
11
|
- Use the GitHub account name `kjun1` in copyright notices and RubyGems author metadata.
|
data/README.ja.md
CHANGED
|
@@ -27,7 +27,7 @@ gem install mahjong-render
|
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
29
|
gem build mahjong-render.gemspec
|
|
30
|
-
gem install --local ./mahjong-render-0.2.
|
|
30
|
+
gem install --local ./mahjong-render-0.2.2.gem
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
インストール後、次のコマンドで `hand.svg` を作成できます。
|
|
@@ -57,7 +57,7 @@ printf '= Mahjong hand\n\nmahjong::405m456p789s12344z[]\n' > hand.adoc
|
|
|
57
57
|
asciidoctor -r mahjong_render/asciidoctor hand.adoc
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
間隔の違う牌列を含む [AsciiDoc の例](examples/basic.adoc) もあります。拡張は HTML5 の block macro
|
|
60
|
+
間隔の違う牌列を含む [AsciiDoc の例](examples/basic.adoc) もあります。拡張は HTML5 の block macro に対応し、macro の直前に置く `.現在の手牌` のような標準 AsciiDoc block title も描画します。macro の `[]` 内に書く属性、inline macro、PDF 出力には対応しません。
|
|
61
61
|
|
|
62
62
|
牌のまとまりを少し離して見せるには、完成したグループの間に `|` を入れます。たとえば `mahjong::123m|456p|789s[]` と書きます。`|` は牌幅の4分の1の空白を追加し、`|(0.25)` と同じ幅です。幅を変える場合は `mahjong::123m|(0.5)456p[]` のように書けます。
|
|
63
63
|
|
|
@@ -92,7 +92,7 @@ devcontainer、または保証対象の MRI Ruby・Bundler・`rsvg-convert` を
|
|
|
92
92
|
bundle install
|
|
93
93
|
bundle exec rake lint test assets:check licenses:check example:build
|
|
94
94
|
gem build mahjong-render.gemspec
|
|
95
|
-
ruby script/check_package.rb mahjong-render-0.2.
|
|
95
|
+
ruby script/check_package.rb mahjong-render-0.2.2.gem
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
設計の経緯は [既存ライブラリの調査](docs/research/existing-renderers.md) と [ADR](docs/adr/) に記録しています。
|
data/README.md
CHANGED
|
@@ -29,7 +29,7 @@ To install a build from a local checkout:
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
gem build mahjong-render.gemspec
|
|
32
|
-
gem install --local ./mahjong-render-0.2.
|
|
32
|
+
gem install --local ./mahjong-render-0.2.2.gem
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Render a hand from the command line or from Ruby:
|
|
@@ -61,7 +61,7 @@ See [the complete AsciiDoc example](examples/basic.adoc) for hands with and with
|
|
|
61
61
|
|
|
62
62
|
To show separate groups, insert `|` between complete tile groups: `mahjong::123m|456p|789s[]`. Each `|` adds a quarter tile width of empty space, the same as `|(0.25)`. Use `|(0.5)` for half a tile width or `|(1)` for a full tile width, for example `mahjong::123m|(0.5)456p[]`.
|
|
63
63
|
|
|
64
|
-
The adapter supports the HTML5 backend.
|
|
64
|
+
The adapter supports the HTML5 backend and standard AsciiDoc block titles such as `.Current hand` immediately before the macro. Attributes written inside the macro's `[]`, inline macros, and PDF output are unsupported. The Ruby rendering API does not load Asciidoctor.
|
|
65
65
|
|
|
66
66
|
## Supported notation
|
|
67
67
|
|
|
@@ -106,7 +106,7 @@ Open this repository in a devcontainer, or use a supported MRI Ruby with Bundler
|
|
|
106
106
|
bundle install
|
|
107
107
|
bundle exec rake lint test assets:check licenses:check example:build
|
|
108
108
|
gem build mahjong-render.gemspec
|
|
109
|
-
ruby script/check_package.rb mahjong-render-0.2.
|
|
109
|
+
ruby script/check_package.rb mahjong-render-0.2.2.gem
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
The example HTML is written to `tmp/basic.html`. The test suite rasterizes a sample SVG to confirm the embedded vector artwork renders.
|
data/docs/api.md
CHANGED
|
@@ -16,7 +16,8 @@ Invalid notation raises `MahjongRender::NotationError`. Its `token` reader ident
|
|
|
16
16
|
Install Ruby Asciidoctor 2.x separately and load `mahjong_render/asciidoctor` to register the `mahjong` block macro:
|
|
17
17
|
|
|
18
18
|
```asciidoc
|
|
19
|
+
.Current hand
|
|
19
20
|
mahjong::405m456p789s12344z[]
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
The adapter supports the HTML5 backend. It raises `MahjongRender::UnsupportedBackendError` for other backends and `MahjongRender::UnsupportedAttributeError` for macro
|
|
23
|
+
Standard AsciiDoc block titles (`.Title` on the line before the macro) are supported and rendered above the tiles. The adapter supports the HTML5 backend. It raises `MahjongRender::UnsupportedBackendError` for other backends and `MahjongRender::UnsupportedAttributeError` for attributes written inside the macro's `[]`. Invalid notation raises `MahjongRender::NotationError`. Inline macros and PDF output are unsupported. Loading `mahjong_render` alone does not load Asciidoctor.
|
|
@@ -18,10 +18,16 @@ module MahjongRender
|
|
|
18
18
|
|
|
19
19
|
def process(parent, target, attrs)
|
|
20
20
|
raise UnsupportedBackendError, "mahjong block macro supports HTML output only" unless parent.document.basebackend?("html")
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
unsupported_attrs = attrs.keys - ["title"]
|
|
23
|
+
unless unsupported_attrs.empty?
|
|
24
|
+
message = "mahjong block macro does not support attributes: #{unsupported_attrs.join(', ')}"
|
|
25
|
+
raise UnsupportedAttributeError, message
|
|
26
|
+
end
|
|
22
27
|
|
|
23
28
|
svg = MahjongRender.render(target)
|
|
24
|
-
|
|
29
|
+
title_html = attrs.key?("title") ? %(<div class="title">#{attrs['title']}</div>\n) : ""
|
|
30
|
+
create_pass_block(parent, %(<div class="mahjong-render">#{title_html}#{svg}</div>), attrs, subs: nil)
|
|
25
31
|
end
|
|
26
32
|
end
|
|
27
33
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mahjong-render
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kjun1
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-09-
|
|
10
|
+
date: 2026-09-25 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logger
|
|
@@ -98,10 +98,10 @@ licenses:
|
|
|
98
98
|
- Apache-2.0
|
|
99
99
|
- CC0-1.0
|
|
100
100
|
metadata:
|
|
101
|
-
source_code_uri: https://github.com/kjun1/mahjong-render/tree/v0.2.
|
|
102
|
-
changelog_uri: https://github.com/kjun1/mahjong-render/blob/v0.2.
|
|
101
|
+
source_code_uri: https://github.com/kjun1/mahjong-render/tree/v0.2.2
|
|
102
|
+
changelog_uri: https://github.com/kjun1/mahjong-render/blob/v0.2.2/CHANGELOG.md
|
|
103
103
|
bug_tracker_uri: https://github.com/kjun1/mahjong-render/issues
|
|
104
|
-
documentation_uri: https://github.com/kjun1/mahjong-render/blob/v0.2.
|
|
104
|
+
documentation_uri: https://github.com/kjun1/mahjong-render/blob/v0.2.2/docs/api.md
|
|
105
105
|
rubygems_mfa_required: 'true'
|
|
106
106
|
rdoc_options: []
|
|
107
107
|
require_paths:
|