Debian Codegraph @

bin/rdiscount

raw symbols SCIP
1 #!/usr/bin/env ruby
2 #
3 # Usage: [env RDISCOUNT_EXTENSIONS='<extension>,...'] rdiscount [<file>...]
4 # no <file> or when <file> is '-', read Markdown source text from standard input.
5 #
6 # Convert one or more Markdown files to HTML and write to standard output.
7 # With no <file> or when <file> is '-', read Markdown source text from
8 # standard input. Optionally, the RDISCOUNT_EXTENSIONS environment variable
9 # can specify a comma-separated list of extensions to enable in RDiscount.
10 #
11 if ARGV.include?('--help')
12 File.read(__FILE__).split("\n").grep(/^# /).each do |line|
13 puts line[2..-1]
14 end
15 exit 0
16 end
17
18 require 'rdiscount'
19 extensions = ENV['RDISCOUNT_EXTENSIONS'].to_s.split(',').map{ |key| key.to_sym }
20 STDOUT.write(RDiscount.new(ARGF.read, *extensions).to_html)