class CS50::NextTag

Public Class Methods

new(tag_name, text, tokens) click to toggle source
Calls superclass method
# File lib/jekyll-theme-cs50.rb, line 35
def initialize(tag_name, text, tokens)
  super
  @text = (text.length > 0) ? CGI.escapeHTML(text.strip().gsub(/\A"|"\Z/, "").gsub(/\A"|"\Z/, "")) : "Next"
end

Public Instance Methods

render(context) click to toggle source
# File lib/jekyll-theme-cs50.rb, line 40
    def render(context)
      site = context.registers[:site]
      converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
      button = Sanitize.fragment(converter.convert(@text), :elements => ["b", "code", "em", "i", "img", "span", "strong", "sub", "sup"])
      <<~EOT
        <button class="btn btn-dark btn-sm" data-next type="button">#{button}</button>
      EOT
    end