Sha256: 04ad8a0bcab61437940230b1b38ddd004ff31a6b85d32b4dfce8d2ba98c6efbc
Contents?: true
Size: 537 Bytes
Versions: 8
Compression:
Stored size: 537 Bytes
Contents
module Lookbook class CodeFormatter < Rouge::Formatters::HTML def initialize(opts = {}) @opts = opts end def stream(tokens, &block) token_lines(tokens).each_with_index do |line_tokens, i| yield "<div class='line'>" yield "<span class='line-number'>#{i}</span>" if @opts[:line_numbers] yield "<span class='line-content'>" line_tokens.each do |token, value| yield span(token, value) end yield "</span>" yield "</div>" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems