lib/slideshow/markup/textile.rb in slideshow-2.2.0 vs lib/slideshow/markup/textile.rb in slideshow-2.3.0
- old
+ new
@@ -22,10 +22,27 @@
buf
end
- def textile_to_html( content )
+ def setup_textile_engine
+ return if @textile_engine_setup
+ logger.debug 'require redcloth -- load textile library'
+ require 'redcloth' # default textile library
+ @textile_engine_setup = true
+ rescue LoadError
+ puts "You're missing a library required for Textile to Hypertext conversion. Please run:"
+ puts " $ gem install RedCloth"
+ # check: raise exception instead of exit e.g
+ # raise FatalException.new( 'Missing library dependency: RedCloth' )
+ exit 1
+ end
+
+
+ def textile_to_html( content )
+
+ setup_textile_engine() # optinal lib; extra; load only textile lib if used (soft dependency)
+
puts " Converting Textile-text (#{content.length} bytes) to HTML..."
# JRuby workaround for RedCloth 4 multi-byte character bug
# see http://jgarber.lighthouseapp.com/projects/13054/tickets/149-redcloth-4-doesnt-support-multi-bytes-content
# basically convert non-ascii chars (>127) to html entities
\ No newline at end of file