motion-kramdown 0.6.0 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +6 -2
  3. data/lib/kramdown.rb +1 -1
  4. data/lib/kramdown/converter.rb +10 -11
  5. data/lib/kramdown/converter/base.rb +19 -12
  6. data/lib/kramdown/converter/hash_ast.rb +38 -0
  7. data/lib/kramdown/converter/html.rb +71 -39
  8. data/lib/kramdown/converter/kramdown.rb +19 -10
  9. data/lib/kramdown/converter/latex.rb +28 -10
  10. data/lib/kramdown/converter/man.rb +303 -0
  11. data/lib/kramdown/converter/math_engine/itex2mml.rb +2 -2
  12. data/lib/kramdown/converter/math_engine/mathjax.rb +13 -3
  13. data/lib/kramdown/converter/math_engine/mathjaxnode.rb +56 -0
  14. data/lib/kramdown/converter/math_engine/ritex.rb +2 -2
  15. data/lib/kramdown/converter/math_engine/sskatex.rb +97 -0
  16. data/lib/kramdown/converter/pdf.rb +6 -6
  17. data/lib/kramdown/converter/remove_html_tags.rb +5 -3
  18. data/lib/kramdown/converter/syntax_highlighter.rb +5 -2
  19. data/lib/kramdown/converter/syntax_highlighter/coderay.rb +8 -5
  20. data/lib/kramdown/converter/syntax_highlighter/minted.rb +35 -0
  21. data/lib/kramdown/converter/syntax_highlighter/rouge.rb +48 -10
  22. data/lib/kramdown/converter/toc.rb +2 -2
  23. data/lib/kramdown/document.rb +16 -19
  24. data/lib/kramdown/element.rb +5 -1
  25. data/lib/kramdown/error.rb +1 -1
  26. data/lib/kramdown/options.rb +103 -7
  27. data/lib/kramdown/parser.rb +1 -1
  28. data/lib/kramdown/parser/base.rb +12 -18
  29. data/lib/kramdown/parser/gfm.rb +142 -11
  30. data/lib/kramdown/parser/html.rb +28 -18
  31. data/lib/kramdown/parser/kramdown.rb +45 -36
  32. data/lib/kramdown/parser/kramdown/abbreviation.rb +1 -1
  33. data/lib/kramdown/parser/kramdown/autolink.rb +2 -8
  34. data/lib/kramdown/parser/kramdown/blank_line.rb +2 -2
  35. data/lib/kramdown/parser/kramdown/block_boundary.rb +4 -4
  36. data/lib/kramdown/parser/kramdown/blockquote.rb +4 -4
  37. data/lib/kramdown/parser/kramdown/codeblock.rb +11 -8
  38. data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
  39. data/lib/kramdown/parser/kramdown/emphasis.rb +2 -2
  40. data/lib/kramdown/parser/kramdown/eob.rb +1 -1
  41. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  42. data/lib/kramdown/parser/kramdown/extensions.rb +6 -3
  43. data/lib/kramdown/parser/kramdown/footnote.rb +4 -5
  44. data/lib/kramdown/parser/kramdown/header.rb +2 -2
  45. data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
  46. data/lib/kramdown/parser/kramdown/html.rb +8 -8
  47. data/lib/kramdown/parser/kramdown/html_entity.rb +2 -2
  48. data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
  49. data/lib/kramdown/parser/kramdown/link.rb +5 -4
  50. data/lib/kramdown/parser/kramdown/list.rb +17 -10
  51. data/lib/kramdown/parser/kramdown/math.rb +2 -2
  52. data/lib/kramdown/parser/kramdown/paragraph.rb +19 -8
  53. data/lib/kramdown/parser/kramdown/smart_quotes.rb +3 -3
  54. data/lib/kramdown/parser/kramdown/table.rb +10 -12
  55. data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
  56. data/lib/kramdown/parser/markdown.rb +2 -2
  57. data/lib/kramdown/utils.rb +2 -1
  58. data/lib/kramdown/utils/configurable.rb +2 -2
  59. data/lib/kramdown/utils/entities.rb +1 -1
  60. data/lib/kramdown/utils/html.rb +2 -2
  61. data/lib/kramdown/utils/lru_cache.rb +40 -0
  62. data/lib/kramdown/utils/ordered_hash.rb +2 -71
  63. data/lib/kramdown/utils/string_scanner.rb +2 -2
  64. data/lib/kramdown/utils/unidecoder.rb +2 -2
  65. data/lib/kramdown/version.rb +2 -2
  66. data/lib/rubymotion/require_override.rb +9 -0
  67. data/lib/rubymotion/version.rb +1 -1
  68. data/spec/{helpers → motion-kramdown/_helpers}/it_behaves_like.rb +0 -0
  69. data/spec/{helpers → motion-kramdown/_helpers}/option_file.rb +2 -2
  70. data/spec/{helpers → motion-kramdown/_helpers}/tidy.rb +0 -0
  71. data/spec/motion-kramdown/bench_mark.rb +37 -0
  72. data/spec/{document_tree.rb → motion-kramdown/document_tree.rb} +11 -1
  73. data/spec/{gfm_to_html.rb → motion-kramdown/gfm_to_html.rb} +51 -18
  74. data/spec/{html_to_html.rb → motion-kramdown/html_to_html.rb} +27 -9
  75. data/spec/{html_to_kramdown_to_html.rb → motion-kramdown/html_to_kramdown_to_html.rb} +35 -16
  76. data/spec/motion-kramdown/kramdown_to_xxx.rb +75 -0
  77. data/spec/{test_location.rb → motion-kramdown/test_location.rb} +0 -0
  78. data/spec/{test_string_scanner_kramdown.rb → motion-kramdown/test_string_scanner_kramdown.rb} +0 -0
  79. data/spec/motion-kramdown/text_manpage.rb +11 -0
  80. data/spec/{text_to_kramdown_to_html.rb → motion-kramdown/text_to_kramdown_to_html.rb} +30 -19
  81. data/spec/{text_to_latex.rb → motion-kramdown/text_to_latex.rb} +0 -0
  82. data/spec/{helpers/spec_options.rb → spec_helper.rb} +13 -2
  83. metadata +54 -33
  84. data/lib/kramdown/compatibility.rb +0 -36
  85. data/spec/bench_mark.rb +0 -43
  86. data/spec/kramdown_to_xxx.rb +0 -42
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -13,7 +13,7 @@ module Kramdown::Converter::MathEngine
13
13
  module Ritex
