diff -Nru go-md2man-v2-2.0.2+ds1/.github/workflows/test.yml go-md2man-v2-2.0.3+ds1/.github/workflows/test.yml --- go-md2man-v2-2.0.2+ds1/.github/workflows/test.yml 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/.github/workflows/test.yml 2023-10-10 18:05:46.000000000 +0000 @@ -16,12 +16,12 @@ runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build run: go build -v ./... @@ -32,8 +32,7 @@ lint: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: golangci/golangci-lint-action@v3.1.0 + - uses: actions/checkout@v4 + - uses: golangci/golangci-lint-action@v3.7.0 with: - # must be specified without patch version - version: v1.41 + version: v1.51 diff -Nru go-md2man-v2-2.0.2+ds1/.golangci.yml go-md2man-v2-2.0.3+ds1/.golangci.yml --- go-md2man-v2-2.0.2+ds1/.golangci.yml 1970-01-01 00:00:00.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/.golangci.yml 2023-10-10 18:05:46.000000000 +0000 @@ -0,0 +1,6 @@ +# For documentation, see https://golangci-lint.run/usage/configuration/ + +linters: + enable: + - gofumpt + diff -Nru go-md2man-v2-2.0.2+ds1/debian/changelog go-md2man-v2-2.0.3+ds1/debian/changelog --- go-md2man-v2-2.0.2+ds1/debian/changelog 2023-08-24 05:14:24.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/debian/changelog 2023-10-23 10:42:49.000000000 +0000 @@ -1,8 +1,10 @@ -go-md2man-v2 (2.0.2+ds1-1build1) mantic; urgency=medium +go-md2man-v2 (2.0.3+ds1-1) unstable; urgency=medium - * No-change rebuild with Go 1.21. + * New upstream version 2.0.3+ds1 + * Drop -dev package’s unneeded dependency on ${shlibs:Depends} + * Bump Standards-Version to 4.6.2 (no change) - -- Michael Hudson-Doyle Thu, 24 Aug 2023 17:14:24 +1200 + -- Anthony Fok Mon, 23 Oct 2023 04:42:49 -0600 go-md2man-v2 (2.0.2+ds1-1) unstable; urgency=medium diff -Nru go-md2man-v2-2.0.2+ds1/debian/control go-md2man-v2-2.0.3+ds1/debian/control --- go-md2man-v2-2.0.2+ds1/debian/control 2022-06-05 13:38:25.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/debian/control 2023-10-23 10:42:35.000000000 +0000 @@ -10,7 +10,7 @@ golang-any, golang-github-russross-blackfriday-v2-dev (>= 2.1.0) Testsuite: autopkgtest-pkg-go -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Vcs-Browser: https://salsa.debian.org/go-team/packages/go-md2man-v2 Vcs-Git: https://salsa.debian.org/go-team/packages/go-md2man-v2.git Homepage: https://github.com/cpuguy83/go-md2man @@ -34,8 +34,7 @@ Architecture: all Multi-Arch: foreign Depends: golang-github-russross-blackfriday-v2-dev (>= 2.1.0), - ${misc:Depends}, - ${shlibs:Depends} + ${misc:Depends} Description: utility to create manpages from markdown (source) Turns Markdown into manpages, which is really handy for people that don't want to learn how to make manpages from stuff like DocBook. diff -Nru go-md2man-v2-2.0.2+ds1/go-md2man.1.md go-md2man-v2-2.0.3+ds1/go-md2man.1.md --- go-md2man-v2-2.0.2+ds1/go-md2man.1.md 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/go-md2man.1.md 2023-10-10 18:05:46.000000000 +0000 @@ -2,22 +2,27 @@ ================================================== # NAME - go-md2man - Convert markdown files into manpages +go-md2man - Convert markdown files into manpages # SYNOPSIS - go-md2man -in=[/path/to/md/file] -out=[/path/to/output] +**go-md2man** [**-in**=*/path/to/md/file*] [**-out**=*/path/to/output*] -# Description - go-md2man converts standard markdown formatted documents into manpages. It is - written purely in Go so as to reduce dependencies on 3rd party libs. - - By default, the input is stdin and the output is stdout. - -# Example - Convert the markdown file "go-md2man.1.md" into a manpage. - - go-md2man -in=go-md2man.1.md -out=go-md2man.1.out +# DESCRIPTION +**go-md2man** converts standard markdown formatted documents into manpages. It is +written purely in Go so as to reduce dependencies on 3rd party libs. + +By default, the input is stdin and the output is stdout. + +# EXAMPLES +Convert the markdown file *go-md2man.1.md* into a manpage: +``` +go-md2man < go-md2man.1.md > go-md2man.1 +``` + +Same, but using command line arguments instead of shell redirection: +``` +go-md2man -in=go-md2man.1.md -out=go-md2man.1 +``` # HISTORY - January 2015, Originally compiled by Brian Goff( cpuguy83@gmail.com ) - +January 2015, Originally compiled by Brian Goff (cpuguy83@gmail.com). diff -Nru go-md2man-v2-2.0.2+ds1/hack/ci/check_mods.sh go-md2man-v2-2.0.3+ds1/hack/ci/check_mods.sh --- go-md2man-v2-2.0.2+ds1/hack/ci/check_mods.sh 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/hack/ci/check_mods.sh 2023-10-10 18:05:46.000000000 +0000 @@ -2,14 +2,8 @@ set -e -exit_code=0 - make vendor -git diff --exit-code go.mod go.sum || exit_code=$? - -if [ ${exit_code} -eq 0 ]; then - exit 0 +if ! git diff --exit-code go.mod go.sum; then + echo "please run \`make mod\` and check in the changes" + exit 1 fi - -echo "please run \`make mod\` and check in the changes" -exit ${exit_code} diff -Nru go-md2man-v2-2.0.2+ds1/md2man/md2man.go go-md2man-v2-2.0.3+ds1/md2man/md2man.go --- go-md2man-v2-2.0.2+ds1/md2man/md2man.go 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/md2man/md2man.go 2023-10-10 18:05:46.000000000 +0000 @@ -9,6 +9,8 @@ renderer := NewRoffRenderer() return blackfriday.Run(doc, - []blackfriday.Option{blackfriday.WithRenderer(renderer), - blackfriday.WithExtensions(renderer.GetExtensions())}...) + []blackfriday.Option{ + blackfriday.WithRenderer(renderer), + blackfriday.WithExtensions(renderer.GetExtensions()), + }...) } diff -Nru go-md2man-v2-2.0.2+ds1/md2man/roff.go go-md2man-v2-2.0.3+ds1/md2man/roff.go --- go-md2man-v2-2.0.2+ds1/md2man/roff.go 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/md2man/roff.go 2023-10-10 18:05:46.000000000 +0000 @@ -1,6 +1,7 @@ package md2man import ( + "bytes" "fmt" "io" "os" @@ -34,10 +35,10 @@ hruleTag = "\n.ti 0\n\\l'\\n(.lu'\n" linkTag = "\n\\[la]" linkCloseTag = "\\[ra]" - codespanTag = "\\fB\\fC" + codespanTag = "\\fB" codespanCloseTag = "\\fR" - codeTag = "\n.PP\n.RS\n\n.nf\n" - codeCloseTag = "\n.fi\n.RE\n" + codeTag = "\n.EX\n" + codeCloseTag = "\n.EE\n" quoteTag = "\n.PP\n.RS\n" quoteCloseTag = "\n.RE\n" listTag = "\n.RS\n" @@ -86,8 +87,7 @@ // RenderNode is called for each node in a markdown document; based on the node // type the equivalent roff output is sent to the writer func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus { - - var walkAction = blackfriday.GoToNext + walkAction := blackfriday.GoToNext switch node.Type { case blackfriday.Text: @@ -109,9 +109,16 @@ out(w, strongCloseTag) } case blackfriday.Link: - if !entering { - out(w, linkTag+string(node.LinkData.Destination)+linkCloseTag) - } + // Don't render the link text for automatic links, because this + // will only duplicate the URL in the roff output. + // See https://daringfireball.net/projects/markdown/syntax#autolink + if !bytes.Equal(node.LinkData.Destination, node.FirstChild.Literal) { + out(w, string(node.FirstChild.Literal)) + } + // Hyphens in a link must be escaped to avoid word-wrap in the rendered man page. + escapedLink := strings.ReplaceAll(string(node.LinkData.Destination), "-", "\\-") + out(w, linkTag+escapedLink+linkCloseTag) + walkAction = blackfriday.SkipChildren case blackfriday.Image: // ignore images walkAction = blackfriday.SkipChildren @@ -160,6 +167,11 @@ r.handleTableCell(w, node, entering) case blackfriday.HTMLSpan: // ignore other HTML tags + case blackfriday.HTMLBlock: + if bytes.HasPrefix(node.Literal, []byte("\n\nSecond paragraph\n", + ".nh\n\n.PP\nFirst paragraph\n\n.PP\nSecond paragraph\n", + } + doTestsParam(t, blockTests, TestParams{}) + + inlineTests := []string{ + "Text with a comment in the middle\n", + ".nh\n\n.PP\nText with a comment in the middle\n", + } + doTestsInlineParam(t, inlineTests, TestParams{}) +} + func execRecoverableTestSuite(t *testing.T, tests []string, params TestParams, suite func(candidate *string)) { // Catch and report panics. This is useful when running 'go test -v' on // the integration server. When developing, though, crash dump is often diff -Nru go-md2man-v2-2.0.2+ds1/md2man.go go-md2man-v2-2.0.3+ds1/md2man.go --- go-md2man-v2-2.0.2+ds1/md2man.go 2022-04-22 22:25:44.000000000 +0000 +++ go-md2man-v2-2.0.3+ds1/md2man.go 2023-10-10 18:05:46.000000000 +0000 @@ -9,8 +9,10 @@ "github.com/cpuguy83/go-md2man/v2/md2man" ) -var inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)") -var outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)") +var ( + inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)") + outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)") +) func main() { var err error