lib/kramdown/converter/kramdown.rb in kramdown-1.11.1 vs lib/kramdown/converter/kramdown.rb in kramdown-1.12.0

- old
+ new

@@ -29,11 +29,11 @@ @stack = [] end def convert(el, opts = {:indent => 0}) res = send("convert_#{el.type}", el, opts) - if ![:html_element, :li, :dd, :td].include?(el.type) && (ial = ial_for_element(el)) + if ![:html_element, :li, :dt, :dd, :td].include?(el.type) && (ial = ial_for_element(el)) res << ial res << "\n\n" if Element.category(el) == :block elsif [:ul, :dl, :ol, :codeblock].include?(el.type) && opts[:next] && ([el.type, :codeblock].include?(opts[:next].type) || (opts[:next].type == :blank && opts[:nnext] && [el.type, :codeblock].include?(opts[:nnext].type))) @@ -172,11 +172,15 @@ "#{sym}#{text}" end end def convert_dt(el, opts) - inner(el, opts) << "\n" + result = '' + if ial = ial_for_element(el) + result << ial << " " + end + result << inner(el, opts) << "\n" end HTML_TAGS_WITH_BODY=['div', 'script', 'iframe', 'textarea'] def convert_html_element(el, opts) @@ -412,9 +416,13 @@ end.compact.join('') res = "toc" << (res.strip.empty? ? '' : " #{res}") if (el.type == :ul || el.type == :ol) && (el.options[:ial][:refs].include?('toc') rescue nil) res = "footnotes" << (res.strip.empty? ? '' : " #{res}") if (el.type == :ul || el.type == :ol) && (el.options[:ial][:refs].include?('footnotes') rescue nil) + if el.type == :dl && el.options[:ial] && el.options[:ial][:refs] + auto_ids = el.options[:ial][:refs].select {|ref| ref =~ /\Aauto_ids/}.join(" ") + res = auto_ids << (res.strip.empty? ? '' : " #{res}") unless auto_ids.empty? + end res.strip.empty? ? nil : "{:#{res}}" end def parse_title(attr) attr.to_s.empty? ? '' : ' "' + attr.gsub(/"/, '&quot;') + '"'