From nobody Wed Jul 05 17:25:30 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qx64W05kLz4lpcx; Wed, 5 Jul 2023 17:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qx64V6Z5hz4V6t; Wed, 5 Jul 2023 17:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688577930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b6OT5oFEBSso6zlRVkaWydEMx3VsCVVPyCT09mHz2HE=; b=eZEst6WySHmE0rgINOtpgf3aF0ENc+G/mwzsRCg07QpTX6Tkjr1hCSs2GpLE41bHezbo4o WWkDjo8RsIpXByZaVtlacT+3b8aKz3d4C7PxRkGtAatvWBo+DeQ0IaGCf35vBJArzJvN+P gj5RqUuCS07rTprmkFf6YlpgP9nK1QYZcKoKrotqM5iaqK7AIdH8k+r6AghQYaBCD+ESMy d6QhSSskIxbgslLKvFTdVaFnqQX8dGtrK/hdTxec7QiBJmRxunL1gxv9QcBe9tUnbLncQj S9NhT7WC0RcpTAPzGWhnx1j6dmT7bfUysfSOe+1EhYa2RCGyYEUQuf/5CHD53A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688577930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b6OT5oFEBSso6zlRVkaWydEMx3VsCVVPyCT09mHz2HE=; b=xFzeEGJM6tiSBP1b7CAWfjVNKzz8Zt4K35Fayt1eH0IoKHEWthZMjAZe6HIaNuMsSyoZ2S YjeoT7ZCJBBBvVA7jd8quBfkc+6NpKPdBtuu+xo9PihU9VJlRxhWHnt5MlEhUyD4t6XJi8 78pb8qVuNWyskdKzqkMpUHxzg3sUf3mzHQ9FDp2vP3sFJbPJEn7WO3h/rPnB9/UaEk0CmJ 9MEU2d5PhR3BKCcWrybjdnk5dlSOpxCGbhRT87UQ77B0is6BlUoeTobFkLssILuVy5+1tF bBJazFbZm8DqZYllHeJZ9rknhlo5HkTJGFPRQllXafuaa2/2+luNUTCH4luC8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688577930; a=rsa-sha256; cv=none; b=n2Z6y17g/wfMS0q7FtZTEZlyIhisrJH3ib1oHwU5xk0Rfwm+fhV0xdmcbRbbvGAYH1/Fdq qWI61rtesaX942CUxZhVPsXE0w3163JkMwAYZrDFuwrzhn2nlhaj+17vluh9cjULosD1VX BvQayoSRlP8dIJVztXxk9Rs9hnbdQCZeReuMiUpBsk+0SKuohCWC1WYMRiWrdd8nagxQ1D 3px7RuPRxSCTPZkY4IcBVjqhjsecGMQejIU5JQ47HzINXwTUrdZbqaWDHt52jWFCRVLIRZ sf5BWu1Okjh35u8TTeK1Q6RRujaMrfe4K7Ii4fRiOUNP6y91nXjoezg2OgcAVA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qx64V5cqZzNnV; Wed, 5 Jul 2023 17:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 365HPUoG099251; Wed, 5 Jul 2023 17:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 365HPUfM099250; Wed, 5 Jul 2023 17:25:30 GMT (envelope-from git) Date: Wed, 5 Jul 2023 17:25:30 GMT Message-Id: <202307051725.365HPUfM099250@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Robert Clausecker Subject: git: 8c453856c7ac - main - sysutils/gh-md-toc: New port: Easy TOC creation for GitHub README.md List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c453856c7ac0ffbb162a6187c019703781f6588 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=8c453856c7ac0ffbb162a6187c019703781f6588 commit 8c453856c7ac0ffbb162a6187c019703781f6588 Author: Jesús Daniel Colmenares Oviedo AuthorDate: 2023-06-30 20:41:09 +0000 Commit: Robert Clausecker 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 | 33 +++++++++++ sysutils/gh-md-toc/distinfo | 3 + sysutils/gh-md-toc/files/patch-gh-md-toc | 94 ++++++++++++++++++++++++++++++++ sysutils/gh-md-toc/pkg-descr | 3 + 5 files changed, 134 insertions(+) diff --git a/sysutils/Makefile b/sysutils/Makefile index fad80678bc0e..2b9d74a710e2 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -485,6 +485,7 @@ SUBDIR += getdelta SUBDIR += geteltorito SUBDIR += getssl + SUBDIR += gh-md-toc SUBDIR += gigolo SUBDIR += gitwatch SUBDIR += gkfreq diff --git a/sysutils/gh-md-toc/Makefile b/sysutils/gh-md-toc/Makefile new file mode 100644 index 000000000000..6c4ba85a795d --- /dev/null +++ b/sysutils/gh-md-toc/Makefile @@ -0,0 +1,33 @@ +PORTNAME= gh-md-toc +DISTVERSION= 0.8.0 +CATEGORIES= sysutils + +MAINTAINER= DtxdF@disroot.org +COMMENT= Easy TOC creation for GitHub README.md +WWW= https://github.com/ekalinin/github-markdown-toc + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +RUN_DEPENDS= curl>0:ftp/curl + +USE_GITHUB= yes +GH_ACCOUNT= ekalinin +GH_PROJECT= github-markdown-toc + +NO_BUILD= yes + +PLIST_FILES= bin/gh-md-toc + +PORTDOCS= README.md + +OPTIONS_DEFINE= DOCS + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/gh-md-toc ${STAGEDIR}${PREFIX}/bin + +do-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} + +.include diff --git a/sysutils/gh-md-toc/distinfo b/sysutils/gh-md-toc/distinfo new file mode 100644 index 000000000000..16f7fc92da8d --- /dev/null +++ b/sysutils/gh-md-toc/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1687043066 +SHA256 (ekalinin-github-markdown-toc-0.8.0_GH0.tar.gz) = 7f6079026a32c03d6e7254e5921b94f6802c2d52c9d74d85a1f8015d864b58d0 +SIZE (ekalinin-github-markdown-toc-0.8.0_GH0.tar.gz) = 10927 diff --git a/sysutils/gh-md-toc/files/patch-gh-md-toc b/sysutils/gh-md-toc/files/patch-gh-md-toc new file mode 100644 index 000000000000..ac4e37045b34 --- /dev/null +++ b/sysutils/gh-md-toc/files/patch-gh-md-toc @@ -0,0 +1,94 @@ +--- gh-md-toc.orig 2023-06-30 18:59:15 UTC ++++ gh-md-toc +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # + # Steps: +@@ -34,12 +34,10 @@ gh_user_agent="gh-md-toc v$gh_toc_version" + gh_toc_load() { + local gh_url=$1 + +- if type curl &>/dev/null; then ++ if type curl > /dev/null 2>&1; 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." ++ echo "Please, install 'curl' and try again." + exit 1 + fi + } +@@ -56,7 +54,7 @@ gh_toc_md2html() { + if [ ! -z "$GH_TOC_TOKEN" ]; then + TOKEN=$GH_TOC_TOKEN + else +- TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" ++ TOKEN_FILE="$(cd "$(dirname "$0")" && pwd)/token.txt" + if [ -f "$TOKEN_FILE" ]; then + TOKEN="$(cat $TOKEN_FILE)" + fi +@@ -124,12 +122,14 @@ gh_toc(){ + fi + + if [ "$(gh_is_url "$gh_src")" == "yes" ]; then +- gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" +- if [ "${PIPESTATUS[0]}" != "0" ]; then ++ local gh_content ++ gh_content=`gh_toc_load "$gh_src"` ++ if [ $? -ne 0 ]; then + echo "Could not load remote document." + echo "Please check your url or network connectivity" + exit 1 + fi ++ printf "%s\n" "$gh_content" | gh_toc_grab "$gh_src_copy" + if [ "$need_replace" = "yes" ]; then + echo + echo "!! '$gh_src' is not a local file" +@@ -146,7 +146,7 @@ gh_toc(){ + if [ "$rawhtml" == "XXRateLimitXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" +- TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" ++ TOKEN_FILE="$(cd "$(dirname "$0")" && pwd)/token.txt" + echo "or place GitHub auth token here: ${TOKEN_FILE}" + exit 1 + fi +@@ -175,11 +175,7 @@ gh_toc(){ + fi + + # insert toc file +- if [[ "`uname`" == "Darwin" ]]; then +- sed -i "" "/${ts}/r ${toc_path}" "$gh_src" +- else +- sed -i "/${ts}/r ${toc_path}" "$gh_src" +- fi ++ sed -i "" "/${ts}/r ${toc_path}" "$gh_src" + echo + if [ "${no_backup}" = "yes" ]; then + rm ${toc_path} ${gh_src}${ext} +@@ -296,14 +292,18 @@ gh_toc_app() { + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo +- echo "os: `lsb_release -d | cut -f 2`" +- echo "kernel: `cat /proc/version`" +- echo "shell: `$SHELL --version`" ++ echo "os: `uname -rs`" ++ echo "kernel: `uname -K`" ++ echo "shell: $SHELL" + echo +- for tool in curl wget grep awk sed; do ++ for tool in grep awk; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done ++ printf "%-5s: " sed ++ echo "sed (BSD sed)" ++ printf "%-5s: " fetch ++ echo "fetch (BSD fetch)" + return + fi + diff --git a/sysutils/gh-md-toc/pkg-descr b/sysutils/gh-md-toc/pkg-descr new file mode 100644 index 000000000000..0091fcc641a6 --- /dev/null +++ b/sysutils/gh-md-toc/pkg-descr @@ -0,0 +1,3 @@ +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.