ronn-ng 0.8.1 → 0.10.1.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +32 -3
  3. data/Gemfile.lock +70 -0
  4. data/INSTALLING.md +2 -2
  5. data/README.md +40 -30
  6. data/Rakefile +4 -4
  7. data/bin/ronn +23 -11
  8. data/lib/ronn.rb +3 -8
  9. data/lib/ronn/document.rb +23 -12
  10. data/lib/ronn/index.rb +2 -4
  11. data/lib/ronn/roff.rb +18 -8
  12. data/lib/ronn/template.rb +1 -0
  13. data/man/ronn-format.7 +8 -8
  14. data/man/ronn.1 +24 -20
  15. data/man/ronn.1.ronn +10 -7
  16. data/ronn-ng.gemspec +23 -13
  17. data/test/angle_bracket_syntax.html +11 -1
  18. data/test/angle_bracket_syntax.roff +24 -0
  19. data/test/angle_bracket_syntax.ronn +10 -0
  20. data/test/code_blocks.html +38 -0
  21. data/test/code_blocks.roff +38 -0
  22. data/test/{code_blocks.7.ronn → code_blocks.ronn} +0 -0
  23. data/test/code_blocks_regression +19 -0
  24. data/test/code_blocks_regression.html +38 -0
  25. data/test/code_blocks_regression.ronn +40 -0
  26. data/test/definition_list_syntax.html +2 -2
  27. data/test/definition_list_syntax.roff +1 -1
  28. data/test/dots_at_line_start_test.roff +3 -3
  29. data/test/ellipses.roff +2 -2
  30. data/test/entity_encoding_test.html +20 -12
  31. data/test/entity_encoding_test.roff +26 -15
  32. data/test/entity_encoding_test.ronn +9 -0
  33. data/test/markdown_syntax.html +8 -10
  34. data/test/markdown_syntax.roff +49 -49
  35. data/test/middle_paragraph.roff +1 -1
  36. data/test/missing_spaces.roff +1 -1
  37. data/test/nested_list_with_code.html +6 -7
  38. data/test/nested_list_with_code.roff +4 -4
  39. data/test/ordered_list.html +8 -10
  40. data/test/ordered_list.roff +1 -1
  41. data/test/pre_block_with_quotes.roff +1 -1
  42. data/test/section_reference_links.roff +2 -2
  43. data/test/single_quotes.html +11 -0
  44. data/test/single_quotes.roff +5 -0
  45. data/test/single_quotes.ronn +9 -0
  46. data/test/test_ronn.rb +9 -9
  47. data/test/underline_spacing_test.roff +1 -1
  48. metadata +72 -61
  49. data/test/url_formatting.ronn +0 -3
@@ -1,7 +1,7 @@
1
1
  require 'time'
2
2
  require 'cgi'
3
3
  require 'nokogiri'
4
- require 'rdiscount'
4
+ require 'kramdown'
5
5
  require 'ronn/index'
6
6
  require 'ronn/roff'
7
7
  require 'ronn/template'
@@ -20,9 +20,12 @@ module Ronn
20
20
  include Ronn::Utils
21
21
 
22
22
  # Path to the Ronn document. This may be '-' or nil when the Ronn::Document
23
- # object is created with a stream.
23
+ # object is created with a stream, in which case stdin will be read.
24
24
  attr_reader :path
25
25
 
26
+ # Encoding that the Ronn document is in
27
+ attr_accessor :encoding
28
+
26
29
  # The raw input data, read from path or stream and unmodified.
27
30
  attr_reader :data
28
31
 
@@ -58,7 +61,7 @@ module Ronn
58
61
  # Array of style modules to apply to the document.
59
62
  attr_reader :styles
60
63
 
61
- # Output directory to write files to
64
+ # Output directory to write files to.
62
65
  attr_accessor :outdir
63
66
 
64
67
  # Create a Ronn::Document given a path or with the data returned by
@@ -71,9 +74,9 @@ module Ronn
71
74
  @reader = block ||
72
75
  lambda do |f|
73
76
  if ['-', nil].include?(f)
74
- STDIN.read
77
+ $stdin.read
75
78
  else
76
- File.read(f)
79
+ File.read(f, encoding: @encoding)
77
80
  end
78
81
  end
79
82
  @data = @reader.call(path)
@@ -118,7 +121,7 @@ module Ronn
118
121
  return unless @basename
119
122
 
120
123
  parts = @basename.split('.')
