Sha256: 1b4cb45b172c7c3dd3d7468cbef36ea0983b7808442fb1e7430d7f5d2320275a

Contents?: true

Size: 430 Bytes

Versions: 4

Compression:

Stored size: 430 Bytes

Contents

require 'wikitext'

##
# This allows a us to create a wrapper object similar to those provided by the
# Markdown and Textile libraries. It stores the original and formated HTML text
# in instance variables.
# 
class WikitextString < String
  attr_reader :text
  attr_reader :html
  
  def initialize(str)
    super(str)
    @text = str.to_s
    @html = Wikitext::Parser.new.parse(@text)
  end
  
  def to_html
    @html
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vigetlabs-acts_as_markup-0.3.0 lib/acts_as_markup/exts/wikitext.rb
vigetlabs-acts_as_markup-0.4.0 lib/acts_as_markup/exts/wikitext.rb
acts_as_markup-0.3.0 lib/acts_as_markup/exts/wikitext.rb
acts_as_markup-0.4.0 lib/acts_as_markup/exts/wikitext.rb