md2man 1.0.2 → 1.1.0

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.
data/HISTORY.markdown CHANGED
@@ -1,54 +1,75 @@
1
+ ------------------------------------------------------------------------------
2
+ Version 1.1.0 (2012-02-02)
3
+ ------------------------------------------------------------------------------
4
+
5
+ Improvements:
6
+
7
+ * Add `Md2Man::Document` module for programmatic processing of
8
+ cross-references to other UNIX manual pages within Redcarpet.
9
+
10
+ Housekeeping:
11
+
12
+ * README: not all systems support `man -l` option.
13
+
14
+ * gemspec: upgrade to redcarpet 2.1.0.
15
+
16
+ * bundler suggests moving all dev deps into gemspec.
17
+
18
+ * README: fix installation commands for development.
19
+
20
+ * README: simplify project slogan to be more memorable.
21
+
1
22
  ------------------------------------------------------------------------------
2
23
  Version 1.0.2 (2012-01-09)
3
24
  ------------------------------------------------------------------------------
4
25
 
5
- External changes:
26
+ Corrections:
6
27
 
7
- * Blockquote's leading paragraph regexp was not anchored.
28
+ * Blockquote's leading paragraph regexp was not anchored.
8
29
 
9
- * Added example input file from the Linux Man Page Howto.
30
+ * Freezing internal constants prevents monkey patching.
10
31
 
11
- Internal changes:
32
+ Housekeeping:
12
33
 
13
- * Upgraded to Binman 3 for better interoperability with Bundler.
34
+ * Upgraded to Binman 3 for better interoperability with Bundler.
14
35
 
15
- * Freezing internal constants prevents monkeypatching.
36
+ * Added example input file from the Linux Man Page Howto.
16
37
 
17
- * Forgot to change project slogan in the gem package.
38
+ * Forgot to change project slogan in the gem package.
18
39
 
19
40
  ------------------------------------------------------------------------------
20
41
  Version 1.0.1 (2011-12-06)
21
42
  ------------------------------------------------------------------------------
22
43
 
23
- Breaking changes:
44
+ Divergences:
24
45
 
25
- * Renamed the project from "redcarpet-manpage" to "md2man".
46
+ * Renamed the project from "redcarpet-manpage" to "md2man".
26
47
 
27
- * `RedcarpetManpage::Renderer` is now `Md2Man::Engine`.
48
+ * `RedcarpetManpage::Renderer` is now `Md2Man::Engine`.
28
49
 
29
- * `RedcarpetManpage::RENDERER` is now `Md2Man::ENGINE`.
50
+ * `RedcarpetManpage::RENDERER` is now `Md2Man::ENGINE`.
30
51
 
31
- * Tagged paragraphs no longer require the first line to begin with italic or
32
- bold styling. All that matters is that the subsequent lines are indented.
52
+ * Tagged paragraphs no longer require the first line to begin with italic or
53
+ bold styling. All that matters is that the subsequent lines are indented.
33
54
 
34
- External changes:
55
+ Improvements:
35
56
 
36
- * Added md2man(1) executable for command-line usage.
57
+ * Added md2man(1) executable for command-line usage.
37
58
 
38
- * Added support for all HTML 4.0 and XHTML 1.0 entities.
59
+ * Added support for all HTML 4.0 and XHTML 1.0 entities.
39
60
 
40
- * Added support for tables, horizontal rules, and more.
61
+ * Added support for tables, horizontal rules, and more.
41
62
 
42
- * Added `Md2Man::Roff` mixin for advanced Redcarpet2 usage.
63
+ * Added `Md2Man::Roff` mixin for advanced Redcarpet2 usage.
43
64
 
44
- * Improved README with some new and revised documentation.
65
+ * Improved README with some new and revised documentation.
45
66
 
46
- Internal changes:
67
+ Housekeeping:
47
68
 
48
- * Rewrote entire Markdown to Roff conversion from scratch while doing TDD.
69
+ * Rewrote entire Markdown to Roff conversion from scratch while doing TDD.
49
70
 
50
71
  ------------------------------------------------------------------------------
51
72
  Version 0.0.1 (2011-10-13)
52
73
  ------------------------------------------------------------------------------
53
74
 
54
- * First release! Happy birthday! Woohoo! :-)
75
+ First release! Happy birthday! Woohoo! :-)
data/README.markdown CHANGED
@@ -1,4 +1,4 @@
1
- md2man - write UNIX man pages in Markdown
1
+ md2man - markdown to manpage
2
2
  ==============================================================================