121
- parts.pop if parts.last.casecmp('ronn').zero?
124
+ parts.pop if parts.length > 1 && parts.last =~ /^\w+$/
122
125
  parts.pop if parts.last =~ /^\d+$/
123
126
  parts.join('.')
124
127
  end
@@ -205,7 +208,9 @@ module Ronn
205
208
  # tuple of the form: [name, section, description], where missing information
206
209
  # is represented by nil and any element may be missing.
207
210
  def sniff
208
- html = Markdown.new(data[0, 512], :no_superscript).to_html
211
+ html = Kramdown::Document.new(data[0, 512], auto_ids: false,
212
+ smart_quotes: ['apos', 'apos', 'quot', 'quot'],
213
+ typographic_symbols: { hellip: '...', ndash: '--', mdash: '--' }).to_html
209
214
  heading, html = html.split("</h1>\n", 2)
210
215
  return [nil, nil, nil] if html.nil?
211
216
 
@@ -289,7 +294,7 @@ module Ronn
289
294
  to_h.to_yaml
290
295
  end
291
296
 
292
- def to_json
297
+ def to_json(*_args)
293
298
  require 'json'
294
299
  to_h.merge('date' => date.iso8601).to_json
295
300
  end
@@ -307,7 +312,13 @@ module Ronn
307
312
  end
308
313
 
309
314
  def input_html
310
- @input_html ||= strip_heading(Markdown.new(markdown, :no_superscript).to_html)
315
+ @input_html ||= strip_heading(Kramdown::Document.new(markdown,
316
+ auto_ids: false,
317
+ input: 'GFM',
318
+ hard_wrap: 'false',
319
+ syntax_highlighter_opts: 'line_numbers: false',
320
+ smart_quotes: ['apos', 'apos', 'quot', 'quot'],
321
+ typographic_symbols: { hellip: '...', ndash: '--', mdash: '--' }).to_html)
311
322
  end
312
323
 
313
324
  def strip_heading(html)
@@ -362,7 +373,7 @@ module Ronn
362
373
 
363
374
  # Convert <WORD> to <var>WORD</var> but only if WORD isn't an HTML tag.
364
375
  def markdown_filter_angle_quotes(markdown)
365
- markdown.gsub(/<([^:.\/]+?)>/) do |match|
376
+ markdown.gsub(/(?<!\\)<([^:.\/]+?)>/) do |match|
366
377
  contents = $1
367
378
  tag, attrs = contents.split(' ', 2)
