md2man 5.0.3 → 5.1.0

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
  SHA1:
3
- metadata.gz: fed108c801a748ce17e7b401494b90ff77b3a18a
4
- data.tar.gz: 7bb491d3120e92aa877f537683634d5ef53b350b
3
+ metadata.gz: e2b43ab0002aa28599a544ae6b69821c1beb5c0c
4
+ data.tar.gz: 1f648fe79e0cad50810c1b4c6d2dca2d6dd438c8
5
5
  SHA512:
6
- metadata.gz: dd28d0dfad989ae8ac9d476f7a8a24ab61d08b90fa1efca4dea2f38ee111dccbd5341d25ab586335206f7156944521d1e8057501a569922e10eebad6ef898cbb
7
- data.tar.gz: 6507bcc13ae9c1ff181423648c15867884e85e99a34c8d22be52f31f055287afbbead53413688a3e5d2ed146cb787f3729621d3172a4b32b21653e33e00eebfb
6
+ metadata.gz: f9d194ed93f611e4e65fcb19c510aa1d8f434cd9bb48120a8d0e14e79fbfebf00e3e092b5dc53e4d2e1a7190599f9006c6de9dc525ae598a5bd81bdaf5db9d08
7
+ data.tar.gz: b4c861ff0edd218ada2239e764283ed443114fb7ac0a1e8c6cb6e44f85eca86c2e78fd4de16b1d1a0fbff4841500f6942db3f4e0732fd22404b686ebc05f320c
@@ -5,7 +5,7 @@
5
5
  # md2man - markdown to manpage
6
6
 
7
7
  md2man is a Ruby library and a set of command-line programs that convert
8
- [Markdown] into UNIX manual pages (both [roff] and HTML) using [Redcarpet].
8
+ [Markdown] into UNIX manpages as well as HTML webpages using [Redcarpet].
9
9
 
10
10
  ## Features
11
11
 
@@ -188,7 +188,7 @@ engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
188
188
  your_html_output = engine.render(your_markdown_input)
189
189
  ```
190
190
 
191
- ### Building man pages
191
+ ### Building manpages
192
192
 
193
193
  #### At the command line
194
194
 
@@ -203,8 +203,8 @@ md2man-rake --help
203
203
  Add this snippet to your gemspec file:
204
204
 
205
205
  ```ruby
206
- s.files += Dir['man/man?/*.?'] # UNIX man pages
207
- s.files += Dir['man/**/*.{html,css,js}'] # HTML man pages
206
+ s.files += Dir['man/man?/*.?'] # UNIX manpages
207
+ s.files += Dir['man/**/*.{html,css}'] # HTML manpages
208
208
  s.add_development_dependency 'md2man', '~> 5.0'
