md2man 5.0.1 → 5.0.3
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 +4 -4
- data/EXAMPLE.markdown +1 -1
- data/README.markdown +32 -12
- data/VERSION.markdown +49 -1
- data/bin/md2man-html +3 -3
- data/bin/md2man-rake +3 -3
- data/bin/md2man-roff +3 -3
- data/lib/md2man/document.rb +1 -1
- data/lib/md2man/html.rb +3 -2
- data/lib/md2man/rakefile.rb +4 -1
- data/lib/md2man/rakefile/style.css +8 -1
- data/lib/md2man/roff.rb +8 -7
- data/lib/md2man/version.rb +1 -1
- data/man/index.html +2 -2
- data/man/man0/EXAMPLE.html +20 -0
- data/man/man0/EXAMPLE.markdown +1 -0
- data/man/man0/README.html +22 -14
- data/man/man0/VERSION.html +40 -12
- data/man/man1/md2man-html.1 +6 -4
- data/man/man1/md2man-html.1.html +3 -3
- data/man/man1/md2man-rake.1 +4 -4
- data/man/man1/md2man-rake.1.html +3 -3
- data/man/man1/md2man-roff.1 +5 -6
- data/man/man1/md2man-roff.1.html +3 -3
- data/man/man5/md2man.5 +118 -33
- data/man/man5/md2man.5.html +101 -26
- data/man/man5/md2man.5.markdown +107 -26
- data/man/style.css +8 -1
- data/test/md2man/html_test.rb +71 -0
- data/test/md2man/roff_test.rb +99 -8
- metadata +4 -2
data/man/man5/md2man.5.markdown
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# MD2MAN 5
|
1
|
+
# MD2MAN 5 2016-02-21 5.0.3
|
2
2
|
|
3
3
|
## NAME
|
4
4
|
|
5
|
-
md2man - manual page flavoring for the markdown(7) file format
|
5
|
+
md2man - UNIX manual page flavoring for the markdown(7) file format
|
6
6
|
|
7
7
|
## DESCRIPTION
|
8
8
|
|
@@ -11,38 +11,26 @@ pages by extending its syntax, semantics, and assumed processing extensions.
|
|
11
11
|
|
12
12
|
### Syntax
|
13
13
|
|
14
|
-
md2man extends markdown(7) syntax by
|
15
|
-
|
16
|
-
This is a
|
17
|
-
normal
|
18
|
-
paragraph.
|
19
|
-
|
20
|
-
This is a
|
21
|
-
tagged
|
22
|
-
paragraph.
|
23
|
-
|
24
|
-
This is an
|
25
|
-
indented
|
26
|
-
paragraph.
|
27
|
-
|
28
|
-
This
|
29
|
-
is another
|
30
|
-
normal
|
31
|
-
paragraph.
|
14
|
+
md2man extends markdown(7) syntax by distinguishing three kinds of paragraphs.
|
32
15
|
|
33
16
|
#### Normal paragraphs
|
34
17
|
|
35
18
|
Paragraphs whose lines are all indented by exactly zero or one additional
|
36
19
|
spaces are considered to be "normal paragraphs". For example:
|
37
20
|
|
38
|
-
This is a
|
39
|
-
|
21
|
+
This is a normal paragraph.
|
22
|
+
|
23
|
+
This is also
|
24
|
+
a normal
|
40
25
|
paragraph.
|
41
26
|
|
42
|
-
|
43
|
-
|
27
|
+
And
|
28
|
+
this
|
29
|
+
is
|
30
|
+
a
|
44
31
|
normal
|
45
|
-
paragraph
|
32
|
+
paragraph
|
33
|
+
too.
|
46
34
|
|
47
35
|
#### Tagged paragraphs
|
48
36
|
|
@@ -70,7 +58,7 @@ md2man extends markdown(7) semantics by treating top-level headings specially.
|
|
70
58
|
#### Top-level headings
|
71
59
|
|
72
60
|
The first top-level `<h1>` heading found in the input is considered to be the
|
73
|
-
`.TH` directive in roff(7),
|
61
|
+
`.TH` directive in roff(7), described under "Title line" in man-pages(7) thus:
|
74
62
|
|
75
63
|
> .TH title section date source manual
|
76
64
|
>
|
@@ -101,6 +89,99 @@ md2man enables the following [Redcarpet] extensions while reading markdown(7):
|
|
101
89
|
* strikethrough
|
102
90
|
* fenced\_code\_blocks
|
103
91
|
|
92
|
+
### Examples
|
93
|
+
|
94
|
+
Below is a complete example of an md2man(5) formatted manual page adapted from
|
95
|
+
the [Linux Man Page Howto](http://www.schweikhardt.net/man_page_howto.html)
|
96
|
+
guide by Jens Schweikhardt. [The result of processing](../man0/EXAMPLE.html)
|
97
|
+
this example with md2man-html(1) has been bundled along with this manual page.
|
98
|
+
|
99
|
+
```markdown
|
100
|
+
FOO 1 "MARCH 1995" Linux "User Manuals"
|
101
|
+
=======================================
|
102
|
+
|
103
|
+
NAME
|
104
|
+
----
|
105
|
+
|
106
|
+
foo - frobnicate the bar library
|
107
|
+
|
108
|
+
SYNOPSIS
|
109
|
+
--------
|
110
|
+
|
111
|
+
`foo` [`-bar`] [`-c` *config-file*] *file* ...
|
112
|
+
|
113
|
+
DESCRIPTION
|
114
|
+
-----------
|
115
|
+
|
116
|
+
`foo` frobnicates the bar library by tweaking internal symbol tables. By
|
117
|
+
default it parses all baz segments and rearranges them in reverse order by
|
118
|
+
time for the xyzzy(1) linker to find them. The symdef entry is then compressed
|
119
|
+
using the WBG (Whiz-Bang-Gizmo) algorithm. All files are processed in the
|
120
|
+
order specified.
|
121
|
+
|
122
|
+
OPTIONS
|
123
|
+
-------
|
124
|
+
|
125
|
+
`-b`
|
126
|
+
Do not write "busy" to stdout while processing.
|
127
|
+
|
128
|
+
`-c` *config-file*
|
129
|
+
Use the alternate system wide *config-file* instead of */etc/foo.conf*. This
|
130
|
+
overrides any `FOOCONF` environment variable.
|
131
|
+
|
132
|
+
`-a`
|
133
|
+
In addition to the baz segments, also parse the blurfl headers.
|
134
|
+
|
135
|
+
`-r`
|
136
|
+
Recursive mode. Operates as fast as lightning at the expense of a megabyte
|
137
|
+
of virtual memory.
|
138
|
+
|
139
|
+
FILES
|
140
|
+
-----
|
141
|
+
|
142
|
+
*/etc/foo.conf*
|
143
|
+
The system wide configuration file. See foo(5) for further details.
|
144
|
+
|
145
|
+
*~/.foorc*
|
146
|
+
Per user configuration file. See foo(5) for further details.
|
147
|
+
|
148
|
+
ENVIRONMENT
|
149
|
+
-----------
|
150
|
+
|
151
|
+
`FOOCONF`
|
152
|
+
If non-null the full pathname for an alternate system wide */etc/foo.conf*.
|
153
|
+
Overridden by the `-c` option.
|
154
|
+
|
155
|
+
DIAGNOSTICS
|
156
|
+
-----------
|
157
|
+
|
158
|
+
The following diagnostics may be issued on stderr:
|
159
|
+
|
160
|
+
**Bad magic number.**
|
161
|
+
The input file does not look like an archive file.
|
162
|
+
|
163
|
+
**Old style baz segments.**
|
164
|
+
`foo` can only handle new style baz segments. COBOL object libraries are not
|
165
|
+
supported in this version.
|
166
|
+
|
167
|
+
BUGS
|
168
|
+
----
|
169
|
+
|
170
|
+
The command name should have been chosen more carefully to reflect its
|
171
|
+
purpose.
|
172
|
+
|
173
|
+
AUTHOR
|
174
|
+
------
|
175
|
+
|
176
|
+
Jens Schweikhardt <howto@schweikhardt.net>
|
177
|
+
|
178
|
+
SEE ALSO
|
179
|
+
--------
|
180
|
+
|
181
|
+
bar(1), foo(5), xyzzy(1), [Linux Man Page Howto](
|
182
|
+
http://www.schweikhardt.net/man_page_howto.html)
|
183
|
+
```
|
184
|
+
|
104
185
|
## SEE ALSO
|
105
186
|
|
106
187
|
markdown(7), man-pages(7), md2man-roff(1), md2man-html(1), md2man-rake(1)
|
data/man/style.css
CHANGED
@@ -29,9 +29,16 @@
|
|
29
29
|
margin-top: -5em;
|
30
30
|
font-weight: normal;
|
31
31
|
font-size: smaller;
|
32
|
-
text-align:
|
32
|
+
text-align: center;
|
33
33
|
}
|
34
34
|
|
35
|
+
h1:first-child > span.md2man-source {
|
36
|
+
float: right;
|
37
|
+
}
|
38
|
+
|
39
|
+
h1:first-child > span.md2man-title,
|
40
|
+
h1:first-child > span.md2man-section,
|
41
|
+
h1:first-child > span.md2man-manual,
|
35
42
|
h1:first-child > a.md2man-permalink {
|
36
43
|
display: none;
|
37
44
|
}
|
data/test/md2man/html_test.rb
CHANGED
@@ -132,6 +132,57 @@ describe 'html engine' do
|
|
132
132
|
OUTPUT
|
133
133
|
end
|
134
134
|
|
135
|
+
it 'decorates top-level headings components in spans with CSS classes' do
|
136
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
137
|
+
|# title section date source manual
|
138
|
+
INPUT
|
139
|
+
<h1 id="title-section-date-source-manual"><span class="md2man-title">title</span> <span class="md2man-section">section</span> <span class="md2man-date">date</span> <span class="md2man-source">source</span> <span class="md2man-manual">manual</span><a name="title-section-date-source-manual" href="#title-section-date-source-manual" class="md2man-permalink" title="permalink"></a></h1>
|
140
|
+
OUTPUT
|
141
|
+
|
142
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
143
|
+
|# FOO 1 "MARCH 1995" Linux "User Manuals"
|
144
|
+
INPUT
|
145
|
+
<h1 id="foo-1-march-1995-linux-user-manuals"><span class="md2man-title">FOO</span> <span class="md2man-section">1</span> <span class="md2man-date">MARCH 1995</span> <span class="md2man-source">Linux</span> <span class="md2man-manual">User Manuals</span><a name="foo-1-march-1995-linux-user-manuals" href="#foo-1-march-1995-linux-user-manuals" class="md2man-permalink" title="permalink"></a></h1>
|
146
|
+
OUTPUT
|
147
|
+
|
148
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
149
|
+
|# title section date source
|
150
|
+
INPUT
|
151
|
+
<h1 id="title-section-date-source"><span class="md2man-title">title</span> <span class="md2man-section">section</span> <span class="md2man-date">date</span> <span class="md2man-source">source</span><a name="title-section-date-source" href="#title-section-date-source" class="md2man-permalink" title="permalink"></a></h1>
|
152
|
+
OUTPUT
|
153
|
+
|
154
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
155
|
+
|# title section date
|
156
|
+
INPUT
|
157
|
+
<h1 id="title-section-date"><span class="md2man-title">title</span> <span class="md2man-section">section</span> <span class="md2man-date">date</span><a name="title-section-date" href="#title-section-date" class="md2man-permalink" title="permalink"></a></h1>
|
158
|
+
OUTPUT
|
159
|
+
|
160
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
161
|
+
|# title section
|
162
|
+
INPUT
|
163
|
+
<h1 id="title-section"><span class="md2man-title">title</span> <span class="md2man-section">section</span><a name="title-section" href="#title-section" class="md2man-permalink" title="permalink"></a></h1>
|
164
|
+
OUTPUT
|
165
|
+
|
166
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
167
|
+
|# title
|
168
|
+
INPUT
|
169
|
+
<h1 id="title"><span class="md2man-title">title</span><a name="title" href="#title" class="md2man-permalink" title="permalink"></a></h1>
|
170
|
+
OUTPUT
|
171
|
+
|
172
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
173
|
+
|#
|
174
|
+
INPUT
|
175
|
+
OUTPUT
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'preserves any extra components found in top-level headings' do
|
179
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
180
|
+
|# title section date source manual extra! extra! read all about it!
|
181
|
+
INPUT
|
182
|
+
<h1 id="title-section-date-source-manual-extra-extra-read-all-about-it"><span class="md2man-title">title</span> <span class="md2man-section">section</span> <span class="md2man-date">date</span> <span class="md2man-source">source</span> <span class="md2man-manual">manual</span> extra! extra! read all about it!<a name="title-section-date-source-manual-extra-extra-read-all-about-it" href="#title-section-date-source-manual-extra-extra-read-all-about-it" class="md2man-permalink" title="permalink"></a></h1>
|
183
|
+
OUTPUT
|
184
|
+
end
|
185
|
+
|
135
186
|
it 'adds permalinks to headings' do
|
136
187
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
137
188
|
|# foo *BAR*
|
@@ -189,4 +240,24 @@ describe 'html engine' do
|
|
189
240
|
|<h3 id="pipes_get_last-chain"><code>PIPES_GET_LAST(CHAIN)</code><a name="pipes_get_last-chain" href="#pipes_get_last-chain" class="md2man-permalink" title="permalink"></a></h3>
|
190
241
|
OUTPUT
|
191
242
|
end
|
243
|
+
|
244
|
+
it 'supports sole space or tab in codespans' do
|
245
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
246
|
+
|`\s`
|
247
|
+
INPUT
|
248
|
+
|<p><code>\s</code></p>
|
249
|
+
OUTPUT
|
250
|
+
|
251
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
252
|
+
|`\t`
|
253
|
+
INPUT
|
254
|
+
|<p><code>\s</code></p>
|
255
|
+
OUTPUT
|
256
|
+
|
257
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
258
|
+
|`\n`
|
259
|
+
INPUT
|
260
|
+
|<p><code>\n</code></p>
|
261
|
+
OUTPUT
|
262
|
+
end
|
192
263
|
end
|
data/test/md2man/roff_test.rb
CHANGED
@@ -17,13 +17,35 @@ describe 'roff engine' do
|
|
17
17
|
SPACE = 0x20.chr
|
18
18
|
|
19
19
|
def heredoc document
|
20
|
-
document.gsub(/^\s*\|/, '')
|
20
|
+
document.gsub(/^\s*\|/, '')
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'renders nothing as nothing' do
|
24
24
|
@markdown.render('').must_be_empty
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'strips leading newlines' do
|
28
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|two leading newlines
|
32
|
+
INPUT
|
33
|
+
|.PP
|
34
|
+
|two leading newlines
|
35
|
+
OUTPUT
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'strips leading newlines but not leading spaces' do
|
39
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
40
|
+
|
|
41
|
+
|
|
42
|
+
| two leading newlines followed by one space
|
43
|
+
INPUT
|
44
|
+
|.PP
|
45
|
+
| two leading newlines followed by one space
|
46
|
+
OUTPUT
|
47
|
+
end
|
48
|
+
|
27
49
|
it 'renders paragraphs' do
|
28
50
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
29
51
|
|just some paragraph
|
@@ -520,6 +542,39 @@ describe 'roff engine' do
|
|
520
542
|
|.RE
|
521
543
|
OUTPUT
|
522
544
|
|
545
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
546
|
+
| just some *paragraph*
|
547
|
+
|
|
548
|
+
| spanning
|
549
|
+
|
|
550
|
+
|
|
551
|
+
| **multiple**
|
552
|
+
|
|
553
|
+
| > lines
|
554
|
+
| with 4-space indent
|
555
|
+
|
|
556
|
+
|
|
557
|
+
| and blank lines within
|
558
|
+
INPUT
|
559
|
+
|.PP
|
560
|
+
|.RS
|
561
|
+
|.nf
|
562
|
+
|just some *paragraph*
|
563
|
+
|
|
564
|
+
| spanning
|
565
|
+
|
|
566
|
+
|
|
567
|
+
| **multiple**
|
568
|
+
|
|
569
|
+
|> lines
|
570
|
+
|with 4\\-space indent
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|and blank lines within
|
574
|
+
|.fi
|
575
|
+
|.RE
|
576
|
+
OUTPUT
|
577
|
+
|
523
578
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
524
579
|
|normal paragraph line
|
525
580
|
|
|
@@ -586,33 +641,47 @@ describe 'roff engine' do
|
|
586
641
|
|Send [me](mailto:foo@bar.baz), e-mail.
|
587
642
|
INPUT
|
588
643
|
|.PP
|
589
|
-
|Send me
|
590
|
-
|\\[la]foo@bar.baz\\[ra], e\\-mail.
|
644
|
+
|Send me \\[la]foo@bar.baz\\[ra], e\\-mail.
|
591
645
|
OUTPUT
|
592
646
|
|
593
647
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
594
648
|
|Take [me](http://myself), somewhere.
|
595
649
|
INPUT
|
596
650
|
|.PP
|
597
|
-
|Take me
|
598
|
-
|\\[la]http://myself\\[ra], somewhere.
|
651
|
+
|Take me \\[la]http://myself\\[ra], somewhere.
|
599
652
|
OUTPUT
|
600
653
|
|
601
654
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
602
655
|
|Mail me foo@bar.baz now.
|
603
656
|
INPUT
|
604
657
|
|.PP
|
605
|
-
|Mail me
|
606
|
-
|\\[la]foo@bar.baz\\[ra] now.
|
658
|
+
|Mail me \\[la]foo@bar.baz\\[ra] now.
|
607
659
|
OUTPUT
|
608
660
|
|
609
661
|
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
610
662
|
|Take me http://www.somewhere now.
|
611
663
|
INPUT
|
612
664
|
|.PP
|
613
|
-
|Take me
|
665
|
+
|Take me \\[la]http://www.somewhere\\[ra] now.
|
666
|
+
OUTPUT
|
667
|
+
|
668
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
669
|
+
|Leave me
|
670
|
+
|http://www.somewhere now.
|
671
|
+
INPUT
|
672
|
+
|.PP
|
673
|
+
|Leave me
|
614
674
|
|\\[la]http://www.somewhere\\[ra] now.
|
615
675
|
OUTPUT
|
676
|
+
|
677
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
678
|
+
|Tagged
|
679
|
+
| paragraph http://www.should.work correctly.
|
680
|
+
INPUT
|
681
|
+
|.TP
|
682
|
+
|Tagged
|
683
|
+
|paragraph \\[la]http://www.should.work\\[ra] correctly.
|
684
|
+
OUTPUT
|
616
685
|
end
|
617
686
|
|
618
687
|
it 'renders unordered lists' do
|
@@ -961,4 +1030,26 @@ describe 'roff engine' do
|
|
961
1030
|
OUTPUT
|
962
1031
|
end
|
963
1032
|
|
1033
|
+
it 'supports sole space or tab in codespans' do
|
1034
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
1035
|
+
|`\s`
|
1036
|
+
INPUT
|
1037
|
+
|.PP
|
1038
|
+
|\\fB\\fC\s\\fR
|
1039
|
+
OUTPUT
|
1040
|
+
|
1041
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
1042
|
+
|`\t`
|
1043
|
+
INPUT
|
1044
|
+
|.PP
|
1045
|
+
|\\fB\\fC\s\\fR
|
1046
|
+
OUTPUT
|
1047
|
+
|
1048
|
+
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|
1049
|
+
|`\n`
|
1050
|
+
INPUT
|
1051
|
+
|.PP
|
1052
|
+
|\\fB\\fC\n\\fR
|
1053
|
+
OUTPUT
|
1054
|
+
end
|
964
1055
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md2man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suraj N. Kurapati
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binman
|
@@ -97,6 +97,8 @@ files:
|
|
97
97
|
- lib/md2man/roff/engine.rb
|
98
98
|
- lib/md2man/version.rb
|
99
99
|
- man/index.html
|
100
|
+
- man/man0/EXAMPLE.html
|
101
|
+
- man/man0/EXAMPLE.markdown
|
100
102
|
- man/man0/EXAMPLE.png
|
101
103
|
- man/man0/README.html
|
102
104
|
- man/man0/README.markdown
|