lib/markdown/config.rb in markdown-0.2.0.beta1 vs lib/markdown/config.rb in markdown-0.2.0

- old
+ new

@@ -28,37 +28,42 @@ '.mkdn', '.md', '.mdown', '.markdn', '.txt', - '.text' ] # todo: check - add .wiki??? ext - } + '.text' ], # todo: check - add .wiki??? ext + 'redcarpet' => { + 'extensions' => [ + 'no_intra_emphasis', + 'fenced_code_blocks', + 'tables', + 'strikethrough' ] # todo/fix: merge nested hash?? + }, + } def initialize @props = @props_default = Props.new( DEFAULTS, 'DEFAULTS' ) # check for user settings (markdown.yml) in home folder - ## todo/fix: use join path??? ## todo: use .markdown.yml?? or differnt name ?? - props_home_file = "#{Env.home}/markdown.yml" + props_home_file = File.join( Env.home, 'markdown.yml' ) if File.exists?( props_home_file ) puts "Loading settings from '#{props_home_file}'..." @props = @props_home = Props.load_file( props_home_file, @props ) end # check for user settings (markdown.yml) in working folder - props_work_file = "./markdown.yml" + props_work_file = File.join( '.', 'markdown.yml' ) if File.exists?( props_work_file ) puts "Loading settings from '#{props_work_file}'..." @props = @props_work = Props.load_file( props_work_file, @props ) end @libs = [] - @mn = nil # markdown converter method name (mn) e.g. kramdown_to_html require_markdown_libs() end def markdown_extnames @@ -103,14 +108,18 @@ ## todo: use logger.debug instead of puts puts "Markdown library #{lib} not found. Use gem install #{lib} to install." end end - puts " Found #{@libs.length} Markdown libraries: #{@libs.join(', ')}" + puts " Found #{@libs.length} Markdown #{(@libs.length == 1) ? 'library' : 'libraries'}: #{@libs.join(', ')}" end def markdown_lib @libs.first + end + + def markdown_lib_defaults + opts = @props.fetch( @libs.first, {} ) end def markdown_to_html_method lib = @libs.first opts = @props.fetch( lib, {} ) \ No newline at end of file