209
209
  ```
210
210
 
@@ -231,6 +231,6 @@ gem spec pkg/*.gem | fgrep man/
231
231
  Released under the ISC license. See the LICENSE file for details.
232
232
 
233
233
  [roff]: http://troff.org
234
- [Markdown]: http://daringfireball.net/projects/markdown/
235
234
  [Redcarpet]: https://github.com/vmg/redcarpet
235
+ [Markdown]: http://daringfireball.net/projects/markdown/
236
236
  [tables]: http://michelf.com/projects/php-markdown/extra/#table
@@ -1,3 +1,27 @@
1
+ ## Version 5.1.0 (2016-02-28)
2
+
3
+ ### Minor:
4
+
5
+ * md2man-html(1): add syntax highlighting to fenced code blocks.
6
+
7
+ * md2man-rake(1): add directory name to README and "man/index" title.
8
+
9
+ Fallback to adding directory name for standalone titles, such as "README"
10
+ and "man/index", so that users know what project those manuals belong to.
11
+
12
+ * md2man-rake(1): allow running task names without namespace.
13
+
14
+ You can now run `md2man-rake man` instead of `md2man-rake md2man:man`,
15
+ and similarly `md2man-rake web` instead of `md2man-rake md2man:web`.
16
+
17
+ ### Patch:
18
+
19
+ * Clarify optionalness of PATTERN in `--help` option.
20
+
21
+ * md2man(5): paragraph types reflect .PP, .TP, .IP.
22
+
23
+ * Link to Markdown website instead of markdown(7).
24
+
1
25
  ## Version 5.0.3 (2016-02-21)
2
26
 
3
27
  This release fixes a crash, fixes roff bugs, improves CSS styling for HTML
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # MD2MAN-HTML 1 2016-02-21 5.0.3
4
+ # MD2MAN-HTML 1 2016-02-28 5.1.0
5
5
 
6
6
  ## NAME
7
7
 
8
- md2man-html - convert md2man(5) flavored markdown(7) into HTML
8
+ md2man-html - convert md2man(5) flavored [Markdown] text into HTML
9
9
 
10
10
  ## SYNOPSIS
11
11
 
@@ -13,7 +13,7 @@ md2man-html - convert md2man(5) flavored markdown(7) into HTML
13
13
 
14
14
  ## DESCRIPTION
15
15
 
16
- This program converts md2man(5) flavored markdown(7) input from the given
16
+ This program converts the md2man(5) flavored [Markdown] text from the given
17
17
  *FILE* into HTML and then prints the result to the standard output stream.
18
18
  If *FILE* is not given, then the standard input stream is read in its place.
19
19
 
@@ -22,11 +22,13 @@ If *FILE* is not given, then the standard input stream is read in its place.
22
22
  Each component of the `.TH` directive in roff(7), described under "Top-level
23
23
  headings" in md2man(5), is wrapped in stylable `<span>` elements as follows:
24
24
 
25
- <span class="md2man-title">...</span>
26
- <span class="md2man-section">...</span>
27
- <span class="md2man-date">...</span>
28
- <span class="md2man-source">...</span>
29
- <span class="md2man-manual">...</span>
25
+ ```html
26
+ <span class="md2man-title">...</span>
27
+ <span class="md2man-section">...</span>
28
+ <span class="md2man-date">...</span>
29
+ <span class="md2man-source">...</span>
30
+ <span class="md2man-manual">...</span>
31
+ ```
30
32
 
31
33
  ### Heading permalinks
32
34
 
@@ -36,19 +38,23 @@ lowercase, and squeezed and stripped of HTML tags and non-word characters.
36
38
 
37
39
  For example, a heading labeled `Ver<s>iON 3(2</s>!4)))` would be emitted as:
38
40
 
39
- <h2 id="ver-ion-3-2-4">Ver<s>iON 3(2</s>!4)))<a name="ver-ion-3-2-4"
40
- href="#ver-ion-3-2-4" class="md2man-permalink" title="permalink"></a></h2>
41
+ ```html
42
+ <h2 id="ver-ion-3-2-4">Ver<s>iON 3(2</s>!4)))<a name="ver-ion-3-2-4"
43
+ href="#ver-ion-3-2-4" class="md2man-permalink" title="permalink"></a></h2>
44
+ ```
41
45
 
42
46
  For example, multiple headings labeled `Hello, world!` would be emitted as:
43
47
 
44
- <h2 id="hello-world">Hello, world!<a name="hello-world"
45
- href="#hello-world" class="md2man-permalink" title="permalink"></a></h2>
48
+ ```html
49
+ <h2 id="hello-world">Hello, world!<a name="hello-world"
50
+ href="#hello-world" class="md2man-permalink" title="permalink"></a></h2>
46
51
 
47
- <h2 id="hello-world-1">Hello, world!<a name="hello-world-1"
48
- href="#hello-world-1" class="md2man-permalink" title="permalink"></a></h2>
52
+ <h2 id="hello-world-1">Hello, world!<a name="hello-world-1"
53
+ href="#hello-world-1" class="md2man-permalink" title="permalink"></a></h2>
49
54
 
