md2man 1.4.2 → 1.5.1

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.
@@ -1,7 +1,37 @@
1
- ## Version 1.4.2 (2013-02-24)
1
+ ## Version 1.5.1 (2013-03-06)
2
2
 
3
3
  Patch:
4
4
 
5
+ * All this time, this project's documentation stated that Redcarpet's
6
+ `no_intra_emphasis` option was enabled, but in reality, it was not.
7
+ The documentation has been corrected and the option remains disabled.
8
+
9
+ * In web pages generated by the `md2man:web` Rake task:
10
+
11
+ * deactivate cross references to external manual pages
12
+
13
+ * don't assume that NAME section contains a tagline
14
+
15
+ * sort man/ subdirectories in the HTML index page
16
+
17
+ * fix link to index page from webs directly in man/
18
+
19
+ * add generator META tag to HTML output template
20
+
21
+ * only apply special styling to the first H1 child
22
+
23
+ * parse title from first paragraph containing hyphen
24
+
25
+ Other:
26
+
27
+ * rename HISTORY to VERSION so it sorts after README
28
+
29
+ * tests should exercise engines with default options
30
+
31
+ ## Version 1.5.0 (2013-02-24)
32
+
33
+ Minor:
34
+
5
35
  * The `md2man:web` task from `md2man/rakefile` now:
6
36
 
7
37
  * emits valid HTML5 with helpful HTML page titles
data/bin/md2man CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # MD2MAN 1 2013-02-24 1.4.2
4
+ # MD2MAN 1 2013-03-06 1.5.1
5
5
 
6
6
  ## NAME
7
7
 
@@ -44,7 +44,6 @@ The following [Redcarpet] extensions are enabled while processing markdown(7):
44
44
  * autolink
45
45
  * superscript
46
46
  * strikethrough
47
- * no\_intra\_emphasis
48
47
  * fenced\_code\_blocks
49
48
 
50
49
  ## OPTIONS
data/bin/md2man-html CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin =======================================================================
3
3
 
4
- # MD2MAN-HTML 1 2013-02-24 1.4.2
4
+ # MD2MAN-HTML 1 2013-03-06 1.5.1
5
5
 
6
6
  ## NAME
7
7
 
@@ -46,16 +46,13 @@ wrap_html_template = lambda do |title, content|
46
46
  <html>
47
47
  <head>
48
48
  <meta charset="utf-8" />
49
+ <meta name="generator" content="md2man #{Md2Man::VERSION} https://github.com/sunaku/md2man" />
49
50
  <title>#{title}</title>
50
51
  <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
51
52
  <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" />
52
53
  <style type="text/css">
53
54
  @media all {
54
- .manpage h1 {
55
- font-weight: normal;
56
- font-size: smaller;
57
- text-align: right;
58
- }
55
+ .manpage h1,
59
56
  .manpage h2,
60
57
  .manpage h3,
61
58
  .manpage h4,
@@ -63,14 +60,24 @@ wrap_html_template = lambda do |title, content|
63
60
  .manpage h6 {
64
61
  margin-top: 1em;
65
62
  }
63
+
64
+ /* deactivate external manual page cross-references */
65
+ a.manpage-reference:not([href]) {
66
+ color: inherit;
67
+ text-decoration: none;
68
+ }
66
69
  }
