Created attachment 242850 [details] gh-md-toc-0.8.0.patch Description: gh-md-toc (or github-markdown-toc) is a TOC (Table of Content) generator for a README.md or a GitHub wiki page without installing additional software. WWW: https://github.com/ekalinin/github-markdown-toc/ QA: * portlint: OK (looks fine.) * testport: OK (poudriere: 13.2-RELEASE, amd64, CURL DOCS WGET tested)
Thank you for your submission. Here are some comments: - does this script run with /bin/sh? If yes, we could eliminate the bash dependency. - could you patch the script to use fetch(1) instead of wget(1) or curl(1)? This would permit elimination of these dependencies. - please only use ${PORTNAME} if the makefile would still work was PORTNAME changed. In this case, if the port is renamed, the do-install target no longer works, so perhaps you shouldn't use PORTNAME there. - using ${PORTDOCS[0]} to get the name of a known file is fragile programming style. What if PORTDOCS has multiple entries and someone sorts it so README is no longer the first entry? Try to avoid such dependencies on element order in lists. Just hardcode README as the file you want to install. - WWW does not need a trailing slash. Will proceed with a build test once these issues have been addressed.
Created attachment 243084 [details] gh-md-toc-0.8.0.patch Thanks for reviewing my patch and sorry for taking so long to respond. --- > does this script run with /bin/sh? If yes, we could eliminate the bash dependency. Not by default, but I have patched gh-md-toc to work seamlessly with sh(1). > could you patch the script to use fetch(1) instead of wget(1) or curl(1)? This would permit elimination of these dependencies. Unfortunately, fetch(1) doesn't allow you to set the headers that the Github needs to set the token, but I've read gh-md-toc carefully and I think ftp/wget doesn't make sense as the README says. ``` gh_toc_load() { local gh_url=$1 if type curl &>/dev/null; then curl --user-agent "$gh_user_agent" -s "$gh_url" elif type wget &>/dev/null; then wget --user-agent="$gh_user_agent" -qO- "$gh_url" else echo "Please, install 'curl' or 'wget' and try again." exit 1 fi } ``` The above code only makes sense if wget or curl is used depending on the user's preferences in the following code. ``` OUTPUT=$(curl -s \ --user-agent "$gh_user_agent" \ --data-binary @"$gh_tmp_file_md" \ -H "Content-Type:text/plain" \ -H "$AUTHORIZATION" \ "$URL") ``` The above code creates a dependency so the user must install ftp/curl and the gh_toc_load() will match curl first, so ftp/wget makes no sense. I simply remove it to have less dependencies. --- All other mentioned problems have been fixed and I have also patched gh-md-toc in some parts that may create new problems, such as: ``` gh-md-toc --version 0.8.0 os: FreeBSD 13.2-RELEASE kernel: 1302001 shell: /bin/csh grep : grep (BSD grep, GNU compatible) 2.6.0-FreeBSD awk : awk version 20210215 sed : sed (BSD sed) fetch: fetch (BSD fetch) ```
Thank you for the update. I will be able to commit this patch with small changes: - DOCS does not need to be placed in OPTIONS_DEFAULT. It is always on by default.
Created attachment 243186 [details] gh-md-toc-0.8.0.patch I had forgotten, thank you!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8c453856c7ac0ffbb162a6187c019703781f6588 commit 8c453856c7ac0ffbb162a6187c019703781f6588 Author: Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org> AuthorDate: 2023-06-30 20:41:09 +0000 Commit: Robert Clausecker <fuz@FreeBSD.org> CommitDate: 2023-07-05 17:21:08 +0000 sysutils/gh-md-toc: New port: Easy TOC creation for GitHub README.md gh-md-toc (or github-markdown-toc) is a TOC (Table of Content) generator for a README.md or a GitHub wiki page without installing additional software. WWW: https://github.com/ekalinin/github-markdown-toc PR: 272054 sysutils/Makefile | 1 + sysutils/gh-md-toc/Makefile (new) | 33 +++++++++ sysutils/gh-md-toc/distinfo (new) | 3 + sysutils/gh-md-toc/files/patch-gh-md-toc (new) | 94 ++++++++++++++++++++++++++ sysutils/gh-md-toc/pkg-descr (new) | 3 + 5 files changed, 134 insertions(+)
Thank you for your contribution.