kramdown-man 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 164ce0fc23aa69a61fb65b7c99d26e76a9ab76fc798962f06940412bb1dcbcfd
4
- data.tar.gz: 2161ba26365fe958c5a0b5f063706dfe7566d9c1213cb6f84bc63b50dfae4030
3
+ metadata.gz: dda435844039b4d61396829d332060c2db27506a3a7eee5d9859e09d9bd49e42
4
+ data.tar.gz: 46fcc59f2081b7aef517ab9e0e280c4961d370aecca163d78f69a8b3f26298dc
5
5
  SHA512:
6
- metadata.gz: 54bd2ea4c4b967a5af505900f6ea8f02edb00900f6e5e6d67d1c015e776e602fe81d1dc641c62f2d7b614fecb224b3cc6003330b38eaa322f80b7296ee96850c
7
- data.tar.gz: 28a7d09d3e41e9f108c2a73e966d9ecf31a4343b98b4452c23eab9978b7af77f8ec63a2b870726bb2c39cd0ecd0490fd922ea4e389716c4863fb68fe02dafa3e
6
+ metadata.gz: d81ca83bdb40321fd8ab52f2c15dc7e94d585641bac442e214a5acb4e9840f2ac38c4e4cb180d6ac03fac6852c3aeacd723988ca93bf837a226912f30cbc2f9e
7
+ data.tar.gz: 218ca5e6ee857373114abe7d50747cfa89337c0f7a172ee599fbc4e82e60cfb66f12e6ed291dc7d37d904713c0692bde5d8b1fa191d132c1578aa528832de7a8
@@ -1,10 +1,6 @@
1
1
  name: CI
2
2
 
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: ['**']
3
+ on: [ push, pull_request ]
8
4
 
9
5
  jobs:
10
6
  tests:
@@ -13,12 +9,11 @@ jobs:
13
9
  fail-fast: false
14
10
  matrix:
15
11
  ruby:
16
- - 2.4
17
- - 2.5
18
- - 2.6
19
- - 2.7
20
12
  - 3.0
13
+ - 3.1
14
+ - 3.2
21
15
  - jruby
16
+ - truffleruby
22
17
  name: Ruby ${{ matrix.ruby }}
23
18
  steps:
24
19
  - uses: actions/checkout@v2
data/ChangeLog.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.1.9 / 2023-12-01
2
+
3
+ * Allow markdown `man:file.ext` style links, since man pages can be named after
4
+ file names (ex: `shard.yml`).
5
+ * Use the `.PP` roff macro instead of the deprecated `.HP` macro.
6
+
1
7
  ### 0.1.8 / 2020-12-26
2
8
 
3
9
  * Upgrade to kramdown 2.x.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2020 Hal Brodigan
