[ BUG ] TOC entries have no text on OS/390
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia in gh-md-toc, nel ramo OS/390 di gh_toc_grab intorno alla riga 428, e confronta l’estrazione del testo delle intestazioni con l’espressione aggiornata del ramo predefinito. L’issue include una riproduzione su macOS che forza questo ramo; eseguila per confermare le etichette TOC vuote, quindi verifica che entrambe le intestazioni producano il testo e gli anchor previsti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Shell
- Stelle
- 3.3k
- Fork
- 2.7k
- Merge medio
- 1h 56m
- PR unite (30g)
- 21
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ekalinin/github-markdown-toc
-
[ BUG ] Headings are missing from the TOC when GitHub puts a line break after the heading tagApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ekalinin/github-markdown-toc#201 ·
I maintainer di solito rispondono entro 1 giorno
-
Update bats version in CIApertaenhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
ekalinin/github-markdown-toc#176 ·
I maintainer di solito rispondono entro 1 giorno
-
Update outdated examples and versions in READMEForse già presa @SatvikMishra08 l’ha presa 42 giorni fa. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ekalinin/github-markdown-toc#165 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
ekalinin/github-markdown-toc#203 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
ekalinin/github-markdown-toc#194 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ekalinin/github-markdown-toc
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
msys2/MINGW-packages#33356 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Misleading 'Update → Config → Hyprland' menu item silently resets user configs without confirmationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kunchenguid/headless#23 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mack-a/v2ray-agent#1370 ·