[ BUG ] TOC entries have no text on OS/390
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
gh-md-tocで、gh_toc_grabのOS/390ブランチの428行目付近から始め、見出しテキストの抽出をデフォルトブランチの更新された式と比較してください。Issueにはこのブランチを強制するmacOSでの再現手順が含まれています。これを実行してTOCラベルが空になることを確認し、次に両方の見出しから期待されるテキストとアンカーが生成されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
On OS/390 (z/OS) every TOC entry has an empty text: * [](#title) instead of * [Title](#title).
The OS/390 branch of gh_toc_grab takes the heading text with an expression for the old GitHub HTML layout (line 428 on master at a28f86d):
text = substr($0, match($0, /<\/span><\/a>[^<]*<\/h/)+11, RLENGTH-14)
In the old layout the anchor was inside the heading tag, before the text. Now it comes after the heading tag, and the line ends at </a (the grep pattern <h[1-6][^>]*class="heading-element".*</a):
<h1 class="heading-element">gh-md-toc</h1><a id="user-content-gh-md-toc" class="anchor" aria-label="Permalink: gh-md-toc" href="#gh-md-toc"><span aria-hidden="true" class="octicon octicon-link"></span></a
There is no </span></a> followed by the text and </h, so match returns 0 and text is empty. The link is fine: since #185 both branches take it from the class="anchor" element.
7d0a86b ("Update for a new GH HTML layout") changed the grep pattern and the text expression of the default branch to the new layout, but not the text expression of the OS/390 branch.
To Reproduce
Not run on z/OS. Simulated on macOS with a copy of gh-md-toc where the OS/390 branch of gh_toc_grab is always taken, and pcregrep -o is replaced with grep -Eo (the same pattern):
sed -e '422s/if \[ "$(uname -s)" == "OS\/390" \]; then/if true; then/' \
-e '423s/grepcmd="pcregrep -o"/grepcmd="grep -Eo"/' gh-md-toc > os390-gh-md-toc
chmod +x os390-gh-md-toc
printf '# Title\n\n## Section\n' > test.md
./os390-gh-md-toc test.md
Output:
Table of Contents
=================
* [](#title)
* [](#section)
For README.md of this repository, all 17 entries have an empty text.
Expected behavior
* [Title](#title)
* [Section](#section)
Environment (please complete the following information):
- OS: OS/390 (simulated on macOS, Darwin 24.6.0)
- Version: 0.11.0 (master at a28f86d)
Additional context
Found while working on #153 (#202).
- 主要言語
- Shell
- スター
- 3.3k
- フォーク
- 2.7k
- 平均マージ
- 1時間 56分
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/github-markdown-toc のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ekalinin/github-markdown-toc#201 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
ekalinin/github-markdown-toc#176 ·
メンテナーはふだん 1 日以内に返信
-
Update outdated examples and versions in README対応中かも @SatvikMishra08 が 42 日前に担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ekalinin/github-markdown-toc#165 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
ekalinin/github-markdown-toc#203 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
ekalinin/github-markdown-toc#194 ·
メンテナーはふだん 1 日以内に返信
ekalinin/github-markdown-toc の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
msys2/MINGW-packages#33356 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kunchenguid/headless#23 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mack-a/v2ray-agent#1370 ·