1
+ Copyright (c) 2013-2023 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  * [Homepage](https://github.com/postmodern/kramdown-man#readme)
4
4
  * [Issues](https://github.com/postmodern/kramdown-man/issues)
5
5
  * [Documentation](http://rubydoc.info/gems/kramdown-man/frames)
6
- * [Email](mailto:postmodern.mod3 at gmail.com)
7
6
 
8
7
  ## Description
9
8
 
@@ -17,10 +16,11 @@ A [Kramdown][kramdown] convert for converting Markdown files into man pages.
17
16
  * Supports bullet lists.
18
17
  * Supports multi-paragraph list items and blockquotes.
19
18
  * Supports horizontal rules.
20
- * Supports converting `[bash](man:bash(1))` links into man page references.
19
+ * Supports converting `[bash](man:bash(1))` and `[bash](man:bash.1)` links
20
+ into man page references.
21
21
  * Provides Rake task for converting `man/*.md` into man pages.
22
22
  * Uses the pure-Ruby [Kramdown][kramdown] markdown parser.
23
- * Supports [Ruby] 2.0 and [JRuby].
23
+ * Supports [Ruby] 3.x, [JRuby], and [TruffleRuby].
24
24
 
25
25
  ## Synopsis
26
26
 
@@ -67,9 +67,9 @@ Define a `man` and file tasks which render all `*.md` files within the
67
67
 
68
68
  Normal paragraph.
69
69
 
70
- `command` [`--foo`] *FILE*
70
+ `command` [`--foo`] **FILE**
71
71
 
72
- `command` [`--foo`] *FILE*
72
+ `command` [`--foo`] **FILE**
73
73
 
74
74
  `--tagged`
75
75
  Text here.
@@ -168,7 +168,7 @@ Email <bob@example.com>
168
168
 
169
169
  ## Copyright
170
170
 
171
- Copyright (c) 2013-2020 Hal Brodigan
171
+ Copyright (c) 2013-2023 Hal Brodigan
172
172
 
173
173
  See {file:LICENSE.txt} for details.
174
174
 
@@ -177,3 +177,4 @@ See {file:LICENSE.txt} for details.
177
177
 
178
178
  [Ruby]: http://www.ruby-lang.org/
179
179
  [JRuby]: http://jruby.org/
180
+ [TruffleRuby]: https://github.com/oracle/truffleruby#readme
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'bundler/setup'
data/gemspec.yml CHANGED
@@ -6,6 +6,13 @@ authors: Postmodern
6
6
  email: postmodern.mod3@gmail.com
7
7
  homepage: https://github.com/postmodern/kramdown-man#readme
8
8
 
9
+ metadata:
10
+ documentation_uri: https://rubydoc.info/gems/kramdown-man
11
+ source_code_uri: https://github.com/postmodern/kramdown-man
12
+ bug_tracker_uri: https://github.com/postmodern/kramdown-man/issues
13
+ changelog_uri: https://github.com/postmodern/kramdown-man/blob/master/ChangeLog.md
14
+ rubygems_mfa_required: 'true'
15
+
9
16
  dependencies:
10
17
  kramdown: ~> 2.0
11
18
 
data/kramdown-man.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
4
 
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.authors = Array(gemspec['authors'])
21
21
  gem.email = gemspec['email']
22
22
  gem.homepage = gemspec['homepage']
23
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
23
24
 
24
25
  glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
26
 
@@ -1,4 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  require_relative '../man/version'
3
4
 
4
5
  require 'kramdown/converter/base'
@@ -703,7 +704,7 @@ module Kramdown
703
704
 
704
705
  ".TP\n#{first_line}\n#{rest}"
705
706
  else
706
- ".HP\n#{convert_children(children)}"
707
+ ".PP\n#{convert_children(children)}"
707
708
  end
708
709
  else
709
710
  ".PP\n#{convert_children(children)}"
@@ -760,20 +761,27 @@ module Kramdown
760
761
  #
761
762
  def convert_a(a)
762
763
  href = escape(a.attr['href'])
764
+ scheme, path = href.split(':',2)
765
+
763
766
  text = convert_children(a.children)
764
767
 
765
- case href
766
- when /^mailto:/
767
- email = href[7..-1]
768
+ case scheme
769
+ when 'mailto'
770
+ email = path
768
771
 
769
- unless text == email then "#{text}\n.MT #{email}\n.ME"
770
- else "\n.MT #{email}\n.ME"
772
+ unless text == email
773
+ "#{text}\n.MT #{email}\n.ME"
774
+ else
775
+ "\n.MT #{email}\n.ME"
771
776
  end
772
- when /^man:/
773
- match = href.match(/man:([A-Za-z0-9_-]+)(?:\((\d[a-z]?)\))?/)
777
+ when 'man'
778
+ if (match = path.match(/\A(?<page>[A-Za-z0-9_-]+)(?:\((?<section>\d[a-z]?)\)|\\\.(?<section>\d[a-z]?))\z/))
779
+ page = match[:page]
780
+ section = match[:section]
774
781
 
775
- if match[2] then "\n.BR #{match[1]} (#{match[2]})"
776
- else "\n.BR #{match[1]}"
782
+ "\n.BR #{page} (#{section})"
783
+ else
784
+ "\n.BR #{path}"
777
785
  end
778
786
  else
779
787
  "#{text}\n.UR #{href}\n.UE"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'kramdown'
2
4
  require_relative '../converter/man'
3
5
 
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Kramdown
2
4
  module Man
3
5
  # kramdown-man version
4
- VERSION = "0.1.8"
6
+ VERSION = "0.1.9"
5
7
  end
6
8
  end
data/lib/kramdown/man.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'kramdown'
2
4
 
3
5
  # HACK: load our version of kramdown/converter/man.rb and not kramdown's
data/man/kramdown-man.1 CHANGED
@@ -1,7 +1,12 @@
1
- .\" Generated by kramdown-man 0.1.7
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH kramdown-man.1 "April 2013" kramdown-man "User Manuals"
4
4
  .LP
5
+ .SH SYNOPSIS
6
+ .LP
7
+ .PP
8
+ \fBkramdown-man\fR \[lB]\fIoptions\fP\[rB] <\fIINPUT\fP >\fIOUTPUT\fP
9
+ .LP
5
10
  .SH DESCRIPTION
6
11
  .LP
7
12
  .PP
@@ -9,6 +14,22 @@ A Kramdown
9
14
  .UR http:\[sl]\[sl]kramdown\.gettalong\.org\[sl]
10
15
  .UE plugin for converting Markdown files into man pages\.
11
16
  .LP
17
+ .SH ARGUMENTS
18
+ .LP
19
+ .TP
20
+ \fIINPUT\fP
21
+ The input markdown file to convert\.
22
+ .LP
23
+ .TP
24
+ \fIOUTPUT\fP
25
+ The output file for the man page\.
26
+ .LP
27
+ .SH OPTIONS
28
+ .LP
29
+ .TP
30
+ \fB-h\fR, \fB--help\fR
31
+ Prints the usage for \fBkramdown-man\fR\.
32
+ .LP
12
33
  .SH EXAMPLE
13
34
  .LP
14
35
  .nf
@@ -55,11 +76,11 @@ Normal paragraph\.
55
76
  Normal paragraph\.
56
77
  .LP
57
78
  .nf
58
- \`command\` \[lB]\`\-\-foo\`\[rB] *FILE*
79
+ \`command\` \[lB]\`\-\-foo\`\[rB] **FILE**
59
80
  .fi
60
81
  .LP
61
- .HP
62
- \fBcommand\fR \[lB]\fB--foo\fR\[rB] \fIFILE\fP
82
+ .PP
83
+ \fBcommand\fR \[lB]\fB--foo\fR\[rB] \fBFILE\fP
63
84
  .LP
64
85
  .nf
65
86
  \`\-\-tagged\`
@@ -180,4 +201,4 @@ int main()
180
201
  Postmodern
181
202
  .MT postmodern\.mod3\[at]gmail\.com
182
203
  .ME
183
- .LP
204
+ .LP
@@ -1,9 +1,26 @@
1
1
  # kramdown-man.1 "April 2013" kramdown-man "User Manuals"
2
2
 
3
+ ## SYNOPSIS
4
+
5
+ `kramdown-man` [*options*] \<*INPUT* \>*OUTPUT*
6
+
3
7
  ## DESCRIPTION
4
8
 
5
9
  A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
6
10
 
11
+ ## ARGUMENTS
12
+
13
+ *INPUT*
14
+ The input markdown file to convert.
15
+
16
+ *OUTPUT*
17
+ The output file for the man page.
18
+
19
+ ## OPTIONS
20
+
21
+ `-h`, `--help`
22
+ Prints the usage for `kramdown-man`.
23
+
7
24
  ## EXAMPLE
8
25
 
9
26
  require 'kramdown'
@@ -35,9 +52,9 @@ A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
35
52
 
36
53
  Normal paragraph.
37
54
 
38
- `command` [`--foo`] *FILE*
55
+ `command` [`--foo`] **FILE**
39
56
 
40
- `command` [`--foo`] *FILE*
57
+ `command` [`--foo`] **FILE**
41
58
 
42
59
  `--tagged`
43
60
  Text here.
@@ -1,8 +1,7 @@
1
- # encoding: utf-8
2
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
3
2
 
4
3
  # HACK: load our version of kramdown/converter/man.rb and not kramdown's
5
- require_relative '../../../lib/kramdown/converter/man'
4
+ require_relative '../../lib/kramdown/converter/man'
6
5
 
7
6
  describe Kramdown::Converter::Man do
8
7
  let(:markdown) { File.read('man/kramdown-man.1.md') }
@@ -418,8 +417,8 @@ Hello world.
418
417
  context "when there is no newline" do
419
418
  let(:doc) { Kramdown::Document.new("`#{flag}` `#{option}`") }
420
419
 
421
- it "should convert the p element into a '.HP\\n...'" do
422
- expect(subject.convert_p(p)).to eq(".HP\n\\fB#{flag}\\fR \\fB#{option}\\fR")
420
+ it "should convert the p element into a '.PP\\n...'" do
421
+ expect(subject.convert_p(p)).to eq(".PP\n\\fB#{flag}\\fR \\fB#{option}\\fR")
423
422
  end
424
423
  end
425
424
  end
@@ -463,8 +462,8 @@ Hello world.
463
462
  context "when there is no newline" do
464
463
  let(:doc) { Kramdown::Document.new("*#{flag}* *#{option}*") }
465
464
 
466
- it "should convert the p element into a '.HP\\n...'" do
467
- expect(subject.convert_p(p)).to eq(".HP\n\\fI#{escaped_flag}\\fP \\fI#{escaped_option}\\fP")
465
+ it "should convert the p element into a '.PP\\n...'" do
466
+ expect(subject.convert_p(p)).to eq(".PP\n\\fI#{escaped_flag}\\fP \\fI#{escaped_option}\\fP")
468
467
  end
469
468
  end
470
469
  end
@@ -539,14 +538,32 @@ Hello world.
539
538
  expect(subject.convert_a(link)).to eq("\n.BR #{man}")
540
539
  end
541
540
 
542
- context "when a section number is specified" do
541
+ context "and when the path is of the form 'page(section)'" do
543
542
  let(:section) { '1' }
544
543
  let(:doc) { Kramdown::Document.new("[#{man}](man:#{man}(#{section}))") }
545
544
 
546
- it "should convert the link elements into '.BR man (section)'" do
545
+ it "should convert the link elements into '.BR page (section)'" do
547
546
  expect(subject.convert_a(link)).to eq("\n.BR #{man} (#{section})")
548
547
  end
549
548
  end
549
+
550
+ context "and when the path is of the form 'page.section'" do
551
+ let(:section) { '1' }
552
+ let(:doc) { Kramdown::Document.new("[#{man}](man:#{man}.#{section})") }
553
+
554
+ it "should convert the link elements into '.BR page (section)'" do
555
+ expect(subject.convert_a(link)).to eq("\n.BR #{man} (#{section})")
556
+ end
557
+ end
558
+
559
+ context "when the path ends with a file extension" do
560
+ let(:file) { 'shard.yml' }
561
+ let(:doc) { Kramdown::Document.new("[#{man}](man:#{file})") }
562
+
563
+ it "should convert the link elements into '.BR file'" do
564
+ expect(subject.convert_a(link)).to eq("\n.BR #{file.gsub('.','\\.')}")
565
+ end
566
+ end
550
567
  end
551
568
  end
552
569
 
@@ -1,9 +1,9 @@
1
- require_relative '../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  require 'kramdown/man'
4
4
 
5
5
  describe Kramdown::Document, :integration do
6
- let(:man_dir) { File.expand_path('../../../man',__FILE__) }
6
+ let(:man_dir) { File.expand_path('../man',__dir__) }
7
7
  let(:markdown_path) { File.join(man_dir,'kramdown-man.1.md') }
8
8
  let(:markdown) { File.read(markdown_path) }
9
9
 
@@ -1,4 +1,4 @@
1
- require_relative '../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'kramdown/man'
3
3
 
4
4
  describe Kramdown::Man do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-27 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -67,15 +67,20 @@ files:
67
67
  - lib/kramdown/man/version.rb
68
68
  - man/kramdown-man.1
69
69
  - man/kramdown-man.1.md
70
- - spec/kramdown/converter/man_spec.rb
71
- - spec/kramdown/document_spec.rb
72
- - spec/kramdown/man_spec.rb
70
+ - spec/converter/man_spec.rb
71
+ - spec/document_spec.rb
72
+ - spec/man_spec.rb
73
73
  - spec/spec_helper.rb
74
74
  homepage: https://github.com/postmodern/kramdown-man#readme
75
75
  licenses:
76
76
  - MIT
77
- metadata: {}
78
- post_install_message:
77
+ metadata:
78
+ documentation_uri: https://rubydoc.info/gems/kramdown-man
79
+ source_code_uri: https://github.com/postmodern/kramdown-man
80
+ bug_tracker_uri: https://github.com/postmodern/kramdown-man/issues
81
+ changelog_uri: https://github.com/postmodern/kramdown-man/blob/master/ChangeLog.md
82
+ rubygems_mfa_required: 'true'
83
+ post_install_message:
79
84
  rdoc_options: []
80
85
  require_paths:
81
86
  - lib
@@ -90,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
95
  - !ruby/object:Gem::Version
91
96
  version: '0'
92
97
  requirements: []
93
- rubygems_version: 3.2.3
94
- signing_key:
98
+ rubygems_version: 3.4.10
99
+ signing_key:
95
100
  specification_version: 4
96
101
  summary: Converts markdown to man pages
97
102
  test_files: []