368
379
  if attrs =~ /\/=/ || html_element?(tag.sub(/^\//, '')) ||
@@ -395,12 +406,12 @@ module Ronn
395
406
  # process all unordered lists depth-first
396
407
  @html.search('ul').to_a.reverse_each do |ul|
397
408
  items = ul.search('li')
398
- next if items.any? { |item| item.inner_text.split("\n", 2).first !~ /:$/ }
409
+ next if items.any? { |item| item.inner_text.strip.split("\n", 2).first !~ /:$/ }
399
410
 
400
411
  dl = Nokogiri::XML::Node.new 'dl', html
401
412
  items.each do |item|
402
413
  # This processing is specific to how Markdown generates definition lists
403
- term, definition = item.inner_html.split(":\n", 2)
414
+ term, definition = item.inner_html.strip.split(":\n", 2)
404
415
  term = term.sub(/^<p>/, '')
405
416
 
406
417
  dt = Nokogiri::XML::Node.new 'dt', html
@@ -5,8 +5,7 @@ module Ronn
5
5
  class Index
6
6
  include Enumerable
7
7
 
8
- attr_reader :path
9
- attr_reader :references
8
+ attr_reader :path, :references
10
9
 
11
10
  # Retrieve an Index for <path>, where <path> is a directory or normal
12
11
  # file. The index is loaded from the corresponding index.txt file if
@@ -142,8 +141,7 @@ module Ronn
142
141
  #
143
142
  # The #url method should be used to obtain the href value for HTML.
144
143
  class Reference
145
- attr_reader :name
146
- attr_reader :location
144
+ attr_reader :name, :location
147
145
 
148
146
  def initialize(index, name, location)
149
147
  @index = index
@@ -36,7 +36,11 @@ module Ronn
36
36
  comment "generated with Ronn-NG/v#{Ronn.version}"
37
37
  comment "http://github.com/apjanke/ronn-ng/tree/#{Ronn.revision}"
38
38
  return if name.nil?
39
- macro 'TH', %("#{escape(name.upcase)}" "#{section}" "#{date.strftime('%B %Y')}" "#{version}" "#{manual}")
39
+ if manual
40
+ macro 'TH', %("#{escape(name.upcase)}" "#{section}" "#{date.strftime('%B %Y')}" "#{version}" "#{manual}")
41
+ else
42
+ macro 'TH', %("#{escape(name.upcase)}" "#{section}" "#{date.strftime('%B %Y')}" "#{version}")
43
+ end
40
44
  end
41
45
 
42
46
  def remove_extraneous_elements!(doc)
@@ -164,7 +168,7 @@ module Ronn
164
168
  when 'ol'
165
169
  macro 'IP', %W["#{node.parent.children.index(node) + 1}." 4]
166
170
  when 'ul'
167
- macro 'IP', ['"\\[ci]"', '4']
171
+ macro 'IP', ['"\(bu"', '4']
168
172
  else
169
173
  raise "List element found as a child of non-list parent element: #{node.inspect}"
170
174
  end
@@ -246,10 +250,14 @@ module Ronn
246
250
  text = node.to_html.dup
247
251
  write escape(text)
248
252
 
253
+ elsif node.comment?
254
+ # ignore HTML comments
255
+
249
256
  elsif node.elem?
250
257
  case node.name
251
258
  when 'span'
252
259
  inline_filter(node.children)
260
+
253
261
  when 'code'
254
262
  if child_of?(node, 'pre')
255
263
  inline_filter(node.children)
@@ -277,13 +285,13 @@ module Ronn
277
285
  inline_filter(node.children)
278
286
  elsif node.has_attribute?('data-bare-link')
279
287
  write '\fI'
280
- write '\%' + escape(node.attributes['href'].content)
288
+ inline_filter(node.children)
281
289
  write '\fR'
282
290
  else
283
291
  inline_filter(node.children)
284
292
  write ' '
285
293
  write '\fI'
286
- write '\%' + escape(node.attributes['href'].content)
294
+ write escape(node.attributes['href'].content)
287
295
  write '\fR'
288
296
  end
289
297
 
@@ -312,7 +320,7 @@ module Ronn
312
320
  end
313
321
 
314
322
  HTML_ROFF_ENTITIES = {
315
- '•' => '\[ci]',
323
+ '•' => '\(bu',
316
324
  '&lt;' => '<',
317
325
  '&gt;' => '>',
318
326
  ' ' => '\~', # That's a literal non-breaking space character there
@@ -335,7 +343,7 @@ module Ronn
335
343
  text.gsub!(/&#(\d+);/) { $1.to_i.chr } # dec entities
336
344
  text.gsub!('\\', '\e') # backslash
337
345
  text.gsub!('...', '\|.\|.\|.') # ellipses
338
- text.gsub!(/['.-]/) { |m| "\\#{m}" } # control chars
346
+ text.gsub!(/[.-]/) { |m| "\\#{m}" } # control chars
339
347
  ent.each do |key, val|
340
348
  text.gsub!(key, val)
341
349
  end
@@ -350,10 +358,12 @@ module Ronn
350
358
  # write text to output buffer
351
359
  def write(text)
352
360
  return if text.nil? || text.empty?
353
- # lines cannot start with a '.'. insert zero-width character before.
354
- text = text.gsub(/\n\\\./s, "\n\\\\&\\.")
361
+ # lines cannot start with a '.' or "'". insert zero-width character before.
362
+ text = text.gsub(/\n\\\./, "\n\\\\&\\.")
363
+ text = text.gsub(/\n'/, "\n\\&\\'")
355
364
  buf_ends_in_newline = @buf.last && @buf.last[-1] == "\n"
356
365
  @buf << '\&' if text[0, 2] == '\.' && buf_ends_in_newline
366
+ @buf << '\&' if text[0, 1] == "'" && buf_ends_in_newline
357
367
  @buf << text
358
368
  end
359
369
 
@@ -7,6 +7,7 @@ module Ronn
7
7
  self.template_extension = 'html'
8
8
 
9
9
  def initialize(document, style_path = ENV['RONN_STYLE'].to_s.split(':'))
10
+ super()
10
11
  @document = document
11
12
  @style_path = style_path + [Template.template_path]
12
13
  end
@@ -1,6 +1,6 @@
1
- .\" generated with Ronn-NG/v0.8.1
2
- .\" http://github.com/apjanke/ronn-ng/tree/0.8.1.SNAPSHOT
3
- .TH "RONN\-FORMAT" "7" "December 2018" "Ronn-NG 0.8.1.SNAPSHOT" "Ronn Manual"
1
+ .\" generated with Ronn-NG/v0.10.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.10.1.pre1
3
+ .TH "RONN\-FORMAT" "7" "December 2018" "Ronn-NG 0.10.1.pre1" "Ronn Manual"
4
4
  .SH "NAME"
5
5
  \fBronn\-format\fR \- manual authoring format based on Markdown
6
6
  .SH "SYNOPSIS"
@@ -83,9 +83,9 @@ HEADING TEXT
83
83
  .P
84
84
  Section headings should be all uppercase and may not contain inline markup\.
85
85
  .SH "INLINE MARKUP"
86
- Manpages have a limited set of text formatting capabilities\. There\'s basically \fBboldface\fR and \fIitalics\fR (often displayed using \fIunderline\fR)\. Ronn uses the following bits of markdown(7) to accomplish this:
86
+ Manpages have a limited set of text formatting capabilities\. There's basically \fBboldface\fR and \fIitalics\fR (often displayed using \fIunderline\fR)\. Ronn uses the following bits of markdown(7) to accomplish this:
87
87
  .TP
88
- \fB`backticks`\fR (markdown compatible)
88
+ \fB\e`backticks\e`\fR (markdown compatible)
89
89
  Code, flags, commands, and noun\-like things; typically displayed in in \fBboldface\fR\. All text included within \fBbackticks\fR is displayed literally; other inline markup is not processed\. HTML output: \fB<code>\fR\.
90
90
  .TP
91
91
  \fB**double\-stars**\fR (markdown compatible)
@@ -97,7 +97,7 @@ User\-specified arguments, variables, or user input\. Typically displayed with \
97
97
  \fB_\fR\fIunderbars\fR\fB_\fR (markdown compatible)
98
98
  Emphasis\. May be used for literal option values\. Typically displayed with \fIunderline\fR in roff output\. HTML output: \fB<em>\fR\.
99
99
  .P
100
- Here is grep(1)\'s DESCRIPTION section represented in \fBronn\fR:
100
+ Here is grep(1)'s DESCRIPTION section represented in \fBronn\fR:
101
101
  .IP "" 4
102
102
  .nf
103
103
  `Grep` searches the named input <FILE> (or standard input if
@@ -107,9 +107,9 @@ prints the matching lines\.
107
107
  .fi
108
108
  .IP "" 0
109
109
  .SH "DEFINITION LISTS"
110
- The definition list syntax is compatible with markdown\'s unordered list syntax but requires that the first line of each list item be terminated with a colon "\fB:\fR" character\. The contents of the first line is the \fIterm\fR; subsequent lines may be comprised of multiple paragraphs, code blocks, standard lists, and nested definition lists\.
110
+ The definition list syntax is compatible with markdown's unordered list syntax but requires that the first line of each list item be terminated with a colon "\fB:\fR" character\. The contents of the first line is the \fIterm\fR; subsequent lines may be comprised of multiple paragraphs, code blocks, standard lists, and nested definition lists\.
111
111
  .P
112
- An example definition list, taken from BSD test(1)\'s \fIDESCRIPTION\fR section:
112
+ An example definition list, taken from BSD test(1)'s \fIDESCRIPTION\fR section:
113
113
  .IP "" 4
114
114
  .nf
115
115
  The following primaries are used to construct expressions:
data/man/ronn.1 CHANGED
@@ -1,6 +1,6 @@
1
- .\" generated with Ronn-NG/v0.8.1
2
- .\" http://github.com/apjanke/ronn-ng/tree/0.8.1.SNAPSHOT
3
- .TH "RONN" "1" "December 2018" "Ronn-NG 0.8.1.SNAPSHOT" "Ronn Manual"
1
+ .\" generated with Ronn-NG/v0.10.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.10.1.pre1
3
+ .TH "RONN" "1" "January 2020" "Ronn-NG 0.10.1.pre1" "Ronn Manual"
4
4
  .SH "NAME"
5
5
  \fBronn\fR \- convert markdown files to manpages
6
6
  .SH "SYNOPSIS"
@@ -13,6 +13,8 @@
13
13
  \fBronn\fR \fB\-\-pipe\fR \fIfile\fR
14
14
  .br
15
15
  \fBronn\fR < \fIfile\fR
16
+ .br
17
+ \fBronn\fR \fB\-E\fR|\fB\-\-encoding\fR \fIencoding\fR \|\.\|\.\|\.
16
18
  .SH "DESCRIPTION"
17
19
  \fBRonn\fR converts textfiles to standard roff\-formatted Unix manpages or HTML\. ronn\-format(7) is based on markdown(7) but includes additional rules and syntax geared toward authoring manuals\.
18
20
  .P
@@ -22,25 +24,29 @@ The \fB\-\-server\fR and \fB\-\-man\fR options change the output behavior from f
22
24
  .P
23
25
  With no \fIfile\fR arguments, \fBronn\fR acts as simple filter\. Ronn source text is read from standard input and roff output is written to standard output\. Use the \fB\-\-html\fR, \fB\-\-roff\fR, and/or \fB\-\-fragment\fR options to select the output format\.
24
26
  .SH "FILES"
25
- The \fBronn\fR command expects input to be valid ronn\-format(7) text\. Source files are typically named \fIname\fR\.\fIsection\fR\.ronn (e\.g\., \fBexample\.1\.ronn\fR)\. The \fIname\fR and \fIsection\fR should match the name and section defined in the \fIfile\fR\'s heading\.
27
+ The \fBronn\fR command expects input to be valid ronn\-format(7) text\. Source files are typically named \fIname\fR\.\fIsection\fR\.ronn (e\.g\., \fBexample\.1\.ronn\fR)\. The \fIname\fR and \fIsection\fR should match the name and section defined in the \fIfile\fR's heading\.
28
+ .P
29
+ Source files must be in UTF\-8 encoding, or the encoding specified by the \fB\-E\fR/\fB\-\-encoding\fR option, regardless of the locale that \fBronn\fR is running under\.
26
30
  .P
27
31
  When building roff or HTML output files, destination filenames are determined by taking the basename of the input \fIfile\fR and adding the appropriate file extension (or removing the file extension in the case of roff output)\. For example, executing \fBronn example\.1\.ronn\fR generates \fBexample\.1\fR with roff output and \fBexample\.1\.html\fR with HTML output\.
28
32
  .SH "OPTIONS"
29
33
  These options control whether output is written to file(s), standard output, or directly to a man pager\.
30
- .IP "\[ci]" 4
31
- \fB\-m\fR, \fB\-\-man\fR: Don\'t generate files, display \fIfile\fRs as if man(1) were invoked on the roff output file\. This simulates default man behavior by piping the roff output through groff(1) and the paging program specified by the \fBMANPAGER\fR environment variable\.
32
- .IP "\[ci]" 4
33
- \fB\-S\fR, \fB\-\-server\fR: Don\'t generate files, start an HTTP server at \fIhttp://localhost:1207/\fR and serve dynamically generated HTML for the set of input \fIfile\fRs\. A file named \fIexample\.2\.ronn\fR is served as \fI/example\.2\.html\fR\. There\'s also an index page at the root with links to each \fIfile\fR\.
34
+ .IP "\(bu" 4
35
+ \fB\-m\fR, \fB\-\-man\fR: Don't generate files, display \fIfile\fRs as if man(1) were invoked on the roff output file\. This simulates default man behavior by piping the roff output through groff(1) and the paging program specified by the \fBMANPAGER\fR environment variable\.
36
+ .IP "\(bu" 4
37
+ \fB\-S\fR, \fB\-\-server\fR: Don't generate files, start an HTTP server at \fIhttp://localhost:1207/\fR and serve dynamically generated HTML for the set of input \fIfile\fRs\. A file named \fIexample\.2\.ronn\fR is served as \fI/example\.2\.html\fR\. There's also an index page at the root with links to each \fIfile\fR\.
34
38
  .IP
35
39
  The server respects the \fB\-\-style\fR and document attribute options (\fB\-\-manual\fR, \fB\-\-date\fR, etc\.)\. These same options can be varied at request time by giving them as query parameters: \fB?manual=FOO&style=dark,toc\fR
36
40
  .IP
37
41
  \fINOTE: The builtin server is designed to assist in the process of writing and styling manuals\. It is in no way recommended as a general purpose web server\.\fR
38
- .IP "\[ci]" 4
42
+ .IP "\(bu" 4
39
43
  \fB\-\-port\fR=\fIport\fR When used with \fB\-S\fR/\fB\-\-server\fR, runs the server at the specified port instead of the default port 1207\.
40
- .IP "\[ci]" 4
41
- \fB\-\-pipe\fR: Don\'t generate files, write generated output to standard output\. This is the default behavior when ronn source text is piped in on standard input and no \fIfile\fR arguments are provided\.
42
- .IP "\[ci]" 4
44
+ .IP "\(bu" 4
45
+ \fB\-\-pipe\fR: Don't generate files, write generated output to standard output\. This is the default behavior when ronn source text is piped in on standard input and no \fIfile\fR arguments are provided\.
46
+ .IP "\(bu" 4
43
47
  \fB\-o\fR=\fIdirectory\fR, \fB\-\-output\-dir\fR=\fIdirectory\fR: Write generated files to the specified directory instead of the default location\.
48
+ .IP "\(bu" 4
49
+ \fB\-E\fR=\fIencoding\fR, \fB\-\-encoding\fR=<encoding: Specify the encoding that input files are in\. Default is UTF\-8, regardless of user's locale settings\. Input sent to STDIN is always treated as UTF\-8, regardless of whether \fB\-E\fR is passed\.
44
50
  .IP "" 0
45
51
  .P
46
52
  Format options control the files \fBronn\fR generates, or the output format when the \fB\-\-pipe\fR argument is specified\. When no format options are given, both \fB\-\-roff\fR and \fB\-\-html\fR are assumed\.
@@ -63,7 +69,7 @@ The name of the manual this man page belongs to; \fImanual\fR is prominently dis
63
69
  The name of the group, organization, or individual responsible for publishing the document; \fIname\fR is displayed in the bottom\-left footer area\.
64
70
  .TP
65
71
  \fB\-\-date\fR=\fIdate\fR
66
- The document\'s published date; \fIdate\fR must be formatted \fBYYYY\-MM\-DD\fR and is displayed in the bottom\-center footer area\. The \fIfile\fR mtime is used when no \fIdate\fR is given, or the current time when no \fIfile\fR is available\.
72
+ The document's published date; \fIdate\fR must be formatted \fBYYYY\-MM\-DD\fR and is displayed in the bottom\-center footer area\. The \fIfile\fR mtime is used when no \fIdate\fR is given, or the current time when no \fIfile\fR is available\.
67
73
  .P
68
74
  HTML output can be customized through the use of CSS stylesheets:
69
75
  .TP
@@ -79,7 +85,7 @@ Internal styles are \fIman\fR (included by default), \fItoc\fR, and \fI80c\fR\.
79
85
  Miscellaneous options:
80
86
  .TP
81
87
  \fB\-w\fR, \fB\-\-warnings\fR
82
- Show troff warnings on standard error when performing roff conversion\. Warnings are most often the result of a bug in ronn\'s HTML to roff conversion logic\.
88
+ Show troff warnings on standard error when performing roff conversion\. Warnings are most often the result of a bug in ronn's HTML to roff conversion logic\.
83
89
  .TP
84
90
  \fB\-W\fR
85
91
  Disable troff warnings\. Warnings are disabled by default\. This option can be used to revert the effect of a previous \fB\-w\fR argument\.
@@ -87,7 +93,7 @@ Disable troff warnings\. Warnings are disabled by default\. This option can be u
87
93
  \fB\-v\fR, \fB\-\-version\fR
88
94
  Show ronn version and exit\.
89
95
  .SH "LINK INDEXES"
90
- When generating HTML output, \fBronn\fR hyperlinks manual references (like \fBgrep(1)\fR, \fBls(1)\fR, \fBmarkdown(7)\fR) in source text based on reference name to URL mappings defined in an \fBindex\.txt\fR file\. Each line of the index file describes a single reference link, with whitespace separating the reference\'s \fIid\fR from its \fIlocation\fR\. Blank lines are allowed; lines beginning with a \fB#\fR character are ignored:
96
+ When generating HTML output, \fBronn\fR hyperlinks manual references (like \fBgrep(1)\fR, \fBls(1)\fR, \fBmarkdown(7)\fR) in source text based on reference name to URL mappings defined in an \fBindex\.txt\fR file\. Each line of the index file describes a single reference link, with whitespace separating the reference's \fIid\fR from its \fIlocation\fR\. Blank lines are allowed; lines beginning with a \fB#\fR character are ignored:
91
97
  .IP "" 4
92
98
  .nf
93
99
  # manuals included in this project:
@@ -103,9 +109,9 @@ src http://github\.com/
103
109
  .fi
104
110
  .IP "" 0
105
111
  .P
106
- The \fIlocation\fR is an absolute or relative URL that usually points at an HTML version of manpage\. It\'s possible to define references for things that aren\'t manpages\.
112
+ The \fIlocation\fR is an absolute or relative URL that usually points at an HTML version of manpage\. It's possible to define references for things that aren't manpages\.
107
113
  .P
108
- All manuals in an individual directory share the references defined in that directory\'s \fBindex\.txt\fR file\. Index references may be used explicitly in Markdown reference style links using the syntax: \fB[\fR\fItext\fR\fB][\fR\fIid\fR\fB]\fR, where \fItext\fR is the link text and \fIid\fR is a reference name defined in the index\.
114
+ All manuals in an individual directory share the references defined in that directory's \fBindex\.txt\fR file\. Index references may be used explicitly in Markdown reference style links using the syntax: \fB[\fR\fItext\fR\fB][\fR\fIid\fR\fB]\fR, where \fItext\fR is the link text and \fIid\fR is a reference name defined in the index\.
109
115
  .SH "STYLES"
110
116
  The \fB\-\-style\fR option selects a list of CSS stylesheets to include in the generated HTML\. Styles are applied in the order defined, so each can use the cascade to override previously defined styles\.
111
117
  .SS "Builtin Stylesheets"
@@ -211,12 +217,10 @@ The default manual date in \fBYYYY\-MM\-DD\fR format\. Displayed in the bottom\-
211
217
  A \fBPATH\fR\-style list of directories to check for stylesheets given to the \fB\-\-style\fR option\. Directories are separated by a \fI:\fR; blank entries are ignored\. Use \fI\.\fR to include the current working directory\.
212
218
  .TP
213
219
  \fBMANPAGER\fR
214
- The paging program used for man pages\. This is typically set to something like \'less \-is\'\.
220
+ The paging program used for man pages\. This is typically set to something like 'less \-is'\.
215
221
  .TP
216
222
  \fBPAGER\fR
217
223
  Used instead of \fBMANPAGER\fR when \fBMANPAGER\fR is not defined\.
218
- .SH "BUGS"
219
- \fBRonn\fR is written in Ruby and depends on hpricot and rdiscount, extension libraries that are non\-trivial to install on some systems\. A more portable version of this program would be welcome\.
220
224
  .SH "COPYRIGHT"
221
225
  Ronn\-NG is Copyright (C) 2009 Ryan Tomayko \fIhttp://tomayko\.com/about\fR and (C) 2018 Andrew Janke \fIhttps://apjanke\.net\fR
222
226
  .SH "SEE ALSO"
@@ -7,7 +7,8 @@ ronn(1) -- convert markdown files to manpages
7
7
  `ronn` `-m`|`--man` <file>...<br>
8
8
  `ronn` `-S`|`--server` <file>...<br>
9
9
  `ronn` `--pipe` <file><br>
10
- `ronn` &lt; <file>
10
+ `ronn` &lt; <file><br>
11
+ `ronn` `-E`|`--encoding` <encoding> ...
11
12
 
12
13
  ## DESCRIPTION
13
14
 
@@ -35,6 +36,9 @@ The `ronn` command expects input to be valid ronn-format(7) text. Source files
35
36
  are typically named <name>.<section>.ronn (e.g., `example.1.ronn`). The <name>
36
37
  and <section> should match the name and section defined in the <file>'s heading.
37
38
 
39
+ Source files must be in UTF-8 encoding, or the encoding specified by the
40
+ `-E`/`--encoding` option, regardless of the locale that `ronn` is running under.
41
+
38
42
  When building roff or HTML output files, destination filenames are determined by
39
43
  taking the basename of the input <file> and adding the appropriate file
40
44
  extension (or removing the file extension in the case of roff output). For
@@ -78,6 +82,11 @@ directly to a man pager.
78
82
  * `-o`=<directory>, `--output-dir`=<directory>:
79
83
  Write generated files to the specified directory instead of the default
80
84
  location.
85
+
86
+ * `-E`=<encoding>, `--encoding`=<encoding:
87
+ Specify the encoding that input files are in. Default is UTF-8, regardless
88
+ of user's locale settings. Input sent to STDIN is always treated as UTF-8,
89
+ regardless of whether `-E` is passed.
81
90
 
82
91
  Format options control the files `ronn` generates, or the output format when the
83
92
  `--pipe` argument is specified. When no format options are given, both `--roff`
@@ -298,12 +307,6 @@ under a `man/` directory:
298
307
  * `PAGER`:
299
308
  Used instead of `MANPAGER` when `MANPAGER` is not defined.
300
309
 
301
- ## BUGS
302
-
303
- **Ronn** is written in Ruby and depends on hpricot and rdiscount, extension
304
- libraries that are non-trivial to install on some systems. A more portable
305
- version of this program would be welcome.
306
-
307
310
  ## COPYRIGHT
308
311
 
309
312
  Ronn-NG is Copyright (C) 2009 Ryan Tomayko <http://tomayko.com/about> and
@@ -1,7 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ronn-ng'
3
- s.version = '0.8.1'
4
- s.date = '2019-03-05'
3
+ s.version = '0.10.1.pre1'
4
+ s.date = '2020-12-22'
5
+ s.required_ruby_version = '>= 2.4'
5
6
 
6
7
  s.summary = 'Builds man pages from Markdown'
7
8
  s.description = 'Ronn-NG builds manuals in HTML and Unix man page format from Markdown.'
@@ -22,6 +23,7 @@ Gem::Specification.new do |s|
22
23
  AUTHORS
23
24
  CHANGES
24
25
  Gemfile
26
+ Gemfile.lock
25
27
  INSTALLING.md
26
28
  LICENSE.txt
27
29
  README.md
@@ -53,13 +55,19 @@ Gem::Specification.new do |s|
53
55
  man/ronn.1.ronn
54
56
  ronn-ng.gemspec
55
57
  test/angle_bracket_syntax.html
58
+ test/angle_bracket_syntax.roff
56
59
  test/angle_bracket_syntax.ronn
57
60
  test/backticks.html
58
61
  test/backticks.ronn
59
62
  test/basic_document.html
60
63
  test/basic_document.ronn
61
64
  test/circumflexes.ronn
62
- test/code_blocks.7.ronn
65
+ test/code_blocks.html
66
+ test/code_blocks.roff
67
+ test/code_blocks.ronn
68
+ test/code_blocks_regression
69
+ test/code_blocks_regression.html
70
+ test/code_blocks_regression.ronn
63
71
  test/contest.rb
64
72
  test/custom_title_document.html
65
73
  test/custom_title_document.ronn
@@ -95,6 +103,9 @@ Gem::Specification.new do |s|
95
103
  test/section_reference_links.html
96
104
  test/section_reference_links.roff
97
105
  test/section_reference_links.ronn
106
+ test/single_quotes.html
107
+ test/single_quotes.roff
108
+ test/single_quotes.ronn
98
109
  test/tables.ronn
99
110
  test/test_ronn.rb
100
111
  test/test_ronn_document.rb
@@ -103,7 +114,6 @@ Gem::Specification.new do |s|
103
114
  test/titleless_document.ronn
104
115
  test/underline_spacing_test.roff
105
116
  test/underline_spacing_test.ronn
106
- test/url_formatting.ronn
107
117
  ]
108
118
  # = MANIFEST =
109
119
 
@@ -111,16 +121,16 @@ Gem::Specification.new do |s|
111
121
  s.test_files = s.files.select { |path| path =~ /^test\/.*_test.rb/ }
112
122
 
113
123
  s.extra_rdoc_files = %w[LICENSE.txt AUTHORS]
114
- s.add_dependency 'mustache', '~> 0.7', '>= 0.7.0'
115
- s.add_dependency 'nokogiri', '~> 1.9', '>= 1.9.0'
116
- s.add_dependency 'rdiscount', '~> 2.0', '>= 2.0.7'
117
- s.add_development_dependency 'rack', '~> 2.0', '>= 2.0.6'
118
- s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.0'
119
- s.add_development_dependency 'rubocop', '~> 0.60', '>= 0.57.1'
120
- s.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.0'
121
- s.add_development_dependency 'test-unit', '~> 3.2', '>= 3.2.7'
124
+ s.add_dependency 'kramdown', '~> 2.1'
125
+ s.add_dependency 'kramdown-parser-gfm', '~> 1.0.1'
126
+ s.add_dependency 'mustache', '~> 1.0'
127
+ s.add_dependency 'nokogiri', '~> 1.9', '>= 1.9.0'
128
+ s.add_development_dependency 'rack', '~> 2.2', '>= 2.2.3'
129
+ s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
130
+ s.add_development_dependency 'rubocop', '~> 0.88', '>= 0.88.0'
131
+ s.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.8'
132
+ s.add_development_dependency 'test-unit', '~> 3.3', '>= 3.3.6'
122
133
 
123
134
  s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'Ronn']
124
135
  s.require_paths = %w[lib]
125
- s.rubygems_version = '1.1.1'
126
136
  end