meta description の改行由来の空白とブラケットリンクを整形する#219
Merged
Merged
Conversation
Entry#description が返すテキストは <meta name="description"> にそのまま 入るが、ソース由来の改行とブラケットリンク記法が未整形のまま残っていた。 - 非 ASCII 文字間の改行は削除(rurema#61 の本文と同じ規則。ブラウザや SNS の プレビューで日本語文中に不自然な空白として見えるため) - 残りの改行は空白1つに変換 - [[m:URI::Generic#host]] などのブラケットリンクはリンク先名のみの プレーンテキストにする class/library/doc/method/function の各 description で共通の Entry#description_text を通すようにした。 Fixes rurema#131 Fixes rurema#52 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.
解決したい問題
Fixes #131
Fixes #52
Entry#descriptionの値は各ページの<meta name="description">にそのまま入りますが、2つの問題が残っていました。
(例:
URI::Generic#hostnameの「が設␊定されていない」。本文側は Truncate newline between non-ASCII characters #61 で対応済みだが description は未対応)[[m:...]]などのブラケットリンク記法が未整形のまま表示される(例: doc/spec/literal ページの description)
変更内容
Entry#description_textを追加し、class / library / doc / method / function の各descriptionで共通に通すようにしました。連続する日本語行もすべて連結されるよう後読みではなく先読みでマッチします
(
[[m:URI::Generic#host]]→URI::Generic#host、[[m:String#[] ]]→String#[])md ソース DB では従来どおり
MarkdownToRRD.restore_descriptionで rd インライン形式に戻した後に同じ整形を適用します(
display_text経由)。動作確認
issue #131 の実例を rd / markdown 両ソースの検証 DB で確認:
テスト
test/test_entry.rbにTestEntryDescriptionを追加(CJK 改行連結・連続行・ASCII 境界の空白化・ブラケットリンク・インデクサ表記・メソッド description の6ケース)ruby test/run_test.rb全件パス(17560 tests)sig/bitclust/entry.rbsに新規メソッドのシグネチャを追記🤖 Generated with Claude Code