3
3
 
4
4
  md2man is a Ruby library and command-line program that converts [Markdown]
@@ -15,7 +15,7 @@ Demonstration
15
15
 
16
16
  Try converting [this example Markdown file][example] into a UNIX man page:
17
17
 
18
- md2man EXAMPLE.markdown | man -l -
18
+ md2man EXAMPLE.markdown > EXAMPLE.man && man ./EXAMPLE.man
19
19
 
20
20
  ![Obligatory screenshot of md2man(1) in action!](http://ompldr.org/vYnFvbw)
21
21
 
@@ -23,27 +23,25 @@ Try converting [this example Markdown file][example] into a UNIX man page:
23
23
  Installation
24
24
  ------------------------------------------------------------------------------
25
25
 
26
- As a Ruby gem:
27
-
28
26
  gem install md2man
29
27
 
30
- As a Git clone:
28
+ ### Development
31
29
 
32
30
  git clone git://github.com/sunaku/md2man
33
31
  cd md2man
34
- bundle install
32
+ bundle install --binstubs=bundle_bin
33
+ bundle_bin/md2man --help # run it directly
34
+ bundle exec rake -T # packaging tasks
35
35
 
36
36
  ------------------------------------------------------------------------------
37
- Command Usage
37
+ Usage
38
38
  ------------------------------------------------------------------------------
39
39
 
40
- Read the manual page:
40
+ ### At the command line
41
41
 
42
42
  md2man --help
43
43
 
44
- ------------------------------------------------------------------------------
45
- Library Usage
46
- ------------------------------------------------------------------------------
44
+ ### In your Ruby scripts
47
45
 
48
46
  Use the default renderer:
49
47
 
@@ -80,7 +78,7 @@ Mix-in your own renderer:
80
78
  your_roff_output = engine.render(your_markdown_input)
81
79
 
82
80
  ------------------------------------------------------------------------------
83
- Document Format
81
+ Document format
84
82
  ------------------------------------------------------------------------------
85
83
 
86
84
  md2man attaches the following additional semantics to its [Markdown] input:
@@ -97,7 +95,7 @@ md2man attaches the following additional semantics to its [Markdown] input:
97
95
  are unindented accordingly before emission as `.TP` in the [Roff] output.
98
96
 
99
97
  ------------------------------------------------------------------------------
100
- Limitations
98
+ Known issues
101
99
  ------------------------------------------------------------------------------
102
100
 
103
101
  At present, md2man does not translate the following [Redcarpet2] node types:
data/bin/md2man CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
3
 
4
- MD2MAN 1 "2012-01-09" "1.0.2"
4
+ MD2MAN 1 "2012-02-02" "1.1.0"
5
5
  =============================
6
6
 
7
7
  NAME
@@ -0,0 +1,14 @@
1
+ module Md2Man
2
+ module Document
3
+
4
+ def postprocess document
5
+ # encode references to other manual pages
6
+ document.gsub(/(\S+)\(([1-9nol])\)([[:punct:]]?\s*)/){ reference $1,$2,$3 }
7
+ end
8
+
9
+ def reference page, section, addendum
10
+ warn "md2man/document: reference not implemented: #{page}(#{section})"
11
+ end
12
+
13
+ end
14
+ end
data/lib/md2man/roff.rb CHANGED
@@ -1,6 +1,10 @@
1
+ require 'md2man/document'
2
+
1
3
  module Md2Man
2
4
  module Roff
3
5
 
6
+ include Document
7
+
4
8
  #---------------------------------------------------------------------------
5
9
  # document-level processing
6
10
  #---------------------------------------------------------------------------
@@ -12,14 +16,11 @@ module Roff
12
16
  end
13
17
 
14
18
  def postprocess document
15
- document.strip.
19
+ super.strip.
16
20
 
17
21
  # ensure that spaces after URLs appear properly
18
22
  gsub(/(?<=^\.[UM]E) \s/, "\n").
19
23
 
20
- # encode references to other man pages as "hyperlinks"
21
- gsub(/(\S+)(\([1-9nol]\)[[:punct:]]?\s*)/, "\n.BR \\1 \\2\n").
22
-
23
24
  # squeeze blank lines to prevent double-spaced output
24
25
  gsub(/^\n/, '')
25
26
  end
@@ -130,6 +131,10 @@ module Roff
130
131
  # span-level processing
131
132
  #---------------------------------------------------------------------------
132
133
 
134
+ def reference page, section, addendum
135
+ "\n.BR #{page} (#{section})#{addendum}\n"
136
+ end
137
+
133
138
  def linebreak
134
139
  "\n.br\n"
135
140
  end
@@ -1,3 +1,3 @@
1
1
  module Md2Man
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
data/man/man1/md2man.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH MD2MAN 1 "2012\-01\-09" "1.0.2"
1
+ .TH MD2MAN 1 "2012\-02\-02" "1.1.0"
2
2
  .SH NAME
3
3
  .PP
4
4
  md2man \- convert
@@ -76,4 +76,4 @@ Display this help manual using
76
76
  .SH SEE ALSO
77
77
  .PP
78
78
  .BR markdown (7),
79
- .BR roff (7)
79
+ .BR roff (7)
data/md2man.gemspec CHANGED
@@ -8,15 +8,16 @@ Gem::Specification.new do |s|
8
8
  s.authors,
9
9
  s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
10
10
  s.homepage = "http://github.com/sunaku/md2man"
11
- s.summary = "write UNIX man pages in Markdown"
12
- s.description = nil
11
+ s.summary = "Markdown to manpage."
12
+ s.description = "Write UNIX man pages in Markdown."
13
13
 
14
14
  s.files = `git ls-files`.split("\n") + Dir["man/**/*"]
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_runtime_dependency "binman", "~> 3"
20
- s.add_runtime_dependency "redcarpet", ">= 2.0.0b5", "< 3"
21
- s.add_development_dependency "minitest", ">= 2.7.0", "< 3"
19
+ s.add_runtime_dependency 'binman', '~> 3'
20
+ s.add_runtime_dependency 'redcarpet', '>= 2.1.0', '< 3'
21
+ s.add_development_dependency 'minitest', '>= 2.7.0', '< 3'
22
+ s.add_development_dependency 'rake', '>= 0.9.2.2', '< 1'
22
23
  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.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-10 00:00:00.000000000 Z
12
+ date: 2012-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: binman
16
- requirement: &19172000 !ruby/object:Gem::Requirement
16
+ requirement: &24893480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,24 +21,24 @@ dependencies:
21
21
  version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19172000
24
+ version_requirements: *24893480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redcarpet
27
- requirement: &19171460 !ruby/object:Gem::Requirement
27
+ requirement: &24892820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.0b5
32
+ version: 2.1.0
33
33
  - - <
34
34
  - !ruby/object:Gem::Version
35
35
  version: '3'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *19171460
38
+ version_requirements: *24892820
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: minitest
41
- requirement: &19170380 !ruby/object:Gem::Requirement
41
+ requirement: &24891000 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -49,8 +49,22 @@ dependencies:
49
49
  version: '3'
50
50
  type: :development
51
51
  prerelease: false
52
- version_requirements: *19170380
53
- description: ''
52
+ version_requirements: *24891000
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
55
+ requirement: &24888980 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: 0.9.2.2
61
+ - - <
62
+ - !ruby/object:Gem::Version
63
+ version: '1'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: *24888980
67
+ description: Write UNIX man pages in Markdown.
54
68
  email:
55
69
  - sunaku@gmail.com
56
70
  executables:
@@ -67,6 +81,7 @@ files:
67
81
  - Rakefile
68
82
  - bin/md2man
69
83
  - lib/md2man.rb
84
+ - lib/md2man/document.rb
70
85
  - lib/md2man/engine.rb
71
86
  - lib/md2man/roff.rb
72
87
  - lib/md2man/version.rb
@@ -86,19 +101,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
101
  - - ! '>='
87
102
  - !ruby/object:Gem::Version
88
103
  version: '0'
104
+ segments:
105
+ - 0
106
+ hash: -102355908338846194
89
107
  required_rubygems_version: !ruby/object:Gem::Requirement
90
108
  none: false
91
109
  requirements:
92
110
  - - ! '>='
93
111
  - !ruby/object:Gem::Version
94
112
  version: '0'
113
+ segments:
114
+ - 0
115
+ hash: -102355908338846194
95
116
  requirements: []
96
117
  rubyforge_project:
97
118
  rubygems_version: 1.8.11
98
119
  signing_key:
99
120
  specification_version: 3
100
- summary: write UNIX man pages in Markdown
121
+ summary: Markdown to manpage.
101
122
  test_files:
102
123
  - test/md2man/roff_test.rb
103
124
  - test/test_helper.rb
104
- has_rdoc: