mahjong-render 0.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5e93bafb0b2789bd005ed63c6c1b1b02a2e052d87b4c4c385757f821729460c
4
- data.tar.gz: f347f1ef8b53de1e2afc250b6b0919b074cd1fe6a29c7f42d88ddb034a99cbf0
3
+ metadata.gz: 2db0d057ecd91d7f1dcd61f8a0cddb94ebf2f2d185150654fb44ef706d843dca
4
+ data.tar.gz: 767cd4073a98a9713f6919dc8db625ac1002c064ebb2407a1e0bea4abf138610
5
5
  SHA512:
6
- metadata.gz: 2ed01dfba38486941085479c4202fe35f67afa10886ef0b77400eaa3595fd15582fd0ce39acb90d3233f08a6b9fd2f528afe56423bc0f3b4b62a1a66fe6decd8
7
- data.tar.gz: 134c8fd5c77e08d36a34995e1f89f4cba6621063f40ba87392a9dd0bc5b10aa397324bbe09daaa661e804bc35726017648e488b216f44b68596bc4bae25b2899
6
+ metadata.gz: 3ec43b9857f9dc92eef96244d7d8305a6d9bace79e1a27ee69309d07603669be49a4a61f4355c920090860e13aa10bd887a1642017b223cbd02cc124185d5e5e
7
+ data.tar.gz: 96ac7c126a790c7d7a52d69fa85b9a22f55f0ab61720486204722847e4aadabbd2f554c7fccf105a9615b8095f49819567cb8312a60faeea798ee11a0ebcf0c0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
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
+
9
+ ## 0.2.1 — 2026-09-25
10
+
11
+ - Use the GitHub account name `kjun1` in copyright notices and RubyGems author metadata.
12
+
5
13
  ## 0.2.0 — 2026-09-24
6
14
 
7
15
  - Require MRI Ruby 3.3 or newer and test 3.3, 3.4, and 4.0; Ruby 3.2 is no longer supported.
