lib/kramdown/converter/latex.rb in kramdown-1.0.2 vs lib/kramdown/converter/latex.rb in kramdown-1.1.0

- old
+ new

@@ -143,14 +143,14 @@ def convert_dd(el, opts) "#{latex_link_target(el)}#{inner(el, opts)}\n\n" end def convert_html_element(el, opts) - if el.value == 'i' + if el.value == 'i' || el.value == 'em' "\\emph{#{inner(el, opts)}}" - elsif el.value == 'b' - "\\emph{#{inner(el, opts)}}" + elsif el.value == 'b' || el.value == 'strong' + "\\textbf{#{inner(el, opts)}}" else warning("Can't convert HTML element") '' end end @@ -543,10 +543,16 @@ "$#{el.value}$" end end def convert_abbreviation(el, opts) - el.value + @data[:packages] += %w[acronym] + "\\ac{#{normalize_abbreviation_key(el.value)}}" + end + + # Normalize the abbreviation key so that it only contains allowed ASCII character + def normalize_abbreviation_key(key) + key.gsub(/\W/) {|m| m.unpack('H*').first} end # Wrap the +text+ inside a LaTeX environment of type +type+. The element +el+ is passed on to # the method #attribute_list -- the resulting string is appended to both the \\begin and the # \\end lines of the LaTeX environment for easier post-processing of LaTeX environments.