14
14
 
15
15
  begin
16
- # RM require 'ritex'
16
+ require 'ritex'
17
17
 
18
18
  # Ritex is available if this constant is +true+.
19
19
  AVAILABLE = true
@@ -0,0 +1,97 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2017 Christian Cornelssen <ccorn@1tein.de>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+
9
+ module Kramdown::Converter::MathEngine
10
+
11
+ # Consider this a lightweight alternative to MathjaxNode. Uses KaTeX and ExecJS (via ::SsKaTeX)
12
+ # instead of MathJax and Node.js. Javascript execution context initialization is done only once.
13
+ # As a result, the performance is reasonable.
14
+ module SsKaTeX
15
+
16
+ # Indicate whether SsKaTeX may be available.
17
+ #
18
+ # This test is incomplete; it cannot test the existence of _katex_js_ nor the availability of a
19
+ # specific _js_run_ because those depend on configuration not given here. This test mainly
20
+ # indicates whether static dependencies such as the +sskatex+ and +execjs+ gems are available.
21
+ AVAILABLE = begin
22
+ require 'sskatex'
23
+ # No test for any JS engine availability here; specifics are config-dependent anyway
24
+ true
25
+ rescue LoadError
26
+ false
27
+ end
28
+
29
+ if AVAILABLE
30
+
31
+ # Class-level cache for ::SsKaTeX converter state, queried by configuration. Note: KTXC
32
+ # contents may become stale if the contents of used JS files change while the configuration
33
+ # remains unchanged.
34
+ KTXC = ::Kramdown::Utils::LRUCache.new(10)
35
+
36
+ # A logger that routes messages to the debug channel only. No need to create this dynamically.
37
+ DEBUG_LOGGER = lambda { |level, &expr| warn(expr.call) }
38
+
39
+ class << self
40
+ private
41
+
42
+ # Given a Kramdown::Converter::Base object _converter_, retrieves the logging options and
43
+ # builds an object usable for ::SsKaTeX#logger. The result is either +nil+ (no logging) or a
44
+ # +Proc+ object which, when given a _level_ (either +:verbose+ or +:debug+) and a block,
45
+ # decides whether logging is enabled, and if so, evaluates the given block for the message
46
+ # and routes that message to the appropriate channels. With <tt>level == :verbose+</tt>,
47
+ # messages are passed to _converter_.warning if the _converter_'s +:verbose+ option is set.
48
+ # All messages are passed to +warn+ if the _converter_'s +:debug+ option is set.
49
+ #
50
+ # Note that the returned logger may contain references to the given _converter_ and is not
51
+ # affected by subsequent changes in the _converter_'s logging options.
52
+ def logger(converter)
53
+ config = converter.options[:math_engine_opts]
54
+ debug = config[:debug]
55
+ if config[:verbose]
56
+ # Need a closure
57
+ lambda do |level, &expr|
58
+ verbose = (level == :verbose)
59
+ msg = expr.call if debug || verbose
60
+ warn(msg) if debug
61
+ converter.warning(msg) if verbose
62
+ end
63
+ elsif debug
64
+ DEBUG_LOGGER
65
+ end
66
+ end
67
+
68
+ # Given a Kramdown::Converter::Base object _converter_, return a ::SsKaTeX converter _sktx_
69
+ # that has been configured with _converter_'s +math_engine_opts+, but not for logging. Cache
70
+ # _sktx_ for reuse, without references to _converter_.
71
+ def katex_conv(converter)
72
+ config = converter.options[:math_engine_opts]
73
+ # Could .reject { |key, _| [:verbose, :debug].include?(key.to_sym) }
74
+ # because the JS engine setup can be reused for different logging settings.
75
+ # But then the +math_engine_opts+ dict would be essentially dup'ed every time,
76
+ # and late activation of logging would miss the initialization if the engine is reused.
77
+ KTXC[config] ||= ::SsKaTeX.new(config)
78
+ end
79
+
80
+ public
81
+
82
+ # The function used by kramdown for rendering TeX math to HTML
83
+ def call(converter, el, opts)
84
+ display_mode = el.options[:category]
85
+ ans = katex_conv(converter).call(el.value, display_mode == :block, &logger(converter))
86
+ attr = el.attr.dup
87
+ attr.delete('xmlns')
88
+ attr.delete('display')
89
+ ans.insert(ans =~ /[[:space:]>]/, converter.html_attributes(attr))
90
+ ans = ' ' * opts[:indent] << ans << "\n" if display_mode == :block
91
+ ans
92
+ end
93
+
94
+ end
95
+ end
96
+ end
97
+ end
@@ -1,17 +1,17 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
8
8
  #