data/README.ja.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mahjong-render
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/mahjong-render.svg)](https://badge.fury.io/rb/mahjong-render)
3
+ [![Gem Version](https://badge.fury.io/rb/mahjong-render.svg?icon=si%3Arubygems)](https://rubygems.org/gems/mahjong-render)
4
4
  [![CI](https://github.com/kjun1/mahjong-render/actions/workflows/ci.yml/badge.svg)](https://github.com/kjun1/mahjong-render/actions/workflows/ci.yml)
5
5
 
6
6
  [English README](README.md)
@@ -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.0.gem
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 に対応します。macro 属性、inline macro、PDF 出力には対応しません。
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,10 +92,10 @@ 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.0.gem
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/) に記録しています。
99
99
  [公開手順](docs/release.md) には、タグから起動する Trusted Publishing の手順を記載しています。
100
100
 
101
- Copyright 2026 Maejima Kenya。Ruby コードとテキスト文書には [Apache-2.0](LICENSE) を適用します。同梱の牌画像と [README のプレビュー](examples/hand.png) は CC0-1.0 です。牌画像は [FluffyStuff/riichi-mahjong-tiles](https://github.com/FluffyStuff/riichi-mahjong-tiles) から採用しました。詳細は [第三者素材の告知](THIRD_PARTY_NOTICES.md)、[素材マニフェスト](assets/manifest.json)、[CC0 のライセンス本文](LICENSES/CC0-1.0.txt) を参照してください。
101
+ Copyright 2026 kjun1。Ruby コードとテキスト文書には [Apache-2.0](LICENSE) を適用します。同梱の牌画像と [README のプレビュー](examples/hand.png) は CC0-1.0 です。牌画像は [FluffyStuff/riichi-mahjong-tiles](https://github.com/FluffyStuff/riichi-mahjong-tiles) から採用しました。詳細は [第三者素材の告知](THIRD_PARTY_NOTICES.md)、[素材マニフェスト](assets/manifest.json)、[CC0 のライセンス本文](LICENSES/CC0-1.0.txt) を参照してください。
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mahjong-render
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/mahjong-render.svg)](https://badge.fury.io/rb/mahjong-render)
3
+ [![Gem Version](https://badge.fury.io/rb/mahjong-render.svg?icon=si%3Arubygems)](https://rubygems.org/gems/mahjong-render)
4
4
  [![CI](https://github.com/kjun1/mahjong-render/actions/workflows/ci.yml/badge.svg)](https://github.com/kjun1/mahjong-render/actions/workflows/ci.yml)
5
5
 
6
6
  [日本語版 README](README.ja.md)
@@ -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.0.gem
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. Macro attributes, inline macros, and PDF output are unsupported. The Ruby rendering API does not load Asciidoctor.
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.0.gem
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.
@@ -120,4 +120,4 @@ ruby -Ilib -rmahjong_render -e 'print MahjongRender.render("405m456p789s12344z")
120
120
 
121
121
  ## Third-party components and license
122
122
 
123
- Copyright 2026 Maejima Kenya. The project Ruby code and text documentation are licensed under [Apache-2.0](LICENSE). The bundled tile artwork and the [README preview](examples/hand.png) are CC0-1.0. The artwork comes from [FluffyStuff/riichi-mahjong-tiles](https://github.com/FluffyStuff/riichi-mahjong-tiles); see [third-party notices](THIRD_PARTY_NOTICES.md), [the asset manifest](assets/manifest.json), and [the CC0 legal text](LICENSES/CC0-1.0.txt). The gem metadata lists both licenses; each applies to the components described here.
123
+ Copyright 2026 kjun1. The project Ruby code and text documentation are licensed under [Apache-2.0](LICENSE). The bundled tile artwork and the [README preview](examples/hand.png) are CC0-1.0. The artwork comes from [FluffyStuff/riichi-mahjong-tiles](https://github.com/FluffyStuff/riichi-mahjong-tiles); see [third-party notices](THIRD_PARTY_NOTICES.md), [the asset manifest](assets/manifest.json), and [the CC0 legal text](LICENSES/CC0-1.0.txt). The gem metadata lists both licenses; each applies to the components described here.
@@ -2,4 +2,4 @@
2
2
 
3
3
  Status: accepted for v0.1.0.
4
4
 
5
- Use Apache-2.0 (`SPDX-License-Identifier: Apache-2.0`) for project code and documentation, attributed to Maejima Kenya. The bundled tile SVGs and `examples/hand.png`, which is generated from those SVGs, remain independently CC0-1.0. Gem metadata lists both identifiers; `THIRD_PARTY_NOTICES.md` explains which files each covers because a license list alone cannot express component boundaries. Preserve the upstream declaration, full CC0 legal text, attribution, source revision, and file hashes. Keep optional and development dependency licenses separate from bundled content. CI fails when the Apache license copy changes or a locked dependency has no approved license metadata.
5
+ Use Apache-2.0 (`SPDX-License-Identifier: Apache-2.0`) for project code and documentation, attributed to kjun1. The bundled tile SVGs and `examples/hand.png`, which is generated from those SVGs, remain independently CC0-1.0. Gem metadata lists both identifiers; `THIRD_PARTY_NOTICES.md` explains which files each covers because a license list alone cannot express component boundaries. Preserve the upstream declaration, full CC0 legal text, attribution, source revision, and file hashes. Keep optional and development dependency licenses separate from bundled content. CI fails when the Apache license copy changes or a locked dependency has no approved license metadata.
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 attributes. Invalid notation raises `MahjongRender::NotationError`. Inline macros and PDF output are unsupported. Loading `mahjong_render` alone does not load Asciidoctor.
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.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2026 Maejima Kenya
3
+ # Copyright 2026 kjun1
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  require "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
- raise UnsupportedAttributeError, "mahjong block macro does not support attributes: #{attrs.keys.join(', ')}" unless attrs.empty?
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
- create_pass_block(parent, %(<div class="mahjong-render">#{svg}</div>), {}, subs: nil)
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2026 Maejima Kenya
3
+ # Copyright 2026 kjun1
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  module MahjongRender
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2026 Maejima Kenya
3
+ # Copyright 2026 kjun1
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  module MahjongRender
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2026 Maejima Kenya
3
+ # Copyright 2026 kjun1
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  module MahjongRender
7
- VERSION = "0.2.0"
7
+ VERSION = "0.2.2"
8
8
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2026 Maejima Kenya
3
+ # Copyright 2026 kjun1
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  require_relative "mahjong_render/version"
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.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
- - Maejima Kenya
7
+ - kjun1
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-09-24 00:00:00.000000000 Z
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.0
102
- changelog_uri: https://github.com/kjun1/mahjong-render/blob/v0.2.0/CHANGELOG.md
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.0/docs/api.md
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: