md2man 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/EXAMPLE.markdown ADDED
@@ -0,0 +1,83 @@
1
+ FOO 1 "MARCH 1995" Linux "User Manuals"
2
+ =======================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ foo - frobnicate the bar library
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ `foo` [`-bar`] [`-c` *config-file* ] *file* ...
13
+
14
+ DESCRIPTION
15
+ -----------
16
+
17
+ `foo` frobnicates the bar library by tweaking internal symbol tables. By
18
+ default it parses all baz segments and rearranges them in reverse order by
19
+ time for the xyzzy(1) linker to find them. The symdef entry is then compressed
20
+ using the WBG (Whiz-Bang-Gizmo) algorithm. All files are processed in the
21
+ order specified.
22
+
23
+ OPTIONS
24
+ -------
25
+
26
+ `-b`
27
+ Do not write "busy" to stdout while processing.
28
+
29
+ `-c` *config-file*
30
+ Use the alternate system wide *config-file* instead of */etc/foo.conf*. This
31
+ overrides any `FOOCONF` environment variable.
32
+
33
+ `-a`
34
+ In addition to the baz segments, also parse the blurfl headers.
35
+
36
+ `-r`
37
+ Recursive mode. Operates as fast as lightning at the expense of a megabyte
38
+ of virtual memory.
39
+
40
+ FILES
41
+ -----
42
+
43
+ */etc/foo.conf*
44
+ The system wide configuration file. See foo(5) for further details.
45
+
46
+ *~/.foorc*
47
+ Per user configuration file. See foo(5) for further details.
48
+
49
+ ENVIRONMENT
50
+ -----------
51
+
52
+ `FOOCONF`
53
+ If non-null the full pathname for an alternate system wide */etc/foo.conf*.
54
+ Overridden by the `-c` option.
55
+
56
+ DIAGNOSTICS
57
+ -----------
58
+
59
+ The following diagnostics may be issued on stderr:
60
+
61
+ **Bad magic number.**
62
+ The input file does not look like an archive file.
63
+
64
+ **Old style baz segments.**
65
+ `foo` can only handle new style baz segments. COBOL object libraries are not
66
+ supported in this version.
67
+
68
+ BUGS
69
+ ----
70
+
71
+ The command name should have been chosen more carefully to reflect its
72
+ purpose.
73
+
74
+ AUTHOR
75
+ ------
76
+
77
+ Jens Schweikhardt <howto@schweikhardt.net>
78
+
79
+ SEE ALSO
80
+ --------
81
+
82
+ bar(1), foo(5), xyzzy(1), [Linux Man Page Howto](
83
+ http://www.schweikhardt.net/man_page_howto.html)
data/HISTORY.markdown CHANGED
@@ -1,3 +1,21 @@
1
+ ------------------------------------------------------------------------------
2
+ Version 1.0.2 (2012-01-09)
3
+ ------------------------------------------------------------------------------
4
+
5
+ External changes:
6
+
7
+ * Blockquote's leading paragraph regexp was not anchored.
8
+
9
+ * Added example input file from the Linux Man Page Howto.
10
+
11
+ Internal changes:
12
+
13
+ * Upgraded to Binman 3 for better interoperability with Bundler.
14
+
15
+ * Freezing internal constants prevents monkeypatching.
16
+
17
+ * Forgot to change project slogan in the gem package.
18
+
1
19
  ------------------------------------------------------------------------------
2
20
  Version 1.0.1 (2011-12-06)
3
21
  ------------------------------------------------------------------------------
data/README.markdown CHANGED
@@ -7,6 +7,17 @@ documents into UNIX man pages (really [Roff] documents) using [Redcarpet2].
7
7
  [Roff]: http://troff.org
8
8
  [Markdown]: http://daringfireball.net/projects/markdown/
9
9
  [Redcarpet2]: https://github.com/tanoku/redcarpet
10
+ [example]: https://raw.github.com/sunaku/md2man/master/EXAMPLE.markdown
11
+
12
+ ------------------------------------------------------------------------------
13
+ Demonstration
14
+ ------------------------------------------------------------------------------
15
+
16
+ Try converting [this example Markdown file][example] into a UNIX man page:
17
+
18
+ md2man EXAMPLE.markdown | man -l -
19
+
20
+ ![Obligatory screenshot of md2man(1) in action!](http://ompldr.org/vYnFvbw)
10
21
 
11
22
  ------------------------------------------------------------------------------
12
23
  Installation
data/Rakefile CHANGED
@@ -1 +1,2 @@
1
1
  require "bundler/gem_tasks"
2
+ require "binman/rakefile"
data/bin/md2man CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- MD2MAN 1 "2011-12-06" "1.0.1"
4
+ MD2MAN 1 "2012-01-09" "1.0.2"
5
5
  =============================
6
6
 
7
7
  NAME
data/lib/md2man/roff.rb CHANGED
@@ -51,7 +51,7 @@ module Roff
51
51
  end
52
52
 
53
53
  def block_quote quote
54
- "\n.RS\n#{quote.sub(/\n\.PP\n/, '').chomp}\n.RE\n"
54
+ "\n.RS\n#{remove_leading_pp(quote).chomp}\n.RE\n"
55
55
  end
56
56
 
57
57
  def block_html html
@@ -93,7 +93,7 @@ module Roff
93
93
  "\\(bu 2"
94
94
  end
95
95
 
96
- ".IP #{designator}\n#{text.sub(/\A\n\.PP\n/, '').lstrip.chomp}\n"
96
+ ".IP #{designator}\n#{remove_leading_pp(text).lstrip.chomp}\n"
97
97
  end
98
98
 
99
99
  def table header, body
@@ -203,6 +203,10 @@ module Roff
203
203
 
204
204
  private
205
205
 
206
+ def remove_leading_pp text
207
+ text.sub(/\A\n\.PP\n/, '')
208
+ end
209
+
206
210
  TABLE_COL_DELIM = ' '
207
211
  TABLE_ROW_DELIM = "\n"
208
212
  TABLE_CELL_DELIM = "\t"
@@ -501,7 +505,7 @@ private
501
505
  '&clubs;' => 0x2663,
502
506
  '&hearts;' => 0x2665,
503
507
  '&diams;' => 0x2666,
504
- }.freeze
508
+ }
505
509
 
