Sha256: f4a3c2473981230d8d70d03e2076f6f92f972508b626beb7f831b4adde153454
Contents?: true
Size: 706 Bytes
Versions: 1
Compression:
Stored size: 706 Bytes
Contents
module Rouge # A Formatter takes a token stream and formats it for human viewing. class Formatter REGISTRY = {} # Specify or get the unique tag for this formatter. This is used # for specifying a formatter in `rougify`. def self.tag(tag=nil) return @tag unless tag REGISTRY[tag] = self @tag = tag end # Find a formatter class given a unique tag. def self.find(tag) REGISTRY[tag] end # Format a token stream. def render(tokens) enum_for(:stream, tokens).to_a.join end # @abstract # yield strings that, when concatenated, form the formatted output def stream(tokens, &b) raise 'abstract' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rouge-0.2.1 | lib/rouge/formatter.rb |