Bug 276219 - sysutils/gh-md-toc: Update to 0.9.1
Summary: sysutils/gh-md-toc: Update to 0.9.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Robert Clausecker
URL: https://github.com/ekalinin/github-ma...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-09 12:53 UTC by Jesús Daniel Colmenares Oviedo
Modified: 2024-03-19 14:26 UTC (History)
1 user (show)

See Also:


Attachments
gh-md-toc-0.9.1.patch (13.98 KB, patch)
2024-01-09 12:53 UTC, Jesús Daniel Colmenares Oviedo
DtxdF: maintainer-approval+
Details | Diff
gh-md-toc-0.10.0.patch (13.25 KB, patch)
2024-03-15 01:05 UTC, Jesús Daniel Colmenares Oviedo
DtxdF: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesús Daniel Colmenares Oviedo 2024-01-09 12:53:21 UTC
Created attachment 247543 [details]
gh-md-toc-0.9.1.patch

Description:

* Pet portfmt.
* Add jq as runtime dependency.
* Fix gh-md-toc:
  - Retrieving the README depends on the content of the repository and since it
    can change at any time, the script could break, as it did. Although scraping
    is still used as a method to get the README, it has only a small responsibility:
    to get the JSON with the repository information, so that it can be easily
    retrieved by sending a request like
    `https://raw.githubusercontent.com/<account>/<project>/<refName>/<readme>`.
- Add the `--location` parameter to the curl command in the `gh_toc_load` function.
  Necessary for requests like `https://github.com/<account>/<project>/blob/<refName>`.
- Add the `--fail` parameter to the curl command in the `gh_toc_load` function.
  Necessary to show errors correctly.

ChangeLog: https://github.com/ekalinin/github-markdown-toc/releases/tag/0.9.1

QA:

* portlint: OK (looks fine.)
* testport: OK (poudriere: 14.0-RELEASE, amd64, DOCS tested)
Comment 1 Jesús Daniel Colmenares Oviedo 2024-03-14 23:43:17 UTC
Hi Robert,

There is a new version available [1], I will update this patch as soon as possible.

As a side note, I tested the current patch again and everything works perfectly except the main thing: parsing Markdown content; the cause seems to be the new github HTML layout [2]. I copy-paste the gh_toc_grab function to update the installed gh-toc-md script again in a clean environment (a jail) and it seems to work very well:

```
==== Test #1 ====

$ gh-md-toc https://github.com/freebsd/poudriere

Table of Contents
=================

   * [Welcome to poudriere!](#welcome-to-poudriere)
   * [Where is the documentation?](#where-is-the-documentation)
   * [Support](#support)
   * [Getting started with poudriere](#getting-started-with-poudriere)
   * [Build status](#build-status)

<!-- Created by https://github.com/ekalinin/github-markdown-toc -->

==== Test #2 ====

$ fetch -qo - https://raw.githubusercontent.com/DtxdF/AppJail/main/README.md | gh-md-toc -
* [AppJail](#appjail)
   * [Features](#features)
   * [Documentation](#documentation)
   * [Comparing AppJail](#comparing-appjail)
   * [Support](#support)
   * [Design decisions](#design-decisions)
   * [TODO](#todo)
   * [Contributing](#contributing)

==== Test #3 ====

$ fetch https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/README.md
README.md                                               12 kB 3338 kBps    00s
$ gh-md-toc README.md 

Table of Contents
=================

* [gh-md-toc](#gh-md-toc)
* [Table of contents](#table-of-contents)
* [Installation](#installation)
* [Usage](#usage)
   * [STDIN](#stdin)
   * [Local files](#local-files)
   * [Remote files](#remote-files)
   * [Multiple files](#multiple-files)
   * [Combo](#combo)
   * [Auto insert and update TOC](#auto-insert-and-update-toc)
   * [GitHub token](#github-token)
   * [TOC generation with Github Actions](#toc-generation-with-github-actions)
* [Tests](#tests)
* [Dependency](#dependency)
* [Docker](#docker)
   * [Local](#local)
   * [Public](#public)

<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
```

[1] https://github.com/ekalinin/github-markdown-toc/releases/tag/0.10.0
[2] https://github.com/ekalinin/github-markdown-toc/commit/7d0a86b3be2e8e959cd9747fcf2c4a1f0e6a24eb#diff-95b2a174eea81fed1e1a47ccacdc81fa1736cccee14095786a4d3033edcf60deL256
Comment 2 Jesús Daniel Colmenares Oviedo 2024-03-15 01:05:49 UTC
Created attachment 249177 [details]
gh-md-toc-0.10.0.patch

Description:

ChangeLog: https://github.com/ekalinin/github-markdown-toc/releases/tag/0.10.0
    
* Update for a new GH HTML layout

QA:

* portlint: OK (looks fine.)
* testport: OK (synth: 14.0-RELEASE, amd64, DOCS tested)
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2024-03-15 07:27:29 UTC
Will commit the updated patch from attachment 249177 [details].

Thank you for staying on top of things.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-03-19 14:21:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=849771c682905859f57d5c0a73dff421a88efc6e

commit 849771c682905859f57d5c0a73dff421a88efc6e
Author:     Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org>
AuthorDate: 2024-03-15 00:51:19 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-03-19 14:18:51 +0000

    sysutils/gh-md-toc: Update to 0.10.0

    ChangeLog: https://github.com/ekalinin/github-markdown-toc/releases/tag/0.10.0

    * Update for a new GH HTML layout

    PR:             276219

 sysutils/gh-md-toc/Makefile              |   7 +-
 sysutils/gh-md-toc/distinfo              |   6 +-
 sysutils/gh-md-toc/files/patch-gh-md-toc | 251 +++++++++++++++++++++++++------
 3 files changed, 211 insertions(+), 53 deletions(-)
Comment 5 Robert Clausecker freebsd_committer freebsd_triage 2024-03-19 14:26:48 UTC
Thank you for your contribution.