binman 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.markdown +12 -0
- data/bin/binman +12 -1
- data/binman.gemspec +1 -1
- data/lib/binman.rb +6 -3
- data/lib/binman/version.rb +1 -1
- data/man/man1/binman.1 +15 -1
- metadata +7 -8
- data/lib/binman/renderer.rb +0 -58
data/HISTORY.markdown
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
------------------------------------------------------------------------------
|
2
|
+
Version 0.1.2 (2011-10-13)
|
3
|
+
------------------------------------------------------------------------------
|
4
|
+
|
5
|
+
Housekeeping:
|
6
|
+
|
7
|
+
* Extracted `BinMan::Renderer` into [redcarpet-manpage] library.
|
8
|
+
|
9
|
+
* The [Redcarpet2] library is not a runtime gem dependency anymore.
|
10
|
+
|
11
|
+
* Forgot to introduce leading comment headers in binman(1) man page.
|
12
|
+
|
1
13
|
------------------------------------------------------------------------------
|
2
14
|
Version 0.1.1 (2011-10-13)
|
3
15
|
------------------------------------------------------------------------------
|
data/bin/binman
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
=begin
|
4
4
|
|
5
|
-
BINMAN 1 "2011-10-13" "0.1.
|
5
|
+
BINMAN 1 "2011-10-13" "0.1.2" "Ruby User Manuals"
|
6
6
|
=================================================
|
7
7
|
|
8
8
|
NAME
|
@@ -24,6 +24,8 @@ into roff(7) using [Redcarpet2], and display them using man(1).
|
|
24
24
|
|
25
25
|
### Leading Comment Headers
|
26
26
|
|
27
|
+
A leading comment header can be one of the following two things:
|
28
|
+
|
27
29
|
1. A contiguous sequence of single-line comments starting at the
|
28
30
|
beginning of the file (after shebang and encoding comments plus
|
29
31
|
optional blank lines) and ending at the first single blank line.
|
@@ -32,6 +34,15 @@ into roff(7) using [Redcarpet2], and display them using man(1).
|
|
32
34
|
|
33
35
|
### Markdown Processing Extensions
|
34
36
|
|
37
|
+
The following [Redcarpet2] markdown processing extensions are enabled:
|
38
|
+
|
39
|
+
* autolink
|
40
|
+
* no_intra_emphasis
|
41
|
+
* fenced_code_blocks
|
42
|
+
* space_after_headers
|
43
|
+
|
44
|
+
### Markdown Processing Divergence
|
45
|
+
|
35
46
|
Although your leading comment headers are written in markdown(7), `binman`
|
36
47
|
introduces the following additional conventions to simplify common tasks:
|
37
48
|
|
data/binman.gemspec
CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
|
|
23
23
|
# specify any dependencies here; for example:
|
24
24
|
# s.add_development_dependency "rspec"
|
25
25
|
# s.add_runtime_dependency "rest-client"
|
26
|
-
s.
|
26
|
+
s.add_development_dependency "redcarpet-manpage", ">= 0.0.1"
|
27
27
|
end
|
data/lib/binman.rb
CHANGED
@@ -41,8 +41,10 @@ module BinMan
|
|
41
41
|
# Converts given leading comment header (produced by #read) into roff(7).
|
42
42
|
#
|
43
43
|
def dump header
|
44
|
-
require '
|
45
|
-
RENDERER.render(header)
|
44
|
+
require 'redcarpet-manpage'
|
45
|
+
RedcarpetManpage::RENDERER.render(header)
|
46
|
+
rescue LoadError
|
47
|
+
raise 'Run `gem install binman --development` to use dump().'
|
46
48
|
end
|
47
49
|
|
48
50
|
##
|
@@ -59,7 +61,8 @@ module BinMan
|
|
59
61
|
begin
|
60
62
|
roff = dump(header)
|
61
63
|
IO.popen('man -l -', 'w') {|man| man.puts roff }
|
62
|
-
rescue
|
64
|
+
rescue => error
|
65
|
+
warn "binman: #{error}"
|
63
66
|
puts header
|
64
67
|
end
|
65
68
|
end
|
data/lib/binman/version.rb
CHANGED
data/man/man1/binman.1
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.TH BINMAN 1 "2011-10-13" "0.1.
|
1
|
+
.TH BINMAN 1 "2011-10-13" "0.1.2" "Ruby User Manuals"
|
2
2
|
.SH NAME
|
3
3
|
.PP
|
4
4
|
binman \- UNIX man pages for Ruby \fBbin/\fP scripts
|
@@ -15,6 +15,8 @@ into
|
|
15
15
|
using \fBRedcarpet2\fP \fIhttps://github.com/tanoku/redcarpet\fP, and display them using
|
16
16
|
.BR man (1).
|
17
17
|
.SS Leading Comment Headers
|
18
|
+
.PP
|
19
|
+
A leading comment header can be one of the following two things:
|
18
20
|
.nr step 0 1
|
19
21
|
.IP \n+[step]
|
20
22
|
A contiguous sequence of single-line comments starting at the
|
@@ -24,6 +26,18 @@ optional blank lines) and ending at the first single blank line.
|
|
24
26
|
First embedded document delimited by \fB=begin\fP and \fB=end\fP lines.
|
25
27
|
.SS Markdown Processing Extensions
|
26
28
|
.PP
|
29
|
+
The following \fBRedcarpet2\fP \fIhttps://github.com/tanoku/redcarpet\fP markdown processing extensions are enabled:
|
30
|
+
.
|
31
|
+
.IP \[bu] 2
|
32
|
+
autolink
|
33
|
+
.IP \[bu] 2
|
34
|
+
no_intra_emphasis
|
35
|
+
.IP \[bu] 2
|
36
|
+
fenced_code_blocks
|
37
|
+
.IP \[bu] 2
|
38
|
+
space_after_headers
|
39
|
+
.SS Markdown Processing Divergence
|
40
|
+
.PP
|
27
41
|
Although your leading comment headers are written in
|
28
42
|
.BR markdown (7),
|
29
43
|
\fBbinman\fP
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,19 +9,19 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: redcarpet
|
16
|
-
requirement: &
|
15
|
+
name: redcarpet-manpage
|
16
|
+
requirement: &21068040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
type: :
|
21
|
+
version: 0.0.1
|
22
|
+
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21068040
|
25
25
|
description: ''
|
26
26
|
email:
|
27
27
|
- sunaku@gmail.com
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- binman.gemspec
|
41
41
|
- lib/binman.rb
|
42
42
|
- lib/binman/rake_tasks.rb
|
43
|
-
- lib/binman/renderer.rb
|
44
43
|
- lib/binman/version.rb
|
45
44
|
- man/man1/binman.1
|
46
45
|
homepage: http://github.com/sunaku/binman
|
data/lib/binman/renderer.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'redcarpet'
|
2
|
-
require 'redcarpet/render_man'
|
3
|
-
|
4
|
-
module BinMan
|
5
|
-
class Renderer < Redcarpet::Render::ManPage
|
6
|
-
def normal_text text
|
7
|
-
text.gsub(/(?<=\W)-(?=\W)/, '\\-') if text
|
8
|
-
end
|
9
|
-
|
10
|
-
def paragraph(text)
|
11
|
-
"\n.PP\n#{text}\n"
|
12
|
-
end
|
13
|
-
|
14
|
-
alias codespan double_emphasis
|
15
|
-
alias triple_emphasis double_emphasis
|
16
|
-
|
17
|
-
def autolink link, link_type
|
18
|
-
emphasis link
|
19
|
-
end
|
20
|
-
|
21
|
-
def link link, title, content
|
22
|
-
"#{triple_emphasis content} #{emphasis link}"
|
23
|
-
end
|
24
|
-
|
25
|
-
DEFINITION_INDENT = ' ' # two spaces
|
26
|
-
|
27
|
-
def postprocess document
|
28
|
-
document.
|
29
|
-
# squeeze blank lines to prevent double-spaced output
|
30
|
-
gsub(/^\n/, '').
|
31
|
-
|
32
|
-
# first paragraphs inside list items
|
33
|
-
gsub(/^(\.IP.*)\n\.PP/, '\1').
|
34
|
-
|
35
|
-
# paragraphs beginning with bold/italic and followed by
|
36
|
-
# at least one definition-indented line are definitions
|
37
|
-
gsub(/^\.PP(?=\n\\f.+\n#{DEFINITION_INDENT}\S)/, '.TP').
|
38
|
-
|
39
|
-
# make indented paragraphs occupy less space on screen:
|
40
|
-
# roff will fit the second line of the paragraph along
|
41
|
-
# side the first line if it has enough room to do so!
|
42
|
-
gsub(/^#{DEFINITION_INDENT}(?=\S)/, '').
|
43
|
-
|
44
|
-
# encode references to other man pages as "hyperlinks"
|
45
|
-
gsub(/(\w+)(\([1-9nol]\)[[:punct:]]?\s*)/, "\n.BR \\1 \\2\n").
|
46
|
-
# keep the SEE ALSO sequence of references in-line
|
47
|
-
gsub(/(?:^\.BR.+\n)+/m){ |sequence| sequence.squeeze("\n") }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
RENDERER = Redcarpet::Markdown.new(Renderer,
|
52
|
-
#:tables => true,
|
53
|
-
:autolink => true,
|
54
|
-
#:superscript => true,
|
55
|
-
:no_intra_emphasis => true,
|
56
|
-
:fenced_code_blocks => true,
|
57
|
-
:space_after_headers => true)
|
58
|
-
end
|