506
510
  # see groff_char(7) and "Special Characters" in groff(7)
507
511
  UNICODE_TO_GLYPH = {
@@ -845,7 +849,7 @@ private
845
849
  0x2713 => "\\[OK]",
846
850
  0x27e8 => "\\[la]",
847
851
  0x27e9 => "\\[ra]",
848
- }.freeze
852
+ }
849
853
 
850
854
  end
851
855
  end
@@ -1,3 +1,3 @@
1
1
  module Md2Man
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/man/man1/md2man.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH MD2MAN 1 "2011\-12\-06" "1.0.1"
1
+ .TH MD2MAN 1 "2012\-01\-09" "1.0.2"
2
2
  .SH NAME
3
3
  .PP
4
4
  md2man \- convert
data/md2man.gemspec CHANGED
@@ -1,25 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "md2man/version"
4
- require "binman/gemspec"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = "md2man"
8
- s.version = Md2Man::VERSION
6
+ s.name = "md2man"
7
+ s.version = Md2Man::VERSION
9
8
  s.authors,
10
- s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
11
- s.homepage = "http://github.com/sunaku/md2man"
12
- s.summary = "UNIX man pages using Redcarpet2"
13
- s.description = nil
9
+ s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
10
+ s.homepage = "http://github.com/sunaku/md2man"
11
+ s.summary = "write UNIX man pages in Markdown"
12
+ s.description = nil
14
13
 
15
- s.files = `git ls-files`.split("\n")
14
+ s.files = `git ls-files`.split("\n") + Dir["man/**/*"]
16
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
17
  s.require_paths = ["lib"]
19
18
 
20
- # specify any dependencies here; for example:
21
- # s.add_development_dependency "rspec"
22
- # s.add_runtime_dependency "rest-client"
19
+ s.add_runtime_dependency "binman", "~> 3"
23
20
  s.add_runtime_dependency "redcarpet", ">= 2.0.0b5", "< 3"
24
21
  s.add_development_dependency "minitest", ">= 2.7.0", "< 3"
25
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md2man
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,69 +9,47 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-07 00:00:00.000000000 Z
12
+ date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: redcarpet
16
- requirement: &17975560 !ruby/object:Gem::Requirement
15
+ name: binman
16
+ requirement: &19172000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 2.0.0b5
22
- - - <
19
+ - - ~>
23
20
  - !ruby/object:Gem::Version
24
21
  version: '3'
25
22
  type: :runtime
26
23
  prerelease: false
27
- version_requirements: *17975560
24
+ version_requirements: *19172000
28
25
  - !ruby/object:Gem::Dependency
29
- name: minitest
30
- requirement: &17970340 !ruby/object:Gem::Requirement
26
+ name: redcarpet
27
+ requirement: &19171460 !ruby/object:Gem::Requirement
31
28
  none: false
32
29
  requirements:
33
30
  - - ! '>='
34
31
  - !ruby/object:Gem::Version
35
- version: 2.7.0
32
+ version: 2.0.0b5
36
33
  - - <
37
34
  - !ruby/object:Gem::Version
38
35
  version: '3'
39
- type: :development
40
- prerelease: false
41
- version_requirements: *17970340
42
- - !ruby/object:Gem::Dependency
43
- name: binman
44
- requirement: &22522240 !ruby/object:Gem::Requirement
45
- none: false
46
- requirements:
47
- - - ~>
48
- - !ruby/object:Gem::Version
49
- version: '2'
50
36
  type: :runtime
51
37
  prerelease: false
52
- version_requirements: *22522240
38
+ version_requirements: *19171460
53
39
  - !ruby/object:Gem::Dependency
54
- name: binman
55
- requirement: &27521920 !ruby/object:Gem::Requirement
40
+ name: minitest
41
+ requirement: &19170380 !ruby/object:Gem::Requirement
56
42
  none: false
57
43
  requirements:
58
- - - ~>
44
+ - - ! '>='
59
45
  - !ruby/object:Gem::Version
60
- version: '2'
61
- type: :development
62
- prerelease: false
63
- version_requirements: *27521920
64
- - !ruby/object:Gem::Dependency
65
- name: md2man
66
- requirement: &27521380 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ~>
46
+ version: 2.7.0
47
+ - - <
70
48
  - !ruby/object:Gem::Version
71
- version: '1'
49
+ version: '3'
72
50
  type: :development
73
51
  prerelease: false
74
- version_requirements: *27521380
52
+ version_requirements: *19170380
75
53
  description: ''
76
54
  email:
77
55
  - sunaku@gmail.com
@@ -81,6 +59,7 @@ extensions: []
81
59
  extra_rdoc_files: []
82
60
  files:
83
61
  - .gitignore
62
+ - EXAMPLE.markdown
84
63
  - Gemfile
85
64
  - HISTORY.markdown
86
65
  - LICENSE
@@ -118,7 +97,7 @@ rubyforge_project:
118
97
  rubygems_version: 1.8.11
119
98
  signing_key:
120
99
  specification_version: 3
121
- summary: UNIX man pages using Redcarpet2
100
+ summary: write UNIX man pages in Markdown
122
101
  test_files:
123
102
  - test/md2man/roff_test.rb
124
103
  - test/test_helper.rb