Sha256: 44cf4a1b719eb644ba51a1fc3fb67be219a6eed668824d7e286c9d4fa8ef5405

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module Kitabu
  module Helpers
    def lexers_list
      buffer = [%[<ul class="lexers">]]

      Rouge::Lexers.constants.each do |const|
        lexer = Rouge::Lexers.const_get(const)

        begin
          title = lexer.title
          tag = lexer.tag
          description = lexer.desc
        rescue StandardError
          next
        end

        buffer << "<li>"
        buffer << "<strong>#{title}</strong> "
        buffer << "<code>#{tag}</code><br>"
        buffer << "<span>#{description}</span>"
        buffer << "</li>"
      end

      buffer << "</ul>"
      buffer.join
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitabu-3.1.0 templates/helper.rb
kitabu-3.0.3 templates/helper.rb
kitabu-3.0.2 templates/helper.rb
kitabu-3.0.1 templates/helper.rb
kitabu-3.0.0 templates/helper.rb