67
70
  @media screen {
68
71
  .manpage {
69
72
  font-family: monospace;
70
73
  max-width: 78ex;
71
74
  }
72
- .manpage h1 {
75
+
76
+ .manpage > h1:first-child {
73
77
  margin-top: -5em;
78
+ font-weight: normal;
79
+ font-size: smaller;
80
+ text-align: right;
74
81
  }
75
82
  }
76
83
 
@@ -108,20 +115,21 @@ parse_manpage_name = lambda do |html_file_name|
108
115
  end
109
116
 
110
117
  parse_manpage_info = lambda do |html_file_body|
111
- html_file_body.scan(%r{<h2.*?>NAME</h2>(.+?)<h2}m).flatten.first.
112
- to_s.split(/\s+-\s+/, 2).last.to_s.gsub(/<.+?>/, '') # strip HTML
118
+ if html_file_body =~ %r{<p>.+?\s-\s+(.+?)</p>}
119
+ $1.gsub(/<.+?>/, '') # strip HTML tags
120
+ end
113
121
  end
114
122
 
115
123
  file 'man/index.html' => webs do |t|
116
124
  buffer = ['<div class="container-fluid">']
117
- webs.group_by {|web| web.pathmap('%d') }.each do |dir, dir_webs|
125
+ webs.sort.group_by {|web| web.pathmap('%d') }.each do |dir, dir_webs|
118
126
  subdir = dir.sub('man/', '')
119
127
  buffer << %{<h2 id="#{subdir}">#{subdir}</h2>}
120
128
 
121
129
  dir_webs.each do |web|
122
130
  name = parse_manpage_name.call(web)
123
131
  info = parse_manpage_info.call(File.read(web))
124
- link = %{<a href="#{subdir}/#{web.pathmap('%f')}">#{name}</a>}
132
+ link = %{<a href="../#{web}">#{name}</a>}
125
133
  buffer << %{<dl class="dl-horizontal"><dt>#{link}</dt><dd>#{info}</dd></dl>}
126
134
  end
127
135
  end
@@ -136,19 +144,23 @@ end
136
144
  mkds.zip(webs).each do |src, dst|
137
145
  render_file_task.call src, dst, lambda {|input|
138
146
  require 'md2man/html/engine'
139
- output = Md2Man::HTML::ENGINE.render(input)
147
+ output = Md2Man::HTML::ENGINE.render(input).
148
+ # deactivate external manual page cross-references
149
+ gsub(/(?<=<a class="manpage-reference") href="\.\.(.+?)"/) do
150
+ $& if webs.include? 'man' + $1
151
+ end
140
152
 
141
153
  name = parse_manpage_name.call(dst)
142
154
  info = parse_manpage_info.call(output)
143
- title = [name, info].join(' &mdash; ')
155
+ title = [name, info].compact.join(' &mdash; ')
144
156
 
145
157
  subdir = dst.pathmap('%d').sub('man/', '')
146
- ascend = '../' * subdir.count('/').next
158
+ ascent = '../' * (dst.count('/') - 1)
147
159
  content = [
148
160
  '<div class="navbar">',
149
161
  '<div class="navbar-inner">',
150
162
  '<span class="brand">',
151
- %{<a href="#{ascend}index.html##{subdir}">#{subdir}</a>},
163
+ %{<a href="#{ascent}index.html##{subdir}">#{subdir}</a>},
152
164
  '/',
153
165
  dst.pathmap('%n'),
154
166
  '</span>',
@@ -1,3 +1,3 @@
1
1
  module Md2Man
2
- VERSION = "1.4.2"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -1,4 +1,4 @@
1
- .TH MD2MAN\-HTML 1 2013\-02\-24 1.4.2
1
+ .TH MD2MAN\-HTML 1 2013\-03\-06 1.5.1
2
2
  .SH NAME
3
3
  .PP
4
4
  md2man\-html \- convert
data/man/man1/md2man.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH MD2MAN 1 2013\-02\-24 1.4.2
1
+ .TH MD2MAN 1 2013\-03\-06 1.5.1
2
2
  .SH NAME
3
3
  .PP
4
4
  md2man \- convert
@@ -72,8 +72,6 @@ superscript
72
72
  .IP \(bu 2
73
73
  strikethrough
74
74
  .IP \(bu 2
75
- no_intra_emphasis
76
- .IP \(bu 2
77
75
  fenced_code_blocks
78
76
  .RE
79
77
  .SH OPTIONS
@@ -3,7 +3,7 @@ require 'md2man/html/engine'
3
3
 
4
4
  describe 'html engine' do
5
5
  before do
6
- @markdown = Redcarpet::Markdown.new(Md2Man::HTML::Engine)
6
+ @markdown = Md2Man::HTML::ENGINE
7
7
  end
8
8
 
9
9
  def heredoc document
@@ -11,11 +11,7 @@ require 'md2man/engine'
11
11
 
12
12
  describe 'roff engine' do
13
13
  before do
14
- @markdown = Redcarpet::Markdown.new(
15
- Md2Man::Engine,
16
- :tables => true,
17
- :autolink => true,
18
- )
14
+ @markdown = Md2Man::ENGINE
19
15
  end
20
16
 
21
17
  SPACE = 0x20.chr
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.4.2
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: binman
@@ -88,10 +88,10 @@ files:
88
88
  - EXAMPLE.markdown
89
89
  - EXAMPLE.png
90
90
  - Gemfile
91
- - HISTORY.markdown
92
91
  - LICENSE
93
92
  - README.markdown
94
93
  - Rakefile
94
+ - VERSION.markdown
95
95
  - bin/md2man
96
96
  - bin/md2man-html
97
97
  - lib/md2man.rb
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -4385989232300827218
131
+ hash: -3470085160060780883
132
132
  requirements: []
133
133
  rubyforge_project:
134
134
  rubygems_version: 1.8.23