/usr/lib/ruby/vendor_ruby/redcarpet/render_strip.rb is in ruby-redcarpet 3.3.4-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | module Redcarpet
module Render
# Markdown-stripping renderer. Turns Markdown into plaintext
# Thanks to @toupeira (Markus Koller)
class StripDown < Base
# Methods where the first argument is the text content
[
# block-level calls
:block_code, :block_quote,
:block_html, :list, :list_item,
# span-level calls
:autolink, :codespan, :double_emphasis,
:emphasis, :underline, :raw_html,
:triple_emphasis, :strikethrough,
:superscript, :highlight,
# footnotes
:footnotes, :footnote_def, :footnote_ref,
# low level rendering
:entity, :normal_text
].each do |method|
define_method method do |*args|
args.first
end
end
# Other methods where we don't return only a specific argument
def link(link, title, content)
"#{content} (#{link})"
end
def image(link, title, content)
content &&= content + " "
"#{content}#{link}"
end
def paragraph(text)
text + "\n"
end
def header(text, header_level)
text + "\n"
end
def table(header, body)
"#{header}#{body}"
end
def table_row(content)
content + "\n"
end
def table_cell(content, alignment)
content + "\t"
end
end
end
end
|