Sha256: 835e55cc98f33d15f73b3e2b6a042521de51a3422a63a3a16e958362c79d94db

Contents?: true

Size: 908 Bytes

Versions: 7

Compression:

Stored size: 908 Bytes

Contents

require 'rubygems'
require 'rdoc/markup/to_html'
module WLang
  class EncoderSet
    
    # Provides the rdoc encoder
    module RDocEncoders
  
      # Default encoders  
      DEFAULT_ENCODERS = {"html" => :rdoc_encoding, "div" => :rdoc_encoding, "nop" => :nop_encoding}
  
      # RDoc encoding
      def self.rdoc_encoding(src, options); 
        encoder = RDoc::Markup::ToHtml.new
        if options['_template_'] and options['_template_'].source_file
          encoder.instance_eval do
            @from_path = File.dirname(options['_template_'].source_file)
          end
        end
        encoder.convert(src) 
      end
  
      # RDoc encoding, removing enclosing <tt><p>...</p></tt>
      def self.nop_encoding(src, options); 
        rdoc = RDoc::Markup::ToHtml.new.convert(src)
        rdoc = $1 if /^\s*<p>\s*(.*?)\s+<\/p>\s*$/m =~ rdoc
        rdoc
      end
  
    end # RDoc
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wlang-0.10.2 lib/wlang/dialects/rdoc_dialect.rb
wlang-0.10.1 ./lib/wlang/dialects/rdoc_dialect.rb
wlang-0.10.0 lib/wlang/dialects/rdoc_dialect.rb
wlang-0.9.2 lib/wlang/dialects/rdoc_dialect.rb
wlang-0.8.5 lib/wlang/dialects/rdoc_dialect.rb
wlang-0.8.4 lib/wlang/dialects/rdoc_dialect.rb
wlang-0.9.1 lib/wlang/dialects/rdoc_dialect.rb