9
9
 
10
- # RM require 'prawn'
11
- # RM require 'prawn/table'
12
- # RM require 'kramdown/converter'
13
- # RM require 'kramdown/utils'
14
- # RM require 'open-uri'
10
+ require 'prawn'
11
+ require 'prawn/table'
12
+ require 'kramdown/converter'
13
+ require 'kramdown/utils'
14
+ require 'open-uri'
15
15
 
16
16
  module Kramdown
17
17
 
@@ -1,13 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
8
8
  #
9
9
 
10
- # RM require 'kramdown/converter'
10
+ require 'kramdown/converter'
11
11
 
12
12
  module Kramdown
13
13
 
@@ -30,6 +30,8 @@ module Kramdown
30
30
  end
31
31
 
32
32
  def convert(el)
33
+ real_el, el = el, el.value if el.type == :footnote
34
+
33
35
  children = el.children.dup
34
36
  index = 0
35
37
  while index < children.length
@@ -46,7 +48,7 @@ module Kramdown
46
48
  end
47
49
  end
48
50
  el.children = children
49
- el
51
+ real_el || el
50
52
  end
51
53
 
52
54
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -46,8 +46,11 @@ module Kramdown
46
46
  # :block type text correctly wrapped (i.e. normally inside a pre-tag, but may
47
47
  # also be a table-tag or just a div-tag) but :span type text *without* a
48
48
  # code-tag!
49
+ #
50
+ # Also, a syntax highlighter should store the default highlighting language for
51
+ # the invocation in the +opts+ hash under the key :default_lang.
49
52
  module SyntaxHighlighter
50
53
  end
51
54
 
52
55
  end
53
- end
56
+ end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -13,7 +13,7 @@ module Kramdown::Converter::SyntaxHighlighter
13
13
  module Coderay
14
14
 
15
15
  begin
16
- # RM require 'coderay'
16
+ require 'coderay'
17
17
 
18
18
  # Highlighting via coderay is available if this constant is +true+.
