Class: Bunto::Converters::Markdown::RDiscountParser
- Inherits:
-
Object
- Object
- Bunto::Converters::Markdown::RDiscountParser
- Defined in:
- lib/bunto/converters/markdown/rdiscount_parser.rb
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config) ⇒ RDiscountParser
constructor
A new instance of RDiscountParser.
Constructor Details
#initialize(config) ⇒ RDiscountParser
Returns a new instance of RDiscountParser.
5 6 7 8 9 |
# File 'lib/bunto/converters/markdown/rdiscount_parser.rb', line 5 def initialize(config) Bunto::External.require_with_graceful_fail "rdiscount" @config = config @rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym) end |
Instance Method Details
#convert(content) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/bunto/converters/markdown/rdiscount_parser.rb', line 11 def convert(content) rd = RDiscount.new(content, *@rdiscount_extensions) html = rd.to_html if @config["rdiscount"]["toc_token"] html = replace_generated_toc(rd, html, @config["rdiscount"]["toc_token"]) end html end |