ronn-ng 0.8.1.beta.1 → 0.10.0.pre.SNAPSHOT
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +29 -2
- data/INSTALLING.md +2 -2
- data/LICENSE.txt +1 -1
- data/README.md +2 -3
- data/Rakefile +4 -4
- data/bin/ronn +23 -11
- data/lib/ronn.rb +3 -8
- data/lib/ronn/document.rb +23 -12
- data/lib/ronn/index.rb +2 -4
- data/lib/ronn/roff.rb +14 -8
- data/lib/ronn/template.rb +1 -0
- data/man/ronn-format.7 +4 -4
- data/man/ronn.1 +9 -5
- data/man/ronn.1.ronn +10 -7
- data/ronn-ng.gemspec +13 -13
- data/test/angle_bracket_syntax.html +11 -1
- data/test/angle_bracket_syntax.ronn +10 -0
- data/test/{code_blocks.7.ronn → code_blocks.ronn} +0 -0
- data/test/definition_list_syntax.html +2 -2
- data/test/definition_list_syntax.roff +1 -1
- data/test/dots_at_line_start_test.roff +3 -3
- data/test/ellipses.roff +2 -2
- data/test/entity_encoding_test.html +20 -12
- data/test/entity_encoding_test.roff +26 -15
- data/test/entity_encoding_test.ronn +9 -0
- data/test/markdown_syntax.html +8 -10
- data/test/markdown_syntax.roff +49 -49
- data/test/middle_paragraph.roff +1 -1
- data/test/missing_spaces.roff +1 -1
- data/test/nested_list_with_code.html +6 -7
- data/test/nested_list_with_code.roff +4 -4
- data/test/ordered_list.html +8 -10
- data/test/ordered_list.roff +1 -1
- data/test/pre_block_with_quotes.roff +1 -1
- data/test/section_reference_links.roff +2 -2
- data/test/test_ronn.rb +1 -1
- data/test/underline_spacing_test.roff +1 -1
- metadata +60 -59
- data/test/url_formatting.ronn +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42d3c988ea961f9b89073f5534e6c0fc721c2f951e0a3d4e14f74987bab263db
|
4
|
+
data.tar.gz: ef7745fc686d7ba4de2bfa94f9071e05a675a18389a064cf651970976ba09e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a065288a7f12e64f33c1c5fea974a1954e21b0ea56b96f934fbad5f1570ee5b71716d10feb9b28cf9cd894ef4a185054889fa1c698f249595b1e8abbc8f24f9
|
7
|
+
data.tar.gz: '0338fdc307af4380e99127bd9e137c53e6ea7c9ddb7e719616667602de4fd7cae856c7099a3b9053cdc02c4083b10feae666f87e40688016782433f8663d1cc8'
|
data/CHANGES
CHANGED
@@ -1,8 +1,35 @@
|
|
1
1
|
Ronn-NG CHANGES
|
2
2
|
===============
|
3
3
|
|
4
|
-
Version 0.
|
5
|
-
|
4
|
+
Version 0.10.0 (2020 Oct 22)
|
5
|
+
----------------------------
|
6
|
+
|
7
|
+
* Switch to GitHub Flavored Markdown, fixing code block rendering (<https://github.com/apjanke/ronn-ng/pull/53>)
|
8
|
+
* Revert `\[ci]` back to `\(bu)` (<https://github.com/apjanke/ronn-ng/pull/51>)
|
9
|
+
* Minor fix to single-quote escaping (<https://github.com/apjanke/ronn-ng/issues/55>)
|
10
|
+
* Bump to mustache 1.x
|
11
|
+
|
12
|
+
Version 0.9.1 (2020 Apr 09)
|
13
|
+
---------------------------
|
14
|
+
|
15
|
+
* Fix underlining issue (<https://github.com/apjanke/ronn-ng/pull/41>)
|
16
|
+
|
17
|
+
Version 0.9.0 (2019 Dec 21)
|
18
|
+
---------------------------
|
19
|
+
|
20
|
+
* Migrate to kramdown for the underlying Markdown library
|
21
|
+
* Minor output formatting and documentation improvements
|
22
|
+
|
23
|
+
Version 0.8.2 (2019 Mar 5)
|
24
|
+
--------------------------
|
25
|
+
|
26
|
+
* Fixes packaging error in 0.8.1
|
27
|
+
|
28
|
+
Version 0.8.1 (2019 Mar 5)
|
29
|
+
--------------------------
|
30
|
+
|
31
|
+
* Fixed URL hyphenation bug. (<https://github.com/apjanke/ronn-ng/issues/23>) (apjanke)
|
32
|
+
* Fixed ordered-list bustication. (<https://github.com/apjanke/ronn-ng/issues/24>) (apjanke)
|
6
33
|
|
7
34
|
Version 0.8.0 (2018 Dec 25)
|
8
35
|
---------------------------
|
data/INSTALLING.md
CHANGED
@@ -68,7 +68,7 @@ PATH=$(pwd)/ronn-ng/bin:$PATH
|
|
68
68
|
The following gems are required for ronn-ng development:
|
69
69
|
* nokogiri
|
70
70
|
* mustache
|
71
|
-
*
|
71
|
+
* kramdown
|
72
72
|
* rubocop
|
73
73
|
* sinatra
|
74
74
|
* rack
|
@@ -76,7 +76,7 @@ The following gems are required for ronn-ng development:
|
|
76
76
|
* test-unit
|
77
77
|
|
78
78
|
```
|
79
|
-
gem install nokogiri mustache
|
79
|
+
gem install nokogiri mustache kramdown rubocop sinatra rack rake test-unit
|
80
80
|
```
|
81
81
|
|
82
82
|
Or install them with bundler using the project's gem definition:
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
3
|
Copyright (C) 2009 Ryan Tomayko <tomayko.com/about>
|
4
|
-
Copyright (C) 2018 Andrew Janke <apjanke.net>
|
4
|
+
Copyright (C) 2018, 2019 Andrew Janke <apjanke.net>
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
7
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ronn-NG
|
2
2
|
|
3
|
-
Ronn-NG is a new, currently-maintained fork of the defunct [original Ronn
|
3
|
+
Ronn-NG is a new, currently-maintained fork of the defunct [original Ronn
|
4
4
|
project](https://github.com/rtomayko/ronn).
|
5
5
|
|
6
6
|
Ronn builds manuals. It converts simple, human readable textfiles to roff for
|
@@ -127,8 +127,7 @@ MIT License.
|
|
127
127
|
|
128
128
|
Ronn is Copyright (C) 2010 [Ryan Tomayko](http://tomayko.com/about).
|
129
129
|
|
130
|
-
New Ronn-NG material is Copyright (
|
131
|
-
and other contributors.
|
130
|
+
New Ronn-NG material is Copyright (C) 2018, 2019 [Andrew Janke](https://apjanke.net).
|
132
131
|
|
133
132
|
See the file LICENSE.txt for information of licensing and distribution.
|
134
133
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ task :environment do
|
|
11
11
|
$LOAD_PATH.unshift ROOTDIR unless $LOAD_PATH.include?(ROOTDIR)
|
12
12
|
$LOAD_PATH.unshift LIBDIR unless $LOAD_PATH.include?(LIBDIR)
|
13
13
|
require_library 'nokogiri'
|
14
|
-
require_library '
|
14
|
+
require_library 'kramdown'
|
15
15
|
ENV['RUBYLIB'] = $LOAD_PATH.join(':')
|
16
16
|
ENV['PATH'] = "#{BINDIR}:#{ENV['PATH']}"
|
17
17
|
end
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
desc 'Run tests'
|
20
20
|
task test: :environment do
|
21
21
|
$LOAD_PATH.unshift "#{ROOTDIR}/test"
|
22
|
-
Dir['test/test_*.rb'].each { |f| require(f) }
|
22
|
+
Dir['test/test_*.rb'].sort.each { |f| require(f) }
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'Start the server'
|
@@ -135,9 +135,9 @@ end
|
|
135
135
|
|
136
136
|
def require_library(name)
|
137
137
|
require name
|
138
|
-
rescue LoadError =>
|
138
|
+
rescue LoadError => e
|
139
139
|
unless defined?(Gem)
|
140
|
-
warn "warn: #{
|
140
|
+
warn "warn: #{e}. trying again with rubygems."
|
141
141
|
require 'rubygems'
|
142
142
|
retry
|
143
143
|
end
|
data/bin/ronn
CHANGED
@@ -22,19 +22,28 @@
|
|
22
22
|
# / Document attributes:
|
23
23
|
# / --date=<date> published date in YYYY-MM-DD format (bottom-center)
|
24
24
|
# / --manual=<name> name of the manual (top-center)
|
25
|
+
# / --name=<name> title of the manual page (top-left, top-right, bottom-right)
|
25
26
|
# / --organization=<name> publishing group or individual (bottom-left)
|
27
|
+
# / --section=<sec> section of the manual page (with name)
|
26
28
|
# /
|
27
29
|
# / Misc options:
|
28
30
|
# / -w, --warnings show troff warnings on stderr
|
29
31
|
# / -W disable previously enabled troff warnings
|
30
32
|
# / --version show ronn version and exit
|
31
33
|
# / --help show this help message
|
34
|
+
# / -E <encoding> specify the encoding files are in (default is UTF-8)
|
35
|
+
# / Note: this only affects files. Data passed in to ronn's STDIN
|
36
|
+
# / must be in UTF-8 regardless of the -E setting.
|
32
37
|
# /
|
33
38
|
# / A <file> named example.1.ronn generates example.1.html (HTML manpage)
|
34
39
|
# / and example.1 (roff manpage) by default.
|
35
40
|
require 'date'
|
36
41
|
require 'optparse'
|
37
42
|
|
43
|
+
# Ronn wants its inputs to be in UTF-8, regardless of the user's
|
44
|
+
# locale settings or Ruby version.
|
45
|
+
Encoding.default_external = Encoding::UTF_8
|
46
|
+
|
38
47
|
def usage
|
39
48
|
puts File.readlines(__FILE__)
|
40
49
|
.grep(/^# \/.*/)
|
@@ -46,11 +55,11 @@ end
|
|
46
55
|
# Libraries and LOAD_PATH shenanigans
|
47
56
|
|
48
57
|
begin
|
49
|
-
require '
|
58
|
+
require 'kramdown'
|
50
59
|
require 'nokogiri'
|
51
60
|
require 'ronn'
|
52
|
-
rescue LoadError =>
|
53
|
-
if
|
61
|
+
rescue LoadError => e
|
62
|
+
if e.to_s =~ /ronn/
|
54
63
|
libdir = File.expand_path('../lib', __dir__).sub(%r{^#{Dir.pwd}/}, './')
|
55
64
|
if File.directory?(libdir) && !$LOAD_PATH.include?(libdir)
|
56
65
|
# warn "warn: #{boom}. adding #{libdir} to RUBYLIB ..."
|
@@ -58,11 +67,11 @@ rescue LoadError => boom
|
|
58
67
|
retry
|
59
68
|
end
|
60
69
|
elsif !defined?(Gem)
|
61
|
-
warn "warn: #{
|
70
|
+
warn "warn: #{e}. loading rubygems ..."
|
62
71
|
require 'rubygems'
|
63
72
|
retry
|
64
73
|
end
|
65
|
-
abort
|
74
|
+
abort e.to_s
|
66
75
|
end
|
67
76
|
|
68
77
|
##
|
@@ -73,11 +82,12 @@ view = false
|
|
73
82
|
server = false
|
74
83
|
port_arg = nil
|
75
84
|
formats = nil
|
85
|
+
encoding = 'UTF-8'
|
76
86
|
options = {}
|
77
87
|
write_index = false
|
78
|
-
styles
|
79
|
-
groff
|
80
|
-
pager
|
88
|
+
styles = %w[man]
|
89
|
+
groff = 'groff -Wall -mtty-char -mandoc -Tascii -t'
|
90
|
+
pager = ENV['MANPAGER'] || ENV['PAGER'] || 'more -is'
|
81
91
|
output_dir = nil
|
82
92
|
|
83
93
|
##
|
@@ -109,9 +119,10 @@ ARGV.options do |argv|
|
|
109
119
|
argv.on('-f', '--fragment') { (formats ||= []) << 'html_fragment' }
|
110
120
|
argv.on('--markdown') { (formats ||= []) << 'markdown' }
|
111
121
|
argv.on('--yaml') { (formats ||= []) << 'yaml' }
|
122
|
+
argv.on('-E', '--encoding=V') { |val| encoding = val }
|
112
123
|
|
113
124
|
# html output options
|
114
|
-
argv.on('-s', '--style=V')
|
125
|
+
argv.on('-s', '--style=V') { |val| styles += val.split(/[, \n]+/) }
|
115
126
|
|
116
127
|
# manual attribute options
|
117
128
|
%w[name section manual organization date].each do |attribute|
|
@@ -156,6 +167,7 @@ formats.delete('html') if formats.include?('html_fragment')
|
|
156
167
|
options['date'] &&= Date.strptime(options['date'], '%Y-%m-%d')
|
157
168
|
options['styles'] = styles
|
158
169
|
options['outdir'] = output_dir
|
170
|
+
options['encoding'] = encoding
|
159
171
|
|
160
172
|
unless port_arg.nil?
|
161
173
|
begin
|
@@ -179,7 +191,7 @@ end
|
|
179
191
|
# Build Pipeline
|
180
192
|
|
181
193
|
pid = nil
|
182
|
-
wr =
|
194
|
+
wr = $stdout
|
183
195
|
documents = ARGV.map { |file| Ronn::Document.new(file, options) }
|
184
196
|
documents.each do |doc|
|
185
197
|
# setup the man pipeline if the --man option was specified
|
@@ -190,7 +202,7 @@ documents.each do |doc|
|
|
190
202
|
rd.close
|
191
203
|
else
|
192
204
|
wr.close
|
193
|
-
|
205
|
+
$stdin.reopen rd
|
194
206
|
exec "#{groff} | #{pager}"
|
195
207
|
end
|
196
208
|
end
|
data/lib/ronn.rb
CHANGED
@@ -15,13 +15,11 @@ module Ronn
|
|
15
15
|
Document.new(filename, attributes, &block)
|
16
16
|
end
|
17
17
|
|
18
|
-
# truthy when this a release (\d
|
18
|
+
# truthy when this a release (\d\.\d\.\d) version.
|
19
19
|
def self.release?
|
20
20
|
revision != '' && !revision.include?('-')
|
21
21
|
end
|
22
22
|
|
23
|
-
# version: 0.6.11
|
24
|
-
#
|
25
23
|
# A semantic version number based on the git revision. The third element
|
26
24
|
# of the version is incremented by the commit offset, such that version
|
27
25
|
# 0.6.6-5-gdacd74b => 0.6.11
|
@@ -31,11 +29,8 @@ module Ronn
|
|
31
29
|
ver.join('.')
|
32
30
|
end
|
33
31
|
|
34
|
-
# revision: 0.6.6-5-gdacd74b
|
35
|
-
# revision: 0.6.25
|
36
|
-
#
|
37
32
|
# The string revision as reported by: git-describe --tags. This is just the
|
38
|
-
# tag name when a tag references the HEAD commit (0.6.25). When the HEAD
|
33
|
+
# tag name when a tag references the HEAD commit (e.g. 0.6.25). When the HEAD
|
39
34
|
# commit is not tagged, this is a "<tag>-<offset>-<sha1>" string:
|
40
35
|
# <tag> - closest tag name
|
41
36
|
# <offset> - number of commits ahead of <tag>
|
@@ -47,6 +42,6 @@ module Ronn
|
|
47
42
|
# value generated by: rake rev
|
48
43
|
# or edit manually; I'm not sure of how rake rev interacts with git
|
49
44
|
# tags -apjanke
|
50
|
-
REV = '0.
|
45
|
+
REV = '0.10.0-SNAPSHOT'.freeze
|
51
46
|
VERSION = version
|
52
47
|
end
|
data/lib/ronn/document.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'cgi'
|
3
3
|
require 'nokogiri'
|
4
|
-
require '
|
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
|
-
|
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
|
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 =
|
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(
|
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(
|
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
|
data/lib/ronn/index.rb
CHANGED
@@ -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
|
data/lib/ronn/roff.rb
CHANGED
@@ -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
|
-
|
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', ['"
|
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
|
@@ -277,13 +281,13 @@ module Ronn
|
|
277
281
|
inline_filter(node.children)
|
278
282
|
elsif node.has_attribute?('data-bare-link')
|
279
283
|
write '\fI'
|
280
|
-
|
284
|
+
inline_filter(node.children)
|
281
285
|
write '\fR'
|
282
286
|
else
|
283
287
|
inline_filter(node.children)
|
284
288
|
write ' '
|
285
289
|
write '\fI'
|
286
|
-
write
|
290
|
+
write escape(node.attributes['href'].content)
|
287
291
|
write '\fR'
|
288
292
|
end
|
289
293
|
|
@@ -312,7 +316,7 @@ module Ronn
|
|
312
316
|
end
|
313
317
|
|
314
318
|
HTML_ROFF_ENTITIES = {
|
315
|
-
'•' => '\
|
319
|
+
'•' => '\(bu',
|
316
320
|
'<' => '<',
|
317
321
|
'>' => '>',
|
318
322
|
' ' => '\~', # That's a literal non-breaking space character there
|
@@ -335,7 +339,7 @@ module Ronn
|
|
335
339
|
text.gsub!(/&#(\d+);/) { $1.to_i.chr } # dec entities
|
336
340
|
text.gsub!('\\', '\e') # backslash
|
337
341
|
text.gsub!('...', '\|.\|.\|.') # ellipses
|
338
|
-
text.gsub!(/[
|
342
|
+
text.gsub!(/[.-]/) { |m| "\\#{m}" } # control chars
|
339
343
|
ent.each do |key, val|
|
340
344
|
text.gsub!(key, val)
|
341
345
|
end
|
@@ -350,10 +354,12 @@ module Ronn
|
|
350
354
|
# write text to output buffer
|
351
355
|
def write(text)
|
352
356
|
return if text.nil? || text.empty?
|
353
|
-
# lines cannot start with a '.'. insert zero-width character before.
|
354
|
-
text = text.gsub(/\n
|
357
|
+
# lines cannot start with a '.' or "'". insert zero-width character before.
|
358
|
+
text = text.gsub(/\n\\\./, "\n\\\\&\\.")
|
359
|
+
text = text.gsub(/\n'/, "\n\\&\\'")
|
355
360
|
buf_ends_in_newline = @buf.last && @buf.last[-1] == "\n"
|
356
361
|
@buf << '\&' if text[0, 2] == '\.' && buf_ends_in_newline
|
362
|
+
@buf << '\&' if text[0, 1] == "'" && buf_ends_in_newline
|
357
363
|
@buf << text
|
358
364
|
end
|
359
365
|
|