50
- <h2 id="hello-world-2">Hello, world!<a name="hello-world-2"
51
- href="#hello-world-2" class="md2man-permalink" title="permalink"></a></h2>
55
+ <h2 id="hello-world-2">Hello, world!<a name="hello-world-2"
56
+ href="#hello-world-2" class="md2man-permalink" title="permalink"></a></h2>
57
+ ```
52
58
 
53
59
  ### Cross references
54
60
 
@@ -58,16 +64,20 @@ attributes.
58
64
 
59
65
  For example, the `printf(3)` cross reference would be emitted as this HTML:
60
66
 
61
- <a class="md2man-reference" href="../man3/printf.3.html">printf(3)</a>
67
+ ```html
68
+ <a class="md2man-reference" href="../man3/printf.3.html">printf(3)</a>
69
+ ```
62
70
 
63
71
  ## OPTIONS
64
72
 
65
73
  `-h` [*PATTERN*], `--help` [*PATTERN*]
66
- Show this help manual and search for *PATTERN* regular expression therein.
74
+ Show this help manual and optionally search for *PATTERN* regular expression.
67
75
 
68
76
  ## SEE ALSO
69
77
 
70
- md2man-roff(1), md2man-rake(1), md2man(5)
78
+ md2man-roff(1), md2man-rake(1), md2man(5), [Markdown]
79
+
80
+ [Markdown]: http://daringfireball.net/projects/markdown/syntax
71
81
 
72
82
  =end =========================================================================
73
83
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # MD2MAN-RAKE 1 2016-02-21 5.0.3
4
+ # MD2MAN-RAKE 1 2016-02-28 5.1.0
5
5
 
6
6
  ## NAME
7
7
 
@@ -25,20 +25,21 @@ If no *TASK* is specified, then the `md2man` task is run by default.
25
25
  `md2man`
26
26
  Runs the `md2man:man` and `md2man:web` tasks, in that order.
27
27
 
28
- `md2man:man`
28
+ `md2man:man` or `man`
29
29
  Builds UNIX manual pages from `*.markdown`, `*.mkd`, and `*.md` files
30
30
  found in or beneath the `man/` subdirectory in your working directory.
31
31
 
32
- `md2man:web`
32
+ `md2man:web` or `web`
33
33
  Builds HTML manual pages from `*.markdown`, `*.mkd`, and `*.md` files
34
34
  found in or beneath the `man/` subdirectory in your working directory.
35
35
 
36
36
  ## OPTIONS
37
37
 
38
38
  `-h` [*PATTERN*], `--help` [*PATTERN*]
39
- Show this help manual and search for *PATTERN* regular expression therein.
39
+ Show this help manual and optionally search for *PATTERN* regular expression.
40
40
 
41
- Run `rake --help` to see more options.
41
+ ...
42
+ Anything else is passed to rake(1); run `rake --help` for documentation.
42
43
 
43
44
  ## SEE ALSO
44
45
 
@@ -54,5 +55,7 @@ Rake.application.init File.basename(__FILE__)
54
55
 
55
56
  require 'md2man/rakefile'
56
57
  task :default => :md2man
58
+ task :man => 'md2man:man'
59
+ task :web => 'md2man:web'
57
60
 
58
61
  Rake.application.top_level
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # MD2MAN-ROFF 1 2016-02-21 5.0.3
4
+ # MD2MAN-ROFF 1 2016-02-28 5.1.0
5
5
 
6
6
  ## NAME
7
7
 
8
- md2man-roff - convert md2man(5) flavored markdown(7) into roff(7)
8
+ md2man-roff - convert md2man(5) flavored [Markdown] text into roff(7)
9
9
 
10
10
  ## SYNOPSIS
11
11
 
@@ -13,7 +13,7 @@ md2man-roff - convert md2man(5) flavored markdown(7) into roff(7)
13
13
 
14
14
  ## DESCRIPTION
15
15
 
16
- This program converts md2man(5) flavored markdown(7) input from the given
16
+ This program converts the md2man(5) flavored [Markdown] text from the given
17
17
  *FILE* into roff(7) and then prints the result to the standard output stream.
18
18
  If *FILE* is not given, then the standard input stream is read in its place.
19
19
 
@@ -32,13 +32,14 @@ It issues a warning when it encounters these instead. Patches are welcome!
32
32
  ## OPTIONS
33
33
 
34
34
  `-h` [*PATTERN*], `--help` [*PATTERN*]
35
- Show this help manual and search for *PATTERN* regular expression therein.
35
+ Show this help manual and optionally search for *PATTERN* regular expression.
36
36
 
37
37
  ## SEE ALSO
38
38
 
39
- md2man-html(1), md2man-rake(1), md2man(5)
39
+ md2man-html(1), md2man-rake(1), md2man(5), [Markdown]
40
40
 
41
41
  [Redcarpet]: https://github.com/vmg/redcarpet
42
+ [Markdown]: http://daringfireball.net/projects/markdown/syntax
42
43
 
43
44
  =end =========================================================================
44
45
 
@@ -63,8 +63,14 @@ module Md2Man::HTML
63
63
  ].join
64
64
  end
65
65
 
66
+ SYNTAX_HIGHLIGHTER = Class.new do
67
+ require 'rouge'
68
+ require 'rouge/plugins/redcarpet'
69
+ extend Rouge::Plugins::Redcarpet
70
+ end
71
+
66
72
  def block_code code, language
67
- "<pre><code>#{CGI.escape_html super}</code></pre>\n"
73
+ SYNTAX_HIGHLIGHTER.block_code super, language
68
74
  end
69
75
 
70
76
  #---------------------------------------------------------------------------
@@ -67,6 +67,12 @@ parse_manpage_info = lambda do |html_file_body|
67
67
  end
68
68
  end
69
69
 
70
+ build_html_title = lambda do |title, info|
71
+ # fallback to adding directory name for standalone titles, such as "README"
72
+ # and "man/index", so that users know what project those manuals belong to
73
+ [title, info || Dir.pwd.pathmap('%n')].join(' &mdash; ')
74
+ end
75
+
70
76
  directory 'man'
71
77
 
72
78
  file 'man/index.html' => ['man'] + webs do |t|
@@ -86,13 +92,19 @@ file 'man/index.html' => ['man'] + webs do |t|
86
92
  buffer << '</div>'
87
93
  content = buffer.join
88
94
 
89
- title = t.name.pathmap('%X')
95
+ title = build_html_title.call(t.name.pathmap('%X'), nil)
90
96
  output = wrap_html_template.call(title, content, nil)
91
97
  File.open(t.name, 'w') {|f| f << output }
92
98
  end
93
99
 
94
100
  file 'man/style.css' => ['man', __FILE__.pathmap('%X/style.css')] do |t|
95
- cp t.prerequisites.last, t.name if t.needed?
101
+ cp t.prerequisites.last, t.name
102
+
103
+ # add syntax highlighting theme
104
+ File.open(t.name, 'a') do |css|
105
+ require 'rouge'
106
+ css << Rouge::Themes::Github.render
107
+ end
96
108
  end
97
109
 
98
110
  mkds.zip(webs).each do |src, dst|
@@ -106,7 +118,7 @@ mkds.zip(webs).each do |src, dst|
106
118
 
107
119
  name = parse_manpage_name.call(dst)
108
120
  info = parse_manpage_info.call(output)
109
- title = [name, info].compact.join(' &mdash; ')
121
+ title = build_html_title.call(name, info)
110
122
 
111
123
  subdir = dst.pathmap('%d').sub('man/', '')
112
124
  ascent = '../' * (dst.count('/') - 1)
@@ -1,3 +1,3 @@
1
1
  module Md2Man
2
- VERSION = "5.0.3"
2
+ VERSION = "5.1.0"
3
3
  end
@@ -2,10 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <meta name="generator" content="md2man 5.0.3 https://github.com/sunaku/md2man" />
6
- <title>man/index</title>
5
+ <meta name="generator" content="md2man 5.1.0 https://github.com/sunaku/md2man" />
6
+ <title>man/index &mdash; md2man</title>
7
7
  <link rel="stylesheet" href="style.css"/>
8
8
  <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
9
9
  </head>
10
- <body><div class="container-fluid"><h2 id="man0">man0</h2><dl class="dl-horizontal"><dt><a href="man0/EXAMPLE.html">EXAMPLE</a></dt><dd>frobnicate the bar library</dd></dl><dl class="dl-horizontal"><dt><a href="man0/README.html">README</a></dt><dd></dd></dl><dl class="dl-horizontal"><dt><a href="man0/VERSION.html">VERSION</a></dt><dd></dd></dl><h2 id="man1">man1</h2><dl class="dl-horizontal"><dt><a href="man1/md2man-html.1.html">md2man-html(1)</a></dt><dd>convert md2man(5) flavored markdown(7) into HTML</dd></dl><dl class="dl-horizontal"><dt><a href="man1/md2man-rake.1.html">md2man-rake(1)</a></dt><dd>run rake(1) tasks from md2man(1)</dd></dl><dl class="dl-horizontal"><dt><a href="man1/md2man-roff.1.html">md2man-roff(1)</a></dt><dd>convert md2man(5) flavored markdown(7) into roff(7)</dd></dl><h2 id="man5">man5</h2><dl class="dl-horizontal"><dt><a href="man5/md2man.5.html">md2man(5)</a></dt><dd>UNIX manual page flavoring for the markdown(7) file format</dd></dl></div></body>
10
+ <body><div class="container-fluid"><h2 id="man0">man0</h2><dl class="dl-horizontal"><dt><a href="man0/EXAMPLE.html">EXAMPLE</a></dt><dd>frobnicate the bar library</dd></dl><dl class="dl-horizontal"><dt><a href="man0/README.html">README</a></dt><dd></dd></dl><dl class="dl-horizontal"><dt><a href="man0/VERSION.html">VERSION</a></dt><dd></dd></dl><h2 id="man1">man1</h2><dl class="dl-horizontal"><dt><a href="man1/md2man-html.1.html">md2man-html(1)</a></dt><dd>convert md2man(5) flavored Markdown text into HTML</dd></dl><dl class="dl-horizontal"><dt><a href="man1/md2man-rake.1.html">md2man-rake(1)</a></dt><dd>run rake(1) tasks from md2man(1)</dd></dl><dl class="dl-horizontal"><dt><a href="man1/md2man-roff.1.html">md2man-roff(1)</a></dt><dd>convert md2man(5) flavored Markdown text into roff(7)</dd></dl><h2 id="man5">man5</h2><dl class="dl-horizontal"><dt><a href="man5/md2man.5.html">md2man(5)</a></dt><dd>UNIX manual page flavoring for Markdown</dd></dl></div></body>
11
11
  </html>
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <meta name="generator" content="md2man 5.0.3 https://github.com/sunaku/md2man" />
5
+ <meta name="generator" content="md2man 5.1.0 https://github.com/sunaku/md2man" />
6
6
  <title>EXAMPLE &mdash; frobnicate the bar library</title>
7
7
  <link rel="stylesheet" href="../style.css"/>
8
8
  <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <meta name="generator" content="md2man 5.0.3 https://github.com/sunaku/md2man" />
6
- <title>README</title>
5
+ <meta name="generator" content="md2man 5.1.0 https://github.com/sunaku/md2man" />
6
+ <title>README &mdash; md2man</title>
7
7
  <link rel="stylesheet" href="../style.css"/>
8
8
  <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
9
9
  </head>
@@ -13,7 +13,7 @@
13
13
  <li>Bugs: <a href="https://github.com/sunaku/md2man/issues">https://github.com/sunaku/md2man/issues</a></li>
14
14
  </ul>
15
15
  <h1 id="md2man-markdown-to-manpage"><span class="md2man-title">md2man</span> <span class="md2man-section">-</span> <span class="md2man-date">markdown</span> <span class="md2man-source">to</span> <span class="md2man-manual">manpage</span><a name="md2man-markdown-to-manpage" href="#md2man-markdown-to-manpage" class="md2man-permalink" title="permalink"></a></h1><p>md2man is a Ruby library and a set of command-line programs that convert
16
- <a href="http://daringfireball.net/projects/markdown/">Markdown</a> into UNIX manual pages (both <a href="http://troff.org">roff</a> and HTML) using <a href="https://github.com/vmg/redcarpet">Redcarpet</a>.</p><h2 id="features">Features<a name="features" href="#features" class="md2man-permalink" title="permalink"></a></h2>
16
+ <a href="http://daringfireball.net/projects/markdown/">Markdown</a> into UNIX manpages as well as HTML webpages using <a href="https://github.com/vmg/redcarpet">Redcarpet</a>.</p><h2 id="features">Features<a name="features" href="#features" class="md2man-permalink" title="permalink"></a></h2>
17
17
  <ul>
18
18
  <li><p>Formats indented, tagged, and normal paragraphs: described in <a class="md2man-reference" href="../man5/md2man.5.html">md2man(5)</a>.</p></li>
19
19
  <li><p>Translates all HTML4 and XHTML1 entities into native <a href="http://troff.org">roff</a> equivalents.</p></li>
@@ -23,101 +23,101 @@
23
23
  <h3 id="examples">Examples<a name="examples" href="#examples" class="md2man-permalink" title="permalink"></a></h3><p>Try converting
24
24
  <a href="https://raw.github.com/sunaku/md2man/master/EXAMPLE.markdown">this example Markdown file</a>
25
25
  into
26
- <a href="https://github.com/sunaku/md2man/raw/gh-pages/man/man0/EXAMPLE">a UNIX manual page</a>:</p><pre><code>md2man-roff EXAMPLE.markdown &gt; EXAMPLE.1
26
+ <a href="https://github.com/sunaku/md2man/raw/gh-pages/man/man0/EXAMPLE">a UNIX manual page</a>:</p><pre class="highlight shell"><code>md2man-roff EXAMPLE.markdown &gt; EXAMPLE.1
27
27
  </code></pre>
28
28
  <p>You can view <a href="https://github.com/sunaku/md2man/raw/gh-pages/man/man0/EXAMPLE">the resulting UNIX manual page</a> in your <a class="md2man-reference">man(1)</a>
29
- viewer:</p><pre><code>man -l EXAMPLE.1
29
+ viewer:</p><pre class="highlight shell"><code>man -l EXAMPLE.1
30
30
  </code></pre>
31
31
  <p><img src="https://github.com/sunaku/md2man/raw/gh-pages/EXAMPLE.png" alt="screenshot"></p><p>Next, try converting
32
32
  <a href="https://raw.github.com/sunaku/md2man/master/EXAMPLE.markdown">the same example file</a>
33
33
  into
34
- <a href="https://sunaku.github.io/md2man/man/man0/EXAMPLE.html">a HTML web page</a>:</p><pre><code>md2man-html EXAMPLE.markdown &gt; EXAMPLE.html
34
+ <a href="https://sunaku.github.io/md2man/man/man0/EXAMPLE.html">a HTML web page</a>:</p><pre class="highlight shell"><code>md2man-html EXAMPLE.markdown &gt; EXAMPLE.html
35
35
  </code></pre>
36
36
  <p>You can view <a href="https://sunaku.github.io/md2man/man/man0/EXAMPLE.html">the resulting HTML manual page</a> in your web
37
- browser:</p><pre><code>firefox EXAMPLE.html
37
+ browser:</p><pre class="highlight shell"><code>firefox EXAMPLE.html
38
38
  </code></pre>
39
- <h2 id="installation">Installation<a name="installation" href="#installation" class="md2man-permalink" title="permalink"></a></h2><pre><code>gem install md2man
39
+ <h2 id="installation">Installation<a name="installation" href="#installation" class="md2man-permalink" title="permalink"></a></h2><pre class="highlight shell"><code>gem install md2man
40
40
  </code></pre>
41
- <h3 id="development">Development<a name="development" href="#development" class="md2man-permalink" title="permalink"></a></h3><pre><code>git clone https://github.com/sunaku/md2man
42
- cd md2man
41
+ <h3 id="development">Development<a name="development" href="#development" class="md2man-permalink" title="permalink"></a></h3><pre class="highlight shell"><code>git clone https://github.com/sunaku/md2man
42
+ <span class="nb">cd </span>md2man
43
43
  bundle install
44
- bundle exec rake --tasks # packaging tasks
45
- bundle exec md2man-roff --help # run it directly
46
- bundle exec md2man-html --help # run it directly
44
+ bundle <span class="nb">exec </span>rake --tasks <span class="c"># packaging tasks</span>
45
+ bundle <span class="nb">exec </span>md2man-roff --help <span class="c"># run it directly</span>
46
+ bundle <span class="nb">exec </span>md2man-html --help <span class="c"># run it directly</span>
47
47
  </code></pre>
48
- <h2 id="usage">Usage<a name="usage" href="#usage" class="md2man-permalink" title="permalink"></a></h2><h3 id="for-roff-output">For <a href="http://troff.org">roff</a> output<a name="for-roff-output" href="#for-roff-output" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line">At the command line<a name="at-the-command-line" href="#at-the-command-line" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-roff.1.html">md2man-roff(1)</a> manual:</p><pre><code>md2man-roff --help
48
+ <h2 id="usage">Usage<a name="usage" href="#usage" class="md2man-permalink" title="permalink"></a></h2><h3 id="for-roff-output">For <a href="http://troff.org">roff</a> output<a name="for-roff-output" href="#for-roff-output" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line">At the command line<a name="at-the-command-line" href="#at-the-command-line" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-roff.1.html">md2man-roff(1)</a> manual:</p><pre class="highlight shell"><code>md2man-roff --help
49
49
  </code></pre>
50
- <h4 id="inside-a-ruby-script">Inside a Ruby script<a name="inside-a-ruby-script" href="#inside-a-ruby-script" class="md2man-permalink" title="permalink"></a></h4><p>Use the default renderer:</p><pre><code>require &#39;md2man/roff/engine&#39;
50
+ <h4 id="inside-a-ruby-script">Inside a Ruby script<a name="inside-a-ruby-script" href="#inside-a-ruby-script" class="md2man-permalink" title="permalink"></a></h4><p>Use the default renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/roff/engine'</span>
51
51
 
52
- your_roff_output = Md2Man::Roff::ENGINE.render(your_markdown_input)
52
+ <span class="n">your_roff_output</span> <span class="o">=</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">Roff</span><span class="o">::</span><span class="no">ENGINE</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
53
53
  </code></pre>
54
- <p>Build your own renderer:</p><pre><code>require &#39;md2man/roff/engine&#39;
54
+ <p>Build your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/roff/engine'</span>
55
55
 
56
- engine = Redcarpet::Markdown.new(Md2Man::Roff::Engine, your_options_hash)
57
- your_roff_output = engine.render(your_markdown_input)
56
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">Md2Man</span><span class="o">::</span><span class="no">Roff</span><span class="o">::</span><span class="no">Engine</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
57
+ <span class="n">your_roff_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
58
58
  </code></pre>
59
- <p>Define your own renderer:</p><pre><code>require &#39;md2man/roff/engine&#39;
59
+ <p>Define your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/roff/engine'</span>
60
60
 
61
- class YourManpageRenderer &lt; Md2Man::Roff::Engine
62
- # ... your stuff here ...
63
- end
61
+ <span class="k">class</span> <span class="nc">YourManpageRenderer</span> <span class="o">&lt;</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">Roff</span><span class="o">::</span><span class="no">Engine</span>
62
+ <span class="c1"># ... your stuff here ...</span>
63
+ <span class="k">end</span>
64
64
 
65
- engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
66
- your_roff_output = engine.render(your_markdown_input)
65
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">YourManpageRenderer</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
66
+ <span class="n">your_roff_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
67
67
  </code></pre>
68
- <p>Mix-in your own renderer:</p><pre><code>require &#39;md2man/roff&#39;
68
+ <p>Mix-in your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/roff'</span>
69
69
 
70
- class YourManpageRenderer &lt; Redcarpet::Render::Base
71
- include Md2Man::Roff
72
- # ... your stuff here ...
73
- end
70
+ <span class="k">class</span> <span class="nc">YourManpageRenderer</span> <span class="o">&lt;</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Render</span><span class="o">::</span><span class="no">Base</span>
71
+ <span class="kp">include</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">Roff</span>
72
+ <span class="c1"># ... your stuff here ...</span>
73
+ <span class="k">end</span>
74
74
 
75
- engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
76
- your_roff_output = engine.render(your_markdown_input)
75
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">YourManpageRenderer</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
76
+ <span class="n">your_roff_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
77
77
  </code></pre>
78
- <h3 id="for-html-output">For HTML output<a name="for-html-output" href="#for-html-output" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line-1">At the command line<a name="at-the-command-line-1" href="#at-the-command-line-1" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-html.1.html">md2man-html(1)</a> manual:</p><pre><code>md2man-html --help
78
+ <h3 id="for-html-output">For HTML output<a name="for-html-output" href="#for-html-output" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line-1">At the command line<a name="at-the-command-line-1" href="#at-the-command-line-1" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-html.1.html">md2man-html(1)</a> manual:</p><pre class="highlight shell"><code>md2man-html --help
79
79
  </code></pre>
80
- <h4 id="inside-a-ruby-script-1">Inside a Ruby script<a name="inside-a-ruby-script-1" href="#inside-a-ruby-script-1" class="md2man-permalink" title="permalink"></a></h4><p>Use the default renderer:</p><pre><code>require &#39;md2man/html/engine&#39;
80
+ <h4 id="inside-a-ruby-script-1">Inside a Ruby script<a name="inside-a-ruby-script-1" href="#inside-a-ruby-script-1" class="md2man-permalink" title="permalink"></a></h4><p>Use the default renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/html/engine'</span>
81
81
 
82
- your_html_output = Md2Man::HTML::ENGINE.render(your_markdown_input)
82
+ <span class="n">your_html_output</span> <span class="o">=</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">HTML</span><span class="o">::</span><span class="no">ENGINE</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
83
83
  </code></pre>
84
- <p>Build your own renderer:</p><pre><code>require &#39;md2man/html/engine&#39;
84
+ <p>Build your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/html/engine'</span>
85
85
 
86
- engine = Redcarpet::Markdown.new(Md2Man::HTML::Engine, your_options_hash)
87
- your_html_output = engine.render(your_markdown_input)
86
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">Md2Man</span><span class="o">::</span><span class="no">HTML</span><span class="o">::</span><span class="no">Engine</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
87
+ <span class="n">your_html_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
88
88
  </code></pre>
89
- <p>Define your own renderer:</p><pre><code>require &#39;md2man/html/engine&#39;
89
+ <p>Define your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/html/engine'</span>
90
90
 
91
- class YourManpageRenderer &lt; Md2Man::HTML::Engine
92
- # ... your stuff here ...
93
- end
91
+ <span class="k">class</span> <span class="nc">YourManpageRenderer</span> <span class="o">&lt;</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">HTML</span><span class="o">::</span><span class="no">Engine</span>
92
+ <span class="c1"># ... your stuff here ...</span>
93
+ <span class="k">end</span>
94
94
 
95
- engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
96
- your_html_output = engine.render(your_markdown_input)
95
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">YourManpageRenderer</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
96
+ <span class="n">your_html_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
97
97
  </code></pre>
98
- <p>Mix-in your own renderer:</p><pre><code>require &#39;md2man/html&#39;
98
+ <p>Mix-in your own renderer:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/html'</span>
99
99
 
100
- class YourManpageRenderer &lt; Redcarpet::Render::Base
101
- include Md2Man::HTML
102
- # ... your stuff here ...
103
- end
100
+ <span class="k">class</span> <span class="nc">YourManpageRenderer</span> <span class="o">&lt;</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Render</span><span class="o">::</span><span class="no">Base</span>
101
+ <span class="kp">include</span> <span class="no">Md2Man</span><span class="o">::</span><span class="no">HTML</span>
102
+ <span class="c1"># ... your stuff here ...</span>
103
+ <span class="k">end</span>
104
104
 
105
- engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
106
- your_html_output = engine.render(your_markdown_input)
105
+ <span class="n">engine</span> <span class="o">=</span> <span class="no">Redcarpet</span><span class="o">::</span><span class="no">Markdown</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">YourManpageRenderer</span><span class="p">,</span> <span class="n">your_options_hash</span><span class="p">)</span>
106
+ <span class="n">your_html_output</span> <span class="o">=</span> <span class="n">engine</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">your_markdown_input</span><span class="p">)</span>
107
107
  </code></pre>
108
- <h3 id="building-man-pages">Building man pages<a name="building-man-pages" href="#building-man-pages" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line-2">At the command line<a name="at-the-command-line-2" href="#at-the-command-line-2" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-rake.1.html">md2man-rake(1)</a> manual:</p><pre><code>md2man-rake --help
108
+ <h3 id="building-manpages">Building manpages<a name="building-manpages" href="#building-manpages" class="md2man-permalink" title="permalink"></a></h3><h4 id="at-the-command-line-2">At the command line<a name="at-the-command-line-2" href="#at-the-command-line-2" class="md2man-permalink" title="permalink"></a></h4><p>See <a class="md2man-reference" href="../man1/md2man-rake.1.html">md2man-rake(1)</a> manual:</p><pre class="highlight shell"><code>md2man-rake --help
109
109
  </code></pre>
110
- <h4 id="inside-a-ruby-script-2">Inside a Ruby script<a name="inside-a-ruby-script-2" href="#inside-a-ruby-script-2" class="md2man-permalink" title="permalink"></a></h4><p>Add this snippet to your gemspec file:</p><pre><code>s.files += Dir[&#39;man/man?/*.?&#39;] # UNIX man pages
111
- s.files += Dir[&#39;man/**/*.{html,css,js}&#39;] # HTML man pages
112
- s.add_development_dependency &#39;md2man&#39;, &#39;~&gt; 5.0&#39;
110
+ <h4 id="inside-a-ruby-script-2">Inside a Ruby script<a name="inside-a-ruby-script-2" href="#inside-a-ruby-script-2" class="md2man-permalink" title="permalink"></a></h4><p>Add this snippet to your gemspec file:</p><pre class="highlight ruby"><code><span class="n">s</span><span class="p">.</span><span class="nf">files</span> <span class="o">+=</span> <span class="no">Dir</span><span class="p">[</span><span class="s1">'man/man?/*.?'</span><span class="p">]</span> <span class="c1"># UNIX manpages</span>
111
+ <span class="n">s</span><span class="p">.</span><span class="nf">files</span> <span class="o">+=</span> <span class="no">Dir</span><span class="p">[</span><span class="s1">'man/**/*.{html,css}'</span><span class="p">]</span> <span class="c1"># HTML manpages</span>
112
+ <span class="n">s</span><span class="p">.</span><span class="nf">add_development_dependency</span> <span class="s1">'md2man'</span><span class="p">,</span> <span class="s1">'~&gt; 5.0'</span>
113
113
  </code></pre>
114
- <p>Add this line to your Rakefile:</p><pre><code>require &#39;md2man/rakefile&#39;
114
+ <p>Add this line to your Rakefile:</p><pre class="highlight ruby"><code><span class="nb">require</span> <span class="s1">'md2man/rakefile'</span>
115
115
  </code></pre>
116
116
  <p>You now have a <code>rake md2man</code> task that builds manual pages from Markdown files
117
117
  (with &quot;.markdown&quot;, &quot;.mkd&quot;, or &quot;.md&quot; extension) inside <code>man/man*/</code> directories.
118
118
  There are also sub-tasks to build manual pages individually as <a href="http://troff.org">roff</a> or HTML.</p><p>If you&#39;re using Bundler, this task also hooks into Bundler&#39;s gem packaging
119
- tasks and ensures that your manual pages are built for packaging into a gem:</p><pre><code>bundle exec rake build
120
- gem spec pkg/*.gem | fgrep man/
119
+ tasks and ensures that your manual pages are built for packaging into a gem:</p><pre class="highlight ruby"><code><span class="n">bundle</span> <span class="nb">exec</span> <span class="n">rake</span> <span class="n">build</span>
120
+ <span class="n">gem</span> <span class="n">spec</span> <span class="n">pkg</span><span class="o">/*</span><span class="p">.</span><span class="nf">gem</span> <span class="o">|</span> <span class="n">fgrep</span> <span class="n">man</span><span class="o">/</span>
121
121
  </code></pre>
122
122
  <h2 id="license">License<a name="license" href="#license" class="md2man-permalink" title="permalink"></a></h2><p>Released under the ISC license. See the LICENSE file for details.</p></div></body>
123
123
  </html>