kramdown-man 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 880a3d1dd1e58aa950685bf312a66797f2d39d33c436eb9d67525289ce8abf45
4
- data.tar.gz: e2f259869cb035f4868dab9ac584da53eafacbccc76b3323c3c32deb3133163c
3
+ metadata.gz: dda435844039b4d61396829d332060c2db27506a3a7eee5d9859e09d9bd49e42
4
+ data.tar.gz: 46fcc59f2081b7aef517ab9e0e280c4961d370aecca163d78f69a8b3f26298dc
5
5
  SHA512:
6
- metadata.gz: 7d2b3f3a3fa1d58fc40e980fe8a6193746c2d6b4b38ddbbe4682b7c209128df67cc30090d08deaad0c2e59d62bec6fa3226ab7670d8d13c499c431a21a2feec9
7
- data.tar.gz: 14630b3b4ba02083266fc248b7179d409c79937f20fb81bb2feb0bf61c657b88999a8ec95e6912e1bd0bd7d0c012927d3cc58386f5cb95e4246745b698ccf0bc
6
+ metadata.gz: d81ca83bdb40321fd8ab52f2c15dc7e94d585641bac442e214a5acb4e9840f2ac38c4e4cb180d6ac03fac6852c3aeacd723988ca93bf837a226912f30cbc2f9e
7
+ data.tar.gz: 218ca5e6ee857373114abe7d50747cfa89337c0f7a172ee599fbc4e82e60cfb66f12e6ed291dc7d37d904713c0692bde5d8b1fa191d132c1578aa528832de7a8
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - 3.0
13
+ - 3.1
14
+ - 3.2
15
+ - jruby
16
+ - truffleruby
17
+ name: Ruby ${{ matrix.ruby }}
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - name: Install dependencies
25
+ run: bundle install --jobs 4 --retry 3
26
+ - name: Run tests
27
+ run: bundle exec rake test
data/ChangeLog.md CHANGED
@@ -1,3 +1,13 @@
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
+
7
+ ### 0.1.8 / 2020-12-26
8
+
9
+ * Upgrade to kramdown 2.x.
10
+
1
11
  ### 0.1.7 / 2020-07-22
2
12
 
3
13
  * Fixed a bug where kramdown's version of `kramdown/converter/man` was being
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,9 +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
-
8
- [![Build Status](https://secure.travis-ci.org/postmodern/kramdown-man.png?branch=master)](https://travis-ci.org/postmodern/kramdown-man)
9
6
 
10
7
  ## Description
11
8
 
@@ -19,10 +16,11 @@ A [Kramdown][kramdown] convert for converting Markdown files into man pages.
19
16
  * Supports bullet lists.
20
17
  * Supports multi-paragraph list items and blockquotes.
21
18
  * Supports horizontal rules.
22
- * 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.
23
21
  * Provides Rake task for converting `man/*.md` into man pages.
24
22
  * Uses the pure-Ruby [Kramdown][kramdown] markdown parser.
25
- * Supports [Ruby] 2.0 and [JRuby].
23
+ * Supports [Ruby] 3.x, [JRuby], and [TruffleRuby].
26
24
 
27
25
  ## Synopsis
28
26
 
@@ -69,9 +67,9 @@ Define a `man` and file tasks which render all `*.md` files within the
69
67
 
70
68
  Normal paragraph.
71
69
 
72
- `command` [`--foo`] *FILE*
70
+ `command` [`--foo`] **FILE**
73
71
 
74
- `command` [`--foo`] *FILE*
72
+ `command` [`--foo`] **FILE**
75
73
 
76
74
  `--tagged`
77
75
  Text here.
@@ -156,7 +154,7 @@ Email <bob@example.com>
156
154
 
157
155
  ## Requirements
158
156
 
159
- * [kramdown] ~> 1.0
157
+ * [kramdown] ~> 2.0
160
158
 
161
159
  ## Install
162
160
 
@@ -170,7 +168,7 @@ Email <bob@example.com>
170
168
 
171
169
  ## Copyright
172
170
 
173
- Copyright (c) 2013-2020 Hal Brodigan
171
+ Copyright (c) 2013-2023 Hal Brodigan
174
172
 
175
173
  See {file:LICENSE.txt} for details.
176
174
 
@@ -179,3 +177,4 @@ See {file:LICENSE.txt} for details.
179
177
 
180
178
  [Ruby]: http://www.ruby-lang.org/
181
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,8 +6,15 @@ 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
- kramdown: ~> 1.0
17
+ kramdown: ~> 2.0
11
18
 
12
19
  development_dependencies:
13
20
  bundler: ~> 2.0
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.7"
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.7
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-07-22 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,9 +49,9 @@ extra_rdoc_files:
49
49
  - README.md
50
50
  files:
51
51
  - ".document"
52
+ - ".github/workflows/ruby.yml"
52
53
  - ".gitignore"
53
54
  - ".rspec"
54
- - ".travis.yml"
55
55
  - ".yardopts"
56
56
  - ChangeLog.md
57
57
  - Gemfile
@@ -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.1.2
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: []
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- before_install:
3
- - gem update --system
4
- - gem install bundler -v "~> 2.0"
5
- language: ruby
6
- rvm:
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- - jruby
11
- script: bundle exec rake spec