lib/markdown/config.rb in markdown-1.0.0 vs lib/markdown/config.rb in markdown-1.1.0
- old
+ new
@@ -108,13 +108,11 @@
else
[ user_lib ] # return as array (wrap single lib entry)
end
end
-
def require_markdown_libs
-
# check for available markdown libs/gems
# try to require each lib and remove any not installed
known_markdown_libs.each do |lib|
begin
@@ -123,9 +121,28 @@
rescue LoadError => ex
## todo: use logger.debug instead of puts
puts "Markdown library #{lib} not found. Use gem install #{lib} to install."
end
end
+ end
+
+ def markdown_lib=( lib )
+
+ # fix/todo: check if @libs.first == lib => do nothing; return
+
+ # check if value exists in libs array
+ # if yes put it into first position
+ # otherwise issue warning/error - better throw exception; engine not found
+
+ # try to delete
+ obj = @libs.delete( lib )
+ if obj.nil? # nothing deleted; no obj found
+ # try to require; will raise load error exception if not found; know what your're doing! no fallback; sorry; better fail fast
+ require lib
+ end
+
+ # add it back; make it first entry
+ @libs.unshift( lib )
end
def markdown_lib
@libs.first
end
\ No newline at end of file