4.0 以降のドキュメントでモジュール関数の表示を ?. にする#277
Merged
Merged
Conversation
方針(rurema#250 のコメントより): Ruby 4.0 以降のドキュメントでの表示変更を 目標にし、それまでは "." を維持する。ソース側は既に "?." 記法に対応 済み(markdown_to_rrd.rb が読み込み時に ".#" へ変換する)なので、今回は 表示側のみを対象にする。RBS 形式のメソッド定義行対応は別機能なので 含めない。 choke point: NameUtils.display_typemark(mark, version) を新設。typemark が '.#' かつ Gem::Version.new(version) >= Gem::Version.new('4.0') の ときだけ '?.' を返し、それ以外は無変換(文字列比較ではなく Gem::Version で比較する。"10.0" のような二桁メジャーを文字列比較すると "4.0" より 小さく見えてしまうため)。 label/short_label/labels/title_labels(methodentry.rb)は表示用途と 識別子用途の両方で使われている(labels は refsdatabase.rb の [[a:...]] アンカーキー、label/labels は `bitclust methods --diff` の 突き合わせが literal ".#" を前提にしている)ため、既存メソッドは一切 変更せず、display_typemark/display_label/display_short_label/ display_title_labels を新設してテンプレート側の表示箇所だけを付け替えた。 対象にした表示箇所: - MethodEntry#display_label/display_short_label/display_title_labels (methodentry.rb) — メソッドページの見出し・<title>、htmlutils.rb の link_to_method(class-index・library ページの一覧) - RDCompiler#method_signature の @opt 分岐(rdcompiler.rb) — template.lillia/library がクラス名+typemark 接頭辞を付けて描画する箇所 - data/bitclust/template/class の「継承しているメソッド」一覧 — MethodSpec(@db を持たない値オブジェクト)を直接文字列化するので screen 側の @target_version 経由で display_typemark を呼ぶ - data/bitclust/template/search — bitclust server の /search が使う 動的 CGI 検索結果ページ - SearchIndexGenerator#method_entries(search_index_generator.rb) — 静的検索インデックスの表示ラベル(full_name)。path は typechar の ままなので不変 - ChmCommand(chm_command.rb)の .hhk 索引ラベル 識別子は一切変更していない: method id・URL(/method/Kernel/m/open 等)・ spec 文字列(lookup/parsing に使う ".#")・DB ファイル名・index id は すべて typemark()/typechar() 経由のまま。 調査のみ(未実装、フォローアップ候補): bitclust server の /search (SimpleSearcher#parse_method_spec_pattern)は "?." 区切りを認識せず、 "Kernel?.mf" のようなクエリはクラス名側に "?" が混入して検索がヒット しない。静的検索(theme/default/js/search_ranker.js)も "." を "::" に 正規化する処理が ".#"/"?." を考慮しておらず、修飾クエリ(区切り文字 つき)は module function では従来から不確実(無修飾のメソッド名検索は name フィールドが typemark と無関係なので影響なし)。 t_wada 式 TDD で実装(テスト→red→green): NameUtils#display_typemark の 単体テスト、MethodEntry の表示系4メソッド、RDCompiler の @opt 分岐、 SearchIndexGenerator、ClassScreen(継承一覧)、MethodScreen(見出し・ <title>)、SearchScreen(新規)を追加。既存スイート(バージョン指定なし のダミー DB 等)は無変更のまま green。17762 → 17787 tests(+25)、 bundle exec rake test / rbs validate / steep check すべて green。 refs rurema#250 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
znz
commented
Jul 22, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 22, 2026
znz
added a commit
to znz/bitclust
that referenced
this pull request
Jul 22, 2026
rurema#250 のフォローアップ(rurema#277 の PR body に記録した件)。 クエリ入力は表示と違い版に紐付かないため、動的 /search(SimpleSearcher)で .# / ?. の両記法を常に受理する。 parse_method_spec_pattern の逆転文字列正規表現は "#."/",." と同じ選択肢に "?" を含んでいなかったため、"Kernel?.open" は "?" がクラス名側に付いて 0 件になっていた。"?" を追加し、tr で従来どおり正準形 .# に正規化する。 Kernel.#open・Kernel#open・Kernel.open・Kernel::open・裸の ?.open の 挙動は回帰テストで確認済み。 静的検索(search_ranker.js)側は Aliki テーマからの verbatim vendor 方針の ため本 PR では変更しない。調査の過程で、静的検索では修飾付き検索 (File.open や Kernel.#open など。モジュール関数に限らない)がクエリの 一律 "."→"::" 書き換えとインデックスの full_name 形式の不一致により 従来から 0 件になることが判明しており、vendored 方針下での対応方針も 含めて別 issue で扱う。 refs rurema#250 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 22, 2026
znz
added a commit
that referenced
this pull request
Jul 23, 2026
fix #282 [[m:...]] のデフォルトラベル(参照の記載文字列)が module function で 常に ".#" のまま表示され、#277 で "?." 化した見出しと 4.0 以降の ページ内で表記が混在していた。Markdown ソースに [m:Kernel?.x] と 書いても markdown_to_rrd の convert_md_ref_to_rrd が MethodSpec 互換の ため ".#" へ正規化するので、記載表記に依らず発生する。 choke point は RDCompiler#bracket_link の 'm' 分岐1箇所(MDCompiler の インライン参照も restore_inline 経由でここに合流する)。デフォルト ラベルを新設の display_spec で畳む: spec が ".#" を含む場合のみ、DB の version が 4.0 以上なら NameUtils.display_typemark で "?." に置換 (#250/#277 と同じ選択規則)。spec・URL・アンカーキーは不変、明示 ラベルには触れない。reference_link の「spec/見出し」ラベルの spec 側 (現 doctree に用例の無い理論エッジ)も同じ規則で畳む。 テスト: rd の版別ラベル(3.4/4.0/4.1)・他 typemark とスペシャル変数の 不変・ref:m: の見出し連結、md の [m:Kernel?.x]/[m:Kernel.#x] 両表記 (3.4/4.0)。全テスト 17805 件・steep・JS テスト green。ミニ markdowntree の実描画で 3.4=".#"・4.0="?." と URL 不変を確認。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
#250 の表示部分の実装です: バージョン 4.0 以上の DB から生成するドキュメントで、モジュール関数の表示を るりま独自の
.#から?.に切り替えます(refs #250)。3.x 以前のドキュメントは従来どおり.#のままです。issue のコメントの方針どおり、RBS 形式のメソッド定義行対応は本 PR には含みません。NameUtils.display_typemark(mark, version)(Gem::Version 比較で 4.0 以上のときだけ.#→?.)と、DB の version を引くMethodEntry#display_typemarkdisplay_label/display_short_label/display_title_labels(表示専用の新設変種)・link_to_method・全 4 テンプレート系統の見出しと一覧・検索インデックスのfull_name・CHM 索引・動的/searchページ・lillia の署名接頭辞/method/Kernel/m/open等のパス・spec 文字列・refs のアンカーキーはそのまま。アンカーキーに使われている既存labels系は敢えて温存し、表示専用のdisplay_*を新設する設計です検証
rbs validate・steep checkエラーなし<h1>module function Dummy.#mf</h1>/ 検索インデックスfull_name="Dummy.#mf"<h1>module function Dummy?.mf</h1>/full_name="Dummy?.mf"pathは両方method/-dummy/m/mf.htmlで不変フォローアップ(本 PR 対象外)
?.を未解釈です: 動的/searchの SimpleSearcher は typemark 分割の正規表現に?が無くKernel?.mfが 0 件になり、静的検索の search_ranker.js も.→::正規化が.#/?.未考慮(こちらは従来から修飾付きモジュール関数検索が不安定)。別対応が必要です.#の説明)への 4.0 分岐追記は、本 PR のマージ後に doctree 側 PR で行います🤖 Generated with Claude Code