nronn 0.10.1.pre2
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 +7 -0
- data/AUTHORS +8 -0
- data/CHANGES +230 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +72 -0
- data/INSTALLING.md +92 -0
- data/LICENSE.txt +12 -0
- data/README.md +131 -0
- data/Rakefile +153 -0
- data/bin/ronn +253 -0
- data/completion/bash/ronn +32 -0
- data/completion/zsh/_ronn +24 -0
- data/config.ru +15 -0
- data/lib/ronn/document.rb +530 -0
- data/lib/ronn/index.rb +180 -0
- data/lib/ronn/roff.rb +393 -0
- data/lib/ronn/server.rb +67 -0
- data/lib/ronn/template/80c.css +6 -0
- data/lib/ronn/template/dark.css +18 -0
- data/lib/ronn/template/darktoc.css +17 -0
- data/lib/ronn/template/default.html +41 -0
- data/lib/ronn/template/man.css +100 -0
- data/lib/ronn/template/print.css +5 -0
- data/lib/ronn/template/screen.css +105 -0
- data/lib/ronn/template/toc.css +27 -0
- data/lib/ronn/template.rb +173 -0
- data/lib/ronn/utils.rb +57 -0
- data/lib/ronn.rb +47 -0
- data/man/index.html +78 -0
- data/man/index.txt +15 -0
- data/man/ronn-format.7 +145 -0
- data/man/ronn-format.7.ronn +157 -0
- data/man/ronn.1 +227 -0
- data/man/ronn.1.ronn +316 -0
- data/nronn.gemspec +136 -0
- data/test/angle_bracket_syntax.html +27 -0
- data/test/angle_bracket_syntax.roff +24 -0
- data/test/angle_bracket_syntax.ronn +22 -0
- data/test/backticks.html +14 -0
- data/test/backticks.ronn +10 -0
- data/test/basic_document.html +8 -0
- data/test/basic_document.ronn +4 -0
- data/test/circumflexes.ronn +1 -0
- data/test/code_blocks.html +38 -0
- data/test/code_blocks.roff +38 -0
- data/test/code_blocks.ronn +41 -0
- data/test/code_blocks_regression +19 -0
- data/test/code_blocks_regression.html +38 -0
- data/test/code_blocks_regression.ronn +40 -0
- data/test/contest.rb +70 -0
- data/test/custom_title_document.html +6 -0
- data/test/custom_title_document.ronn +5 -0
- data/test/definition_list_syntax.html +25 -0
- data/test/definition_list_syntax.roff +19 -0
- data/test/definition_list_syntax.ronn +18 -0
- data/test/dots_at_line_start_test.roff +19 -0
- data/test/dots_at_line_start_test.ronn +12 -0
- data/test/ellipses.roff +7 -0
- data/test/ellipses.ronn +7 -0
- data/test/entity_encoding_test.html +42 -0
- data/test/entity_encoding_test.roff +51 -0
- data/test/entity_encoding_test.ronn +34 -0
- data/test/index.txt +8 -0
- data/test/markdown_syntax.html +954 -0
- data/test/markdown_syntax.roff +907 -0
- data/test/markdown_syntax.ronn +881 -0
- data/test/middle_paragraph.html +14 -0
- data/test/middle_paragraph.roff +9 -0
- data/test/middle_paragraph.ronn +10 -0
- data/test/missing_spaces.roff +7 -0
- data/test/missing_spaces.ronn +2 -0
- data/test/nested_list.ronn +19 -0
- data/test/nested_list_with_code.html +14 -0
- data/test/nested_list_with_code.roff +11 -0
- data/test/nested_list_with_code.ronn +6 -0
- data/test/ordered_list.html +28 -0
- data/test/ordered_list.roff +25 -0
- data/test/ordered_list.ronn +21 -0
- data/test/page.with.periods.in.name.5.ronn +4 -0
- data/test/pre_block_with_quotes.roff +8 -0
- data/test/pre_block_with_quotes.ronn +6 -0
- data/test/section_reference_links.html +16 -0
- data/test/section_reference_links.roff +7 -0
- data/test/section_reference_links.ronn +12 -0
- data/test/single_quotes.html +11 -0
- data/test/single_quotes.roff +5 -0
- data/test/single_quotes.ronn +9 -0
- data/test/tables.ronn +24 -0
- data/test/test_ronn.rb +124 -0
- data/test/test_ronn_document.rb +186 -0
- data/test/test_ronn_index.rb +73 -0
- data/test/titleless_document.html +9 -0
- data/test/titleless_document.ronn +3 -0
- data/test/underline_spacing_test.roff +13 -0
- data/test/underline_spacing_test.ronn +11 -0
- metadata +309 -0
data/Rakefile
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
task default: :test
|
5
|
+
|
6
|
+
ROOTDIR = File.expand_path(__dir__).sub(/#{Dir.pwd}(?=\/)/, '.')
|
7
|
+
LIBDIR = "#{ROOTDIR}/lib".freeze
|
8
|
+
BINDIR = "#{ROOTDIR}/bin".freeze
|
9
|
+
|
10
|
+
task :environment do
|
11
|
+
$LOAD_PATH.unshift ROOTDIR unless $LOAD_PATH.include?(ROOTDIR)
|
12
|
+
$LOAD_PATH.unshift LIBDIR unless $LOAD_PATH.include?(LIBDIR)
|
13
|
+
require_library 'nokogiri'
|
14
|
+
require_library 'kramdown'
|
15
|
+
ENV['RUBYLIB'] = $LOAD_PATH.join(':')
|
16
|
+
ENV['PATH'] = "#{BINDIR}:#{ENV['PATH']}"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Run tests'
|
20
|
+
task test: :environment do
|
21
|
+
$LOAD_PATH.unshift "#{ROOTDIR}/test"
|
22
|
+
Dir['test/test_*.rb'].sort.each { |f| require(f) }
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Start the server'
|
26
|
+
task server: :environment do
|
27
|
+
if system('type shotgun >/dev/null 2>&1')
|
28
|
+
exec 'shotgun config.ru'
|
29
|
+
else
|
30
|
+
require 'ronn/server'
|
31
|
+
Ronn::Server.run('man/*.ronn')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Build the manual'
|
36
|
+
task man: :environment do
|
37
|
+
require 'ronn'
|
38
|
+
ENV['RONN_MANUAL'] = 'Ronn Manual'
|
39
|
+
ENV['RONN_ORGANIZATION'] = "nRonn #{Ronn.revision}"
|
40
|
+
sh 'ronn -w -s toc -r5 --markdown man/*.ronn'
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Publish to GitHub pages'
|
44
|
+
task pages: :man do
|
45
|
+
puts '----------------------------------------------'
|
46
|
+
puts 'Rebuilding pages ...'
|
47
|
+
verbose(false) do
|
48
|
+
rm_rf 'pages'
|
49
|
+
push_url = `git remote show origin`.grep(/Push.*URL/).first[/git@.*/]
|
50
|
+
sh "
|
51
|
+
set -e
|
52
|
+
git fetch -q origin
|
53
|
+
rev=$(git rev-parse origin/gh-pages)
|
54
|
+
git clone -q -b gh-pages . pages
|
55
|
+
cd pages
|
56
|
+
git reset --hard $rev
|
57
|
+
rm -f ronn*.html index.html
|
58
|
+
cp -rp ../man/ronn*.html ../man/index.txt ../man/index.html ./
|
59
|
+
git add -u ronn*.html index.html index.txt
|
60
|
+
git commit -m 'rebuild manual'
|
61
|
+
git push #{push_url} gh-pages
|
62
|
+
", verbose: false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# PACKAGING ============================================================
|
67
|
+
|
68
|
+
# Rev Ronn::VERSION
|
69
|
+
task :rev do
|
70
|
+
rev = ENV['REV'] || `git describe --tags`.chomp
|
71
|
+
data = File.read('lib/ronn.rb')
|
72
|
+
data.gsub!(/^( *)REV *=.*/, "\\1REV = '#{rev}'")
|
73
|
+
File.open('lib/ronn.rb', 'wb') { |fd| fd.write(data) }
|
74
|
+
puts "revision: #{rev}"
|
75
|
+
puts "version: #{`ruby -Ilib -rronn -e 'puts Ronn::VERSION'`}"
|
76
|
+
end
|
77
|
+
|
78
|
+
require 'rubygems'
|
79
|
+
@spec = eval(File.read('nronn.gemspec'))
|
80
|
+
|
81
|
+
def package(ext = '')
|
82
|
+
"pkg/nronn-#{@spec.version}" + ext
|
83
|
+
end
|
84
|
+
|
85
|
+
desc 'Build packages'
|
86
|
+
task package: %w[.gem .tar.gz].map { |ext| package(ext) }
|
87
|
+
|
88
|
+
desc 'Build and install as local gem'
|
89
|
+
task install: package('.gem') do
|
90
|
+
sh "gem install #{package('.gem')}"
|
91
|
+
end
|
92
|
+
|
93
|
+
directory 'pkg/'
|
94
|
+
CLOBBER.include('pkg')
|
95
|
+
|
96
|
+
file package('.gem') => %w[pkg/ nronn.gemspec] + @spec.files do |f|
|
97
|
+
sh 'gem build nronn.gemspec'
|
98
|
+
mv File.basename(f.name), f.name
|
99
|
+
end
|
100
|
+
|
101
|
+
file package('.tar.gz') => %w[pkg/] + @spec.files do |f|
|
102
|
+
sh <<-SH
|
103
|
+
git archive --prefix=ronn-#{source_version}/ --format=tar HEAD |
|
104
|
+
gzip > #{f.name}
|
105
|
+
SH
|
106
|
+
end
|
107
|
+
|
108
|
+
def source_version
|
109
|
+
@source_version ||= `ruby -Ilib -rronn -e 'puts Ronn::VERSION'`.chomp
|
110
|
+
end
|
111
|
+
|
112
|
+
file 'nronn.gemspec' => FileList['{lib,test,bin}/**', 'Rakefile'] do |f|
|
113
|
+
# read spec file and split out manifest section
|
114
|
+
spec = File.read(f.name)
|
115
|
+
head, _manifest, tail = spec.split(" # = MANIFEST =\n")
|
116
|
+
# replace version and date
|
117
|
+
head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
|
118
|
+
head.sub!(/\.date = '.*'/, ".date = '#{Date.today}'")
|
119
|
+
# determine file list from git ls-files
|
120
|
+
files = `git ls-files`
|
121
|
+
.split("\n")
|
122
|
+
.sort
|
123
|
+
.reject { |file| file =~ /^\./ }
|
124
|
+
.reject { |file| file =~ /^doc/ }
|
125
|
+
.map { |file| " #{file}" }
|
126
|
+
.join("\n")
|
127
|
+
# piece file back together and write...
|
128
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
129
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
130
|
+
File.open(f.name, 'w') { |io| io.write(spec) }
|
131
|
+
puts "updated #{f.name}"
|
132
|
+
end
|
133
|
+
|
134
|
+
# Misc ===============================================================
|
135
|
+
|
136
|
+
def require_library(name)
|
137
|
+
require name
|
138
|
+
rescue LoadError => e
|
139
|
+
unless defined?(Gem)
|
140
|
+
warn "warn: #{e}. trying again with rubygems."
|
141
|
+
require 'rubygems'
|
142
|
+
retry
|
143
|
+
end
|
144
|
+
abort "fatal: the '#{name}' library is required (gem install #{name})"
|
145
|
+
end
|
146
|
+
|
147
|
+
# make .wrong test files right
|
148
|
+
task :right do
|
149
|
+
Dir['test/*.wrong'].each do |file|
|
150
|
+
dest = file.sub(/\.wrong$/, '')
|
151
|
+
mv file, dest
|
152
|
+
end
|
153
|
+
end
|
data/bin/ronn
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# / Usage: ronn <options> <file>...
|
3
|
+
# / ronn -m|--man <file>
|
4
|
+
# / ronn -S|--server <file> ...
|
5
|
+
# / ronn --pipe [<file>...]
|
6
|
+
# / Convert ronn source <file>s to roff or HTML manpage. In the first synopsis form,
|
7
|
+
# / build HTML and roff output files based on the input file names.
|
8
|
+
# /
|
9
|
+
# / Mode options alter the default behavior of generating files:
|
10
|
+
# / --pipe write to standard output instead of generating files
|
11
|
+
# / -m, --man show manual like with man(1)
|
12
|
+
# / -S, --server serve <file>s at http://localhost:1207/
|
13
|
+
# / --port <port> run server at specified port instead of 1207
|
14
|
+
# / -o, --output-dir <dir> write generated files to specified directory
|
15
|
+
# /
|
16
|
+
# / Format options control which files / formats are generated:
|
17
|
+
# / -r, --roff generate roff output
|
18
|
+
# / -5, --html generate entire HTML page with layout
|
19
|
+
# / -f, --fragment generate HTML fragment
|
20
|
+
# / --markdown generate post-processed markdown output
|
21
|
+
# /
|
22
|
+
# / Document attributes:
|
23
|
+
# / --date=<date> published date in YYYY-MM-DD format (bottom-center)
|
24
|
+
# / --manual=<name> name of the manual (top-center)
|
25
|
+
# / --name=<name> title of the manual page (top-left, top-right, bottom-right)
|
26
|
+
# / --organization=<name> publishing group or individual (bottom-left)
|
27
|
+
# / --section=<sec> section of the manual page (with name)
|
28
|
+
# /
|
29
|
+
# / Misc options:
|
30
|
+
# / -w, --warnings show troff warnings on stderr
|
31
|
+
# / -W disable previously enabled troff warnings
|
32
|
+
# / --version show ronn version and exit
|
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.
|
37
|
+
# /
|
38
|
+
# / A <file> named example.1.ronn generates example.1.html (HTML manpage)
|
39
|
+
# / and example.1 (roff manpage) by default.
|
40
|
+
require 'date'
|
41
|
+
require 'optparse'
|
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
|
+
|
47
|
+
def usage
|
48
|
+
puts File.readlines(__FILE__)
|
49
|
+
.grep(/^# \/.*/)
|
50
|
+
.map { |line| line.chomp[4..-1] }
|
51
|
+
.join("\n")
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Libraries and LOAD_PATH shenanigans
|
56
|
+
|
57
|
+
begin
|
58
|
+
require 'kramdown'
|
59
|
+
require 'nokogiri'
|
60
|
+
require 'ronn'
|
61
|
+
rescue LoadError => e
|
62
|
+
if e.to_s =~ /ronn/
|
63
|
+
libdir = File.expand_path('../lib', __dir__).sub(%r{^#{Dir.pwd}/}, './')
|
64
|
+
if File.directory?(libdir) && !$LOAD_PATH.include?(libdir)
|
65
|
+
# warn "warn: #{boom}. adding #{libdir} to RUBYLIB ..."
|
66
|
+
$LOAD_PATH.unshift libdir
|
67
|
+
retry
|
68
|
+
end
|
69
|
+
elsif !defined?(Gem)
|
70
|
+
warn "warn: #{e}. loading rubygems ..."
|
71
|
+
require 'rubygems'
|
72
|
+
retry
|
73
|
+
end
|
74
|
+
abort e.to_s
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Argument defaults
|
79
|
+
|
80
|
+
build = true
|
81
|
+
view = false
|
82
|
+
server = false
|
83
|
+
port_arg = nil
|
84
|
+
formats = nil
|
85
|
+
encoding = 'UTF-8'
|
86
|
+
options = {}
|
87
|
+
write_index = false
|
88
|
+
styles = %w[man]
|
89
|
+
groff = 'groff -Wall -mtty-char -mandoc -Tascii -t'
|
90
|
+
pager = ENV['MANPAGER'] || ENV['PAGER'] || 'more -s'
|
91
|
+
output_dir = nil
|
92
|
+
|
93
|
+
##
|
94
|
+
# Environment variables
|
95
|
+
|
96
|
+
%w[manual organization date].each do |attribute|
|
97
|
+
value = ENV["RONN_#{attribute.upcase}"]
|
98
|
+
next if value.nil? || value.empty?
|
99
|
+
|
100
|
+
options[attribute] = value
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Argument parsing
|
105
|
+
|
106
|
+
ARGV.options do |argv|
|
107
|
+
# modes
|
108
|
+
argv.on('--pipe') { build = server = false }
|
109
|
+
argv.on('-b', '--build') { build = true; server = false }
|
110
|
+
argv.on('-m', '--man') { build = server = false; view = true }
|
111
|
+
argv.on('-S', '--server') { build = view = false; server = true }
|
112
|
+
argv.on('-i', '--index') { write_index = true }
|
113
|
+
argv.on('-o', '--output-dir=V') { |val| output_dir = val }
|
114
|
+
argv.on('--port=V') { |val| port_arg = val }
|
115
|
+
|
116
|
+
# format options
|
117
|
+
argv.on('-r', '--roff') { (formats ||= []) << 'roff' }
|
118
|
+
argv.on('-5', '--html') { (formats ||= []) << 'html' }
|
119
|
+
argv.on('-f', '--fragment') { (formats ||= []) << 'html_fragment' }
|
120
|
+
argv.on('--markdown') { (formats ||= []) << 'markdown' }
|
121
|
+
argv.on('--yaml') { (formats ||= []) << 'yaml' }
|
122
|
+
argv.on('-E', '--encoding=V') { |val| encoding = val }
|
123
|
+
|
124
|
+
# html output options
|
125
|
+
argv.on('-s', '--style=V') { |val| styles += val.split(/[, \n]+/) }
|
126
|
+
|
127
|
+
# manual attribute options
|
128
|
+
%w[name section manual organization date].each do |attribute|
|
129
|
+
argv.on("--#{attribute}=VALUE") { |val| options[attribute] = val }
|
130
|
+
end
|
131
|
+
|
132
|
+
# misc
|
133
|
+
argv.on('-w', '--warnings') { groff += ' -ww' }
|
134
|
+
argv.on('-W') { groff += ' -Ww' }
|
135
|
+
argv.on('-v', '--version') do
|
136
|
+
require 'ronn'
|
137
|
+
if Ronn.release?
|
138
|
+
printf "nRonn v%s\n", Ronn::VERSION
|
139
|
+
else
|
140
|
+
printf "nRonn v%s (%s)\n", Ronn::VERSION, Ronn::REV
|
141
|
+
end
|
142
|
+
printf "https://github.com/n-ronn/nronn/tree/%s\n", Ronn.revision
|
143
|
+
exit 0
|
144
|
+
end
|
145
|
+
argv.on_tail('--help') { usage; exit 0 }
|
146
|
+
argv.parse!
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Modes, Formats, Options
|
151
|
+
|
152
|
+
if ARGV.empty? && $stdin.tty?
|
153
|
+
usage
|
154
|
+
exit 2
|
155
|
+
elsif ARGV.empty? && !server
|
156
|
+
ARGV.push '-'
|
157
|
+
build = false
|
158
|
+
formats ||= %w[roff]
|
159
|
+
elsif view
|
160
|
+
formats ||= %w[roff]
|
161
|
+
elsif build
|
162
|
+
formats ||= %w[roff html]
|
163
|
+
end
|
164
|
+
formats ||= []
|
165
|
+
formats.delete('html') if formats.include?('html_fragment')
|
166
|
+
|
167
|
+
options['date'] &&= Date.strptime(options['date'], '%Y-%m-%d')
|
168
|
+
options['styles'] = styles
|
169
|
+
options['outdir'] = output_dir
|
170
|
+
options['encoding'] = encoding
|
171
|
+
|
172
|
+
unless port_arg.nil?
|
173
|
+
begin
|
174
|
+
options['port'] = Integer(port_arg)
|
175
|
+
rescue ArgumentError
|
176
|
+
warn "Error: invalid port number: '#{port_arg}'"
|
177
|
+
exit 1
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# Server
|
183
|
+
|
184
|
+
if server
|
185
|
+
require 'ronn/server'
|
186
|
+
Ronn::Server.run(ARGV, options)
|
187
|
+
exit 0
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Build Pipeline
|
192
|
+
|
193
|
+
pid = nil
|
194
|
+
wr = $stdout
|
195
|
+
documents = ARGV.map { |file| Ronn::Document.new(file, options) }
|
196
|
+
documents.each do |doc|
|
197
|
+
# setup the man pipeline if the --man option was specified
|
198
|
+
if view && !build
|
199
|
+
rd, wr = IO.pipe
|
200
|
+
pid = fork
|
201
|
+
if pid
|
202
|
+
rd.close
|
203
|
+
else
|
204
|
+
wr.close
|
205
|
+
$stdin.reopen rd
|
206
|
+
exec "#{groff} | #{pager}"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# write output for each format
|
211
|
+
formats.each do |fmt|
|
212
|
+
if build
|
213
|
+
path = doc.path_for(fmt)
|
214
|
+
case fmt
|
215
|
+
when 'html'
|
216
|
+
warn format('%9s: %-43s%15s', fmt, path, '+' + doc.styles.join(','))
|
217
|
+
when 'roff', 'html_fragment', 'markdown'
|
218
|
+
warn format('%9s: %-43s', fmt, path)
|
219
|
+
end
|
220
|
+
|
221
|
+
output = doc.convert(fmt)
|
222
|
+
File.open(path, 'wb') { |f| f.puts(output) }
|
223
|
+
|
224
|
+
if fmt == 'roff'
|
225
|
+
if view
|
226
|
+
system "man #{path}"
|
227
|
+
else
|
228
|
+
system "#{groff} <#{path} >/dev/null"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else
|
232
|
+
output = doc.convert(fmt)
|
233
|
+
wr.puts(output)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# wait for children to exit
|
238
|
+
if pid
|
239
|
+
wr.close
|
240
|
+
Process.wait
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Write index.txt files
|
245
|
+
|
246
|
+
if write_index
|
247
|
+
indexes = documents.map(&:index).uniq
|
248
|
+
indexes.each do |index|
|
249
|
+
File.open(index.path, 'wb') do |fd|
|
250
|
+
fd.puts(index.to_text)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Bash completion script for ronn(1) from nRonn
|
2
|
+
|
3
|
+
_ronn()
|
4
|
+
{
|
5
|
+
local cur prev words cword
|
6
|
+
_init_completion -n = || return
|
7
|
+
|
8
|
+
COMREPLY=()
|
9
|
+
cur=${COMP_WORDS[COMP_CWORD]}
|
10
|
+
|
11
|
+
case "$prev" in
|
12
|
+
--help|--version|-!(-*)'?')
|
13
|
+
return
|
14
|
+
;;
|
15
|
+
-o|--output-dir|-!(-*)e)
|
16
|
+
_filedir -d
|
17
|
+
return
|
18
|
+
;;
|
19
|
+
esac
|
20
|
+
|
21
|
+
if [[ "$cur" == -* ]]; then
|
22
|
+
COMREPLY=( $( compgen -W '--pipe -m --man -S --server --port -o --output-dir -r --roff -5 --html -f --fragment --markdown --date --manual --organization -w --warnings -W --version --help'))
|
23
|
+
return
|
24
|
+
fi
|
25
|
+
|
26
|
+
_filedir
|
27
|
+
|
28
|
+
return 0
|
29
|
+
} &&
|
30
|
+
complete -F _ronn ronn
|
31
|
+
|
32
|
+
# ex: filetype=sh
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#compdef ronn
|
2
|
+
|
3
|
+
# Zsh completion definitions for ronn, from nRonn
|
4
|
+
|
5
|
+
_arguments -C -s -S \
|
6
|
+
'(--pipe)--pipe[write to standard output instead of generating files]' \
|
7
|
+
'(-m --man)'{-m,--man}'[show manual like with man]' \
|
8
|
+
'(-S --server)'{-S,--server}'[serve <file>s at http://localhost:1207/]' \
|
9
|
+
'(--port)--port[run server at specified port instead of 1207]:Port Number' \
|
10
|
+
'(-o --output-dir)'{-o,--output-dir}'[write generated files to specified directory]:Output Directory:_dirs' \
|
11
|
+
'(-r --roff)'{-r,--roff}'[generate roff output]' \
|
12
|
+
'(-5 --html)'{-5,--html}'[generate entire HTML page with layout]' \
|
13
|
+
'(-f --fragment)'{-f,--fragment}'[generate HTML fragment]' \
|
14
|
+
'(--markdown)--markdown[generate post-processed markdown output]' \
|
15
|
+
'(--date)--date[published date in YYYY-MM-DD format]:Date' \
|
16
|
+
'(--manual)--manual[name of the manual]:Manual Name' \
|
17
|
+
'(--organization)--organization[publishing group or individual]:Organization Name' \
|
18
|
+
'(-w --warnings)'{-w,--warnings}'[show troff warnings on stderr]' \
|
19
|
+
'(-W)-W[disable previously enabled troff warnings]' \
|
20
|
+
'(--version)--version[show ronn version and exit]' \
|
21
|
+
'(--help)--help[show help message and exit]' \
|
22
|
+
'*:input files:_files' \
|
23
|
+
&& ret=0
|
24
|
+
|
data/config.ru
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#\ -p 1207
|
2
|
+
$LOAD_PATH << File.expand_path('lib', __dir__)
|
3
|
+
|
4
|
+
require 'ronn'
|
5
|
+
require 'ronn/server'
|
6
|
+
|
7
|
+
# use Rack::Lint
|
8
|
+
|
9
|
+
options = {
|
10
|
+
styles: %w[man toc],
|
11
|
+
organization: "Ronn v#{Ronn::VERSION}"
|
12
|
+
}
|
13
|
+
files = Dir['man/*.ronn'] + Dir['test/*.ronn']
|
14
|
+
|
15
|
+
run Ronn::Server.new(files, options)
|