19
19
  # RM AVAILABLE = true
@@ -21,17 +21,20 @@ module Kramdown::Converter::SyntaxHighlighter
21
21
  AVAILABLE = false # :nodoc:
22
22
  end
23
23
 
24
- def self.call(converter, text, lang, type, _unused_opts)
24
+ def self.call(converter, text, lang, type, call_opts)
25
25
  return nil unless converter.options[:enable_coderay]
26
26
 
27
27
  if type == :span && lang
28
28
  ::CodeRay.scan(text, lang.to_sym).html(options(converter, :span)).chomp
29
29
  elsif type == :block && (lang || options(converter, :default_lang))
30
- lang = (lang || options(converter, :default_lang)).to_sym
31
- ::CodeRay.scan(text, lang).html(options(converter, :block)).chomp << "\n"
30
+ lang ||= call_opts[:default_lang] = options(converter, :default_lang)
31
+ ::CodeRay.scan(text, lang.to_s.gsub(/-/, '_').to_sym).html(options(converter, :block)).chomp << "\n"
32
32
  else
33
33
  nil
34
34
  end
35
+ rescue
36
+ converter.warning("There was an error using CodeRay: #{$!.message}")
37
+ nil
35
38
  end
36
39
 
37
40
  def self.options(converter, type)
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+
10
+ module Kramdown::Converter::SyntaxHighlighter
11
+
12
+ # Uses Minted to highlight code blocks and code spans.
13
+ module Minted
14
+
15
+ def self.call(converter, text, lang, type, _opts)
16
+ opts = converter.options[:syntax_highlighter_opts]
17
+
18
+ # Fallback to default language
19
+ lang ||= opts[:default_lang]
20
+
21
+ options = []
22
+ options << "breaklines" if opts[:wrap]
23
+ options << "linenos" if opts[:line_numbers]
24
+ options << "frame=#{opts[:frame]}" if opts[:frame]
25
+
26
+ if lang && type == :block
27
+ "\\begin{minted}[#{options.join(',')}]{#{lang}}\n#{text}\n\\end{minted}"
28
+ elsif lang && type == :span
29
+ "\\mintinline{#{lang}}{#{text}}"
30
+ else
31
+ nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -13,23 +13,61 @@ module Kramdown::Converter::SyntaxHighlighter
13
13
  module Rouge
14
14
 
15
15
  begin
16
- # RM require 'rouge'
16
+ require 'rouge'
17
17
 
18
18
  # Highlighting via Rouge is available if this constant is +true+.
19
- # RM AVAILABLE = true
20
- # RM rescue LoadError, SyntaxError
19
+ AVAILABLE = false # RM
20
+ rescue LoadError, SyntaxError
21
21
  AVAILABLE = false # :nodoc:
22
22
  end
23
23
 
24
- def self.call(converter, text, lang, type, _unused_opts)
25
- opts = converter.options[:syntax_highlighter_opts].dup
24
+ def self.call(converter, text, lang, type, call_opts)
25
+ opts = options(converter, type)
26
+ call_opts[:default_lang] = opts[:default_lang]
26
27
  lexer = ::Rouge::Lexer.find_fancy(lang || opts[:default_lang], text)
27
- return nil unless lexer
28
+ return nil if opts[:disable] || !lexer
29
+ opts[:css_class] ||= 'highlight' # For backward compatibility when using Rouge 2.0
30
+ formatter = formatter_class(opts).new(opts)
31
+ formatter.format(lexer.lex(text))
32
+ end
28
33
 
29
- opts[:wrap] = false if type == :span
34
+ def self.options(converter, type)
35
+ prepare_options(converter)
36
+ converter.data[:syntax_highlighter_rouge][type]
37
+ end
30
38
 
31
- formatter = (opts.delete(:formatter) || ::Rouge::Formatters::HTML).new(opts)
32
- formatter.format(lexer.lex(text))
39
+ def self.prepare_options(converter)
40
+ return if converter.data.key?(:syntax_highlighter_rouge)
41
+
42
+ cache = converter.data[:syntax_highlighter_rouge] = {}
43
+
44
+ opts = converter.options[:syntax_highlighter_opts].dup
45
+ span_opts = (opts.delete(:span) || {}).dup
46
+ block_opts = (opts.delete(:block) || {}).dup
47
+ [span_opts, block_opts].each do |hash|
48
+ hash.keys.each do |k|
49
+ hash[k.kind_of?(String) ? Kramdown::Options.str_to_sym(k) : k] = hash.delete(k)
50
+ end
51
+ end
52
+
53
+ cache[:span] = opts.merge(span_opts).update(:wrap => false)
54
+ cache[:block] = opts.merge(block_opts)
55
+ end
56
+
57
+
58
+ def self.formatter_class(opts = {})
59
+ case formatter = opts[:formatter]
60
+ when Class
61
+ formatter
62
+ when /\A[[:upper:]][[:alnum:]_]*\z/
63
+ ::Rouge::Formatters.const_get(formatter)
64
+ else
65
+ # Available in Rouge 2.0 or later
66
+ ::Rouge::Formatters::HTMLLegacy
67
+ end
68
+ rescue NameError
69
+ # Fallback to Rouge 1.x
70
+ ::Rouge::Formatters::HTML
33
71
  end
34
72
 
35
73
  end
@@ -1,13 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
8
8
  #
9
9
 
10
- # RM require 'kramdown/converter'
10
+ require 'kramdown/converter'
11
11
 
12
12
  module Kramdown
13
13
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -29,31 +29,28 @@
29
29
  #
30
30
  # Kramdown::Document.new(text).to_html
31
31
  #
32
- # For detailed information have a look at the Kramdown::Document class.
32
+ # For detailed information have a look at the *\Kramdown::Document* class.
33
33
  #
34
34
  # == License
35
35
  #
36
36
  # MIT - see the COPYING file.
37
37
 
38
-
39
- # RM require 'kramdown/compatibility'
40
- #
41
- # RM require 'kramdown/version'
42
- # RM require 'kramdown/element'
43
- # RM require 'kramdown/error'
44
- # RM require 'kramdown/parser'
45
- # RM require 'kramdown/converter'
46
- # RM require 'kramdown/options'
47
- # RM require 'kramdown/utils'
38
+ require 'kramdown/version'
39
+ require 'kramdown/element'
40
+ require 'kramdown/error'
41
+ require 'kramdown/parser'
42
+ require 'kramdown/converter'
43
+ require 'kramdown/options'
44
+ require 'kramdown/utils'
48
45
 
49
46
  module Kramdown
50
47
 
51
48
  # Return the data directory for kramdown.
52
49
  def self.data_dir
53
50
  unless defined?(@@data_dir)
54
- # RM require 'rbconfig'
51
+ require 'rbconfig'
55
52
  @@data_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'data', 'kramdown'))
56
- @@data_dir = File.expand_path(File.join(Config::CONFIG["datadir"], "kramdown")) if !File.exists?(@@data_dir)
53
+ @@data_dir = File.expand_path(File.join(RbConfig::CONFIG["datadir"], "kramdown")) if !File.exist?(@@data_dir)
57
54
  raise "kramdown data directory not found! This is a bug, please report it!" unless File.directory?(@@data_dir)
58
55
  end
59
56
  @@data_dir
@@ -100,13 +97,13 @@ module Kramdown
100
97
  # immediately available and the output can be generated.
101
98
  def initialize(source, options = {})
102
99
  @options = Options.merge(options).freeze
103
- parser = (options[:input] || 'kramdown').to_s
100
+ parser = (@options[:input] || 'kramdown').to_s
104
101
  parser = parser[0..0].upcase + parser[1..-1]
105
102
  try_require('parser', parser)
106
103
  if Parser.const_defined?(parser)
107
104
  @root, @warnings = Parser.const_get(parser).parse(source, @options)
108
105
  else
109
- raise Kramdown::Error.new("kramdown has no parser to handle the specified input format: #{options[:input]}")
106
+ raise Kramdown::Error.new("kramdown has no parser to handle the specified input format: #{@options[:input]}")
110
107
  end
111
108
  end
112
109
 
@@ -131,9 +128,9 @@ module Kramdown
131
128
 
132
129
  # Try requiring a parser or converter class and don't raise an error if the file is not found.
133
130
  def try_require(type, name)
134
- # RM require("kramdown/#{type}/#{Utils.snake_case(name)}")
135
- # RM true
136
- # RM rescue LoadError
131
+ require("kramdown/#{type}/#{Utils.snake_case(name)}")
132
+ true
133
+ rescue LoadError
137
134
  true
138
135
  end
139
136
  protected :try_require