kramdown 1.17.0 → 2.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kramdown might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/CONTRIBUTERS +4 -2
 - data/VERSION +1 -1
 - data/bin/kramdown +13 -14
 - data/lib/kramdown.rb +2 -2
 - data/lib/kramdown/converter.rb +6 -7
 - data/lib/kramdown/converter/base.rb +18 -29
 - data/lib/kramdown/converter/hash_ast.rb +4 -4
 - data/lib/kramdown/converter/html.rb +82 -67
 - data/lib/kramdown/converter/kramdown.rb +83 -78
 - data/lib/kramdown/converter/latex.rb +53 -47
 - data/lib/kramdown/converter/man.rb +22 -25
 - data/lib/kramdown/converter/math_engine/mathjax.rb +10 -10
 - data/lib/kramdown/converter/remove_html_tags.rb +2 -2
 - data/lib/kramdown/converter/syntax_highlighter.rb +2 -2
 - data/lib/kramdown/converter/syntax_highlighter/minted.rb +2 -2
 - data/lib/kramdown/converter/syntax_highlighter/rouge.rb +5 -5
 - data/lib/kramdown/converter/toc.rb +5 -5
 - data/lib/kramdown/document.rb +9 -11
 - data/lib/kramdown/element.rb +11 -9
 - data/lib/kramdown/error.rb +2 -2
 - data/lib/kramdown/options.rb +258 -384
 - data/lib/kramdown/parser.rb +2 -3
 - data/lib/kramdown/parser/base.rb +7 -6
 - data/lib/kramdown/parser/html.rb +103 -95
 - data/lib/kramdown/parser/kramdown.rb +32 -36
 - data/lib/kramdown/parser/kramdown/abbreviation.rb +13 -10
 - data/lib/kramdown/parser/kramdown/autolink.rb +3 -3
 - data/lib/kramdown/parser/kramdown/blank_line.rb +2 -2
 - data/lib/kramdown/parser/kramdown/block_boundary.rb +2 -2
 - data/lib/kramdown/parser/kramdown/blockquote.rb +4 -5
 - data/lib/kramdown/parser/kramdown/codeblock.rb +4 -5
 - data/lib/kramdown/parser/kramdown/codespan.rb +5 -5
 - data/lib/kramdown/parser/kramdown/emphasis.rb +6 -6
 - data/lib/kramdown/parser/kramdown/eob.rb +2 -2
 - data/lib/kramdown/parser/kramdown/escaped_chars.rb +2 -2
 - data/lib/kramdown/parser/kramdown/extensions.rb +31 -26
 - data/lib/kramdown/parser/kramdown/footnote.rb +7 -6
 - data/lib/kramdown/parser/kramdown/header.rb +6 -6
 - data/lib/kramdown/parser/kramdown/horizontal_rule.rb +3 -3
 - data/lib/kramdown/parser/kramdown/html.rb +31 -26
 - data/lib/kramdown/parser/kramdown/html_entity.rb +6 -5
 - data/lib/kramdown/parser/kramdown/line_break.rb +3 -3
 - data/lib/kramdown/parser/kramdown/link.rb +13 -11
 - data/lib/kramdown/parser/kramdown/list.rb +38 -40
 - data/lib/kramdown/parser/kramdown/math.rb +4 -5
 - data/lib/kramdown/parser/kramdown/paragraph.rb +5 -5
 - data/lib/kramdown/parser/kramdown/smart_quotes.rb +23 -23
 - data/lib/kramdown/parser/kramdown/table.rb +18 -17
 - data/lib/kramdown/parser/kramdown/typographic_symbol.rb +8 -8
 - data/lib/kramdown/parser/markdown.rb +9 -8
 - data/lib/kramdown/utils.rb +5 -6
 - data/lib/kramdown/utils/configurable.rb +7 -6
 - data/lib/kramdown/utils/entities.rb +286 -289
 - data/lib/kramdown/utils/html.rb +10 -12
 - data/lib/kramdown/utils/lru_cache.rb +3 -2
 - data/lib/kramdown/utils/string_scanner.rb +2 -3
 - data/lib/kramdown/utils/unidecoder.rb +8 -6
 - data/lib/kramdown/version.rb +3 -3
 - data/man/man1/kramdown.1 +3 -107
 - data/test/run_tests.rb +6 -6
 - data/test/test_files.rb +122 -298
 - data/test/test_location.rb +8 -30
 - data/test/test_string_scanner_kramdown.rb +6 -9
 - data/test/testcases/block/06_codeblock/highlighting-opts.html +6 -6
 - data/test/testcases/block/06_codeblock/highlighting.html +5 -6
 - data/test/testcases/block/06_codeblock/with_lang_in_fenced_block.options +1 -1
 - data/test/testcases/block/07_horizontal_rule/error.html +2 -2
 - data/test/testcases/block/09_html/html5_attributes.html +2 -0
 - data/test/testcases/block/09_html/html5_attributes.text +2 -0
 - data/test/testcases/block/09_html/html_to_native/typography.html +1 -1
 - data/test/testcases/block/09_html/simple.html +1 -1
 - data/test/testcases/block/12_extension/options3.html +7 -6
 - data/test/testcases/block/12_extension/options3.text +2 -2
 - data/test/testcases/span/01_link/inline.html +1 -1
 - data/test/testcases/span/01_link/reference.html +3 -3
 - data/test/testcases/span/03_codespan/highlighting.html +1 -1
 - data/test/testcases/span/text_substitutions/entities_as_char.html +1 -1
 - metadata +5 -234
 - data/Rakefile +0 -341
 - data/benchmark/benchmark.rb +0 -43
 - data/benchmark/benchmark.sh +0 -74
 - data/benchmark/generate_data.rb +0 -119
 - data/benchmark/mdbasics.text +0 -306
 - data/benchmark/mdsyntax.text +0 -888
 - data/benchmark/testing.sh +0 -12
 - data/benchmark/timing.sh +0 -10
 - data/doc/_design.scss +0 -441
 - data/doc/bg.png +0 -0
 - data/doc/default.scss +0 -217
 - data/doc/default.template +0 -62
 - data/doc/documentation.page +0 -84
 - data/doc/documentation.template +0 -36
 - data/doc/index.page +0 -113
 - data/doc/installation.page +0 -88
 - data/doc/links.markdown +0 -6
 - data/doc/metainfo +0 -13
 - data/doc/news.feed +0 -9
 - data/doc/news.page +0 -29
 - data/doc/options.page +0 -49
 - data/doc/quickref.page +0 -603
 - data/doc/sidebar.template +0 -22
 - data/doc/sitemap.sitemap +0 -5
 - data/doc/syntax.page +0 -1799
 - data/doc/tests.page +0 -104
 - data/doc/virtual +0 -14
 - data/lib/kramdown/converter/math_engine/itex2mml.rb +0 -39
 - data/lib/kramdown/converter/math_engine/katex.rb +0 -35
 - data/lib/kramdown/converter/math_engine/mathjaxnode.rb +0 -56
 - data/lib/kramdown/converter/math_engine/ritex.rb +0 -38
 - data/lib/kramdown/converter/math_engine/sskatex.rb +0 -97
 - data/lib/kramdown/converter/pdf.rb +0 -625
 - data/lib/kramdown/converter/syntax_highlighter/coderay.rb +0 -81
 - data/lib/kramdown/parser/gfm.rb +0 -188
 - data/lib/kramdown/utils/ordered_hash.rb +0 -18
 - data/setup.rb +0 -1585
 - data/test/testcases/block/07_horizontal_rule/error.html.19 +0 -7
 - data/test/testcases/block/09_html/html_to_native/typography.html.19 +0 -1
 - data/test/testcases/block/09_html/simple.html.19 +0 -60
 - data/test/testcases/block/15_math/itex2mml.html +0 -1
 - data/test/testcases/block/15_math/itex2mml.options +0 -1
 - data/test/testcases/block/15_math/itex2mml.text +0 -1
 - data/test/testcases/block/15_math/katex.html.19 +0 -2
 - data/test/testcases/block/15_math/katex.options +0 -1
 - data/test/testcases/block/15_math/katex.text +0 -2
 - data/test/testcases/block/15_math/mathjaxnode.html.19 +0 -27
 - data/test/testcases/block/15_math/mathjaxnode.options +0 -1
 - data/test/testcases/block/15_math/mathjaxnode.text +0 -1
 - data/test/testcases/block/15_math/mathjaxnode_notexhints.html.19 +0 -23
 - data/test/testcases/block/15_math/mathjaxnode_notexhints.options +0 -3
 - data/test/testcases/block/15_math/mathjaxnode_notexhints.text +0 -1
 - data/test/testcases/block/15_math/mathjaxnode_semantics.html.19 +0 -32
 - data/test/testcases/block/15_math/mathjaxnode_semantics.options +0 -3
 - data/test/testcases/block/15_math/mathjaxnode_semantics.text +0 -1
 - data/test/testcases/block/15_math/ritex.html +0 -1
 - data/test/testcases/block/15_math/ritex.options +0 -1
 - data/test/testcases/block/15_math/ritex.text +0 -1
 - data/test/testcases/block/15_math/sskatex.html.19 +0 -2
 - data/test/testcases/block/15_math/sskatex.options +0 -1
 - data/test/testcases/block/15_math/sskatex.text +0 -2
 - data/test/testcases/span/01_link/inline.html.19 +0 -46
 - data/test/testcases/span/01_link/reference.html.19 +0 -37
 - data/test/testcases/span/math/itex2mml.html +0 -1
 - data/test/testcases/span/math/itex2mml.options +0 -1
 - data/test/testcases/span/math/itex2mml.text +0 -1
 - data/test/testcases/span/math/katex.html.19 +0 -1
 - data/test/testcases/span/math/katex.options +0 -1
 - data/test/testcases/span/math/katex.text +0 -1
 - data/test/testcases/span/math/mathjaxnode.html.19 +0 -27
 - data/test/testcases/span/math/mathjaxnode.options +0 -1
 - data/test/testcases/span/math/mathjaxnode.text +0 -1
 - data/test/testcases/span/math/ritex.html +0 -1
 - data/test/testcases/span/math/ritex.options +0 -1
 - data/test/testcases/span/math/ritex.text +0 -1
 - data/test/testcases/span/math/sskatex.html.19 +0 -1
 - data/test/testcases/span/math/sskatex.options +0 -1
 - data/test/testcases/span/math/sskatex.text +0 -1
 - data/test/testcases/span/text_substitutions/entities_as_char.html.19 +0 -1
 - data/test/testcases_gfm/atx_header.html +0 -3
 - data/test/testcases_gfm/atx_header.text +0 -3
 - data/test/testcases_gfm/backticks_disable_highlighting.html +0 -2
 - data/test/testcases_gfm/backticks_disable_highlighting.options +0 -1
 - data/test/testcases_gfm/backticks_disable_highlighting.text +0 -3
 - data/test/testcases_gfm/backticks_syntax.html +0 -20
 - data/test/testcases_gfm/backticks_syntax.text +0 -19
 - data/test/testcases_gfm/codeblock_fenced.html +0 -20
 - data/test/testcases_gfm/codeblock_fenced.options +0 -1
 - data/test/testcases_gfm/codeblock_fenced.text +0 -21
 - data/test/testcases_gfm/hard_line_breaks.html +0 -3
 - data/test/testcases_gfm/hard_line_breaks.text +0 -3
 - data/test/testcases_gfm/hard_line_breaks_off.html +0 -2
 - data/test/testcases_gfm/hard_line_breaks_off.options +0 -1
 - data/test/testcases_gfm/hard_line_breaks_off.text +0 -2
 - data/test/testcases_gfm/header_ids.html +0 -27
 - data/test/testcases_gfm/header_ids.html.19 +0 -27
 - data/test/testcases_gfm/header_ids.options +0 -1
 - data/test/testcases_gfm/header_ids.text +0 -27
 - data/test/testcases_gfm/header_ids_with_prefix.html +0 -3
 - data/test/testcases_gfm/header_ids_with_prefix.options +0 -2
 - data/test/testcases_gfm/header_ids_with_prefix.text +0 -3
 - data/test/testcases_gfm/no_typographic.html +0 -3
 - data/test/testcases_gfm/no_typographic.html.19 +0 -3
 - data/test/testcases_gfm/no_typographic.options +0 -1
 - data/test/testcases_gfm/no_typographic.text +0 -3
 - data/test/testcases_gfm/paragraph_end-disabled.html +0 -31
 - data/test/testcases_gfm/paragraph_end-disabled.options +0 -1
 - data/test/testcases_gfm/paragraph_end-disabled.text +0 -27
 - data/test/testcases_gfm/paragraph_end.html +0 -38
 - data/test/testcases_gfm/paragraph_end.text +0 -27
 - data/test/testcases_gfm/strikethrough.html +0 -27
 - data/test/testcases_gfm/strikethrough.html.19 +0 -27
 - data/test/testcases_gfm/strikethrough.text +0 -27
 - data/test/testcases_gfm/task_list.html +0 -40
 - data/test/testcases_gfm/task_list.text +0 -26
 - data/test/testcases_gfm/two_para_hard_line_breaks.html +0 -4
 - data/test/testcases_gfm/two_para_hard_line_breaks.text +0 -4
 
    
        data/lib/kramdown/utils/html.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 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,11 +29,11 @@ module Kramdown 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                    if entity_output == :as_char &&
         
     | 
| 
       31 
31 
     | 
    
         
             
                        (c = e.char.encode(@root.options[:encoding]) rescue nil) &&
         
     | 
| 
       32 
     | 
    
         
            -
                        ((c = e.char) == '"' || !ESCAPE_MAP. 
     | 
| 
      
 32 
     | 
    
         
            +
                        ((c = e.char) == '"' || !ESCAPE_MAP.key?(c))
         
     | 
| 
       33 
33 
     | 
    
         
             
                      c
         
     | 
| 
       34 
34 
     | 
    
         
             
                    elsif (entity_output == :as_input || entity_output == :as_char) && original
         
     | 
| 
       35 
35 
     | 
    
         
             
                      original
         
     | 
| 
       36 
     | 
    
         
            -
                    elsif (entity_output == :symbolic || ESCAPE_MAP. 
     | 
| 
      
 36 
     | 
    
         
            +
                    elsif (entity_output == :symbolic || ESCAPE_MAP.key?(e.char)) && !e.name.nil?
         
     | 
| 
       37 
37 
     | 
    
         
             
                      "&#{e.name};"
         
     | 
| 
       38 
38 
     | 
    
         
             
                    else # default to :numeric
         
     | 
| 
       39 
39 
     | 
    
         
             
                      "&##{e.code_point};"
         
     | 
| 
         @@ -42,7 +42,9 @@ module Kramdown 
     | 
|
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                  # Return the HTML representation of the attributes +attr+.
         
     | 
| 
       44 
44 
     | 
    
         
             
                  def html_attributes(attr)
         
     | 
| 
       45 
     | 
    
         
            -
                    attr.map  
     | 
| 
      
 45 
     | 
    
         
            +
                    attr.map do |k, v|
         
     | 
| 
      
 46 
     | 
    
         
            +
                      v.nil? || (k == 'id' && v.strip.empty?) ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\""
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end.join('')
         
     | 
| 
       46 
48 
     | 
    
         
             
                  end
         
     | 
| 
       47 
49 
     | 
    
         | 
| 
       48 
50 
     | 
    
         
             
                  # :stopdoc:
         
     | 
| 
         @@ -50,16 +52,12 @@ module Kramdown 
     | 
|
| 
       50 
52 
     | 
    
         
             
                    '<' => '<',
         
     | 
| 
       51 
53 
     | 
    
         
             
                    '>' => '>',
         
     | 
| 
       52 
54 
     | 
    
         
             
                    '&' => '&',
         
     | 
| 
       53 
     | 
    
         
            -
                    '"' => '"'
         
     | 
| 
      
 55 
     | 
    
         
            +
                    '"' => '"',
         
     | 
| 
       54 
56 
     | 
    
         
             
                  }
         
     | 
| 
       55 
57 
     | 
    
         
             
                  ESCAPE_ALL_RE = /<|>|&/
         
     | 
| 
       56 
58 
     | 
    
         
             
                  ESCAPE_TEXT_RE = Regexp.union(REXML::Parsers::BaseParser::REFERENCE_RE, /<|>|&/)
         
     | 
| 
       57 
59 
     | 
    
         
             
                  ESCAPE_ATTRIBUTE_RE = Regexp.union(REXML::Parsers::BaseParser::REFERENCE_RE, /<|>|&|"/)
         
     | 
| 
       58 
     | 
    
         
            -
                  ESCAPE_RE_FROM_TYPE = {
         
     | 
| 
       59 
     | 
    
         
            -
                    :all => ESCAPE_ALL_RE,
         
     | 
| 
       60 
     | 
    
         
            -
                    :text => ESCAPE_TEXT_RE,
         
     | 
| 
       61 
     | 
    
         
            -
                    :attribute => ESCAPE_ATTRIBUTE_RE
         
     | 
| 
       62 
     | 
    
         
            -
                  }
         
     | 
| 
      
 60 
     | 
    
         
            +
                  ESCAPE_RE_FROM_TYPE = {all: ESCAPE_ALL_RE, text: ESCAPE_TEXT_RE, attribute: ESCAPE_ATTRIBUTE_RE}
         
     | 
| 
       63 
61 
     | 
    
         
             
                  # :startdoc:
         
     | 
| 
       64 
62 
     | 
    
         | 
| 
       65 
63 
     | 
    
         
             
                  # Escape the special HTML characters in the string +str+. The parameter +type+ specifies what
         
     | 
| 
         @@ -67,7 +65,7 @@ module Kramdown 
     | 
|
| 
       67 
65 
     | 
    
         
             
                  # entities, :text - all special HTML characters except the quotation mark but no entities and
         
     | 
| 
       68 
66 
     | 
    
         
             
                  # :attribute - all special HTML characters including the quotation mark but no entities.
         
     | 
| 
       69 
67 
     | 
    
         
             
                  def escape_html(str, type = :all)
         
     | 
| 
       70 
     | 
    
         
            -
                    str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m}
         
     | 
| 
      
 68 
     | 
    
         
            +
                    str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m }
         
     | 
| 
       71 
69 
     | 
    
         
             
                  end
         
     | 
| 
       72 
70 
     | 
    
         | 
| 
       73 
71 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,10 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*-  
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C)  
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 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 
     | 
    
         
             
            module Kramdown
         
     | 
| 
       10 
11 
     | 
    
         
             
              module Utils
         
     | 
| 
         @@ -1,13 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 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 
     | 
    
         
            -
             
     | 
| 
       11 
10 
     | 
    
         
             
            require 'strscan'
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
12 
     | 
    
         
             
            module Kramdown
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # This file is part of kramdown which is licensed under the MIT.
         
     | 
| 
       7 
7 
     | 
    
         
             
            #++
         
     | 
| 
         @@ -15,8 +15,10 @@ module Kramdown 
     | 
|
| 
       15 
15 
     | 
    
         
             
                # Provides the ability to tranliterate Unicode strings into plain ASCII ones.
         
     | 
| 
       16 
16 
     | 
    
         
             
                module Unidecoder
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                  gem 'stringex' 
     | 
| 
       19 
     | 
    
         
            -
                  path = $:.find  
     | 
| 
      
 18 
     | 
    
         
            +
                  gem 'stringex'
         
     | 
| 
      
 19 
     | 
    
         
            +
                  path = $:.find do |dir|
         
     | 
| 
      
 20 
     | 
    
         
            +
                    File.directory?(File.join(File.expand_path(dir), "stringex", "unidecoder_data"))
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
23 
     | 
    
         
             
                  if !path
         
     | 
| 
       22 
24 
     | 
    
         
             
                    def self.decode(string)
         
     | 
| 
         @@ -33,8 +35,8 @@ module Kramdown 
     | 
|
| 
       33 
35 
     | 
    
         
             
                      string.gsub(/[^\x00-\x7f]/u) do |codepoint|
         
     | 
| 
       34 
36 
     | 
    
         
             
                        begin
         
     | 
| 
       35 
37 
     | 
    
         
             
                          unpacked = codepoint.unpack("U")[0]
         
     | 
| 
       36 
     | 
    
         
            -
                          CODEPOINTS["x%02x"  
     | 
| 
       37 
     | 
    
         
            -
                        rescue
         
     | 
| 
      
 38 
     | 
    
         
            +
                          CODEPOINTS[sprintf("x%02x", unpacked >> 8)][unpacked & 255]
         
     | 
| 
      
 39 
     | 
    
         
            +
                        rescue StandardError
         
     | 
| 
       38 
40 
     | 
    
         
             
                          "?"
         
     | 
| 
       39 
41 
     | 
    
         
             
                        end
         
     | 
| 
       40 
42 
     | 
    
         
             
                      end
         
     | 
    
        data/lib/kramdown/version.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # This file is part of kramdown which is licensed under the MIT.
         
     | 
| 
       7 
7 
     | 
    
         
             
            #++
         
     | 
| 
         @@ -10,6 +10,6 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
            module Kramdown
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              # The kramdown version.
         
     | 
| 
       13 
     | 
    
         
            -
              VERSION = ' 
     | 
| 
      
 13 
     | 
    
         
            +
              VERSION = '2.0.0.beta1'
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            end
         
     | 
    
        data/man/man1/kramdown.1
    CHANGED
    
    | 
         @@ -15,10 +15,10 @@ Default values for this second set can be set using YAML via the configuration f 
     | 
|
| 
       15 
15 
     | 
    
         
             
            .SH "CLI\-ONLY OPTIONS"
         
     | 
| 
       16 
16 
     | 
    
         
             
            .TP
         
     | 
| 
       17 
17 
     | 
    
         
             
            \fB\-i\fP \fIFORMAT\fP, \fB\-\-input\fP \fIFORMAT\fP
         
     | 
| 
       18 
     | 
    
         
            -
            Specify the input format\. Available input formats: \fIkramdown\fP (this is the default), \fImarkdown\fP, \fIGFM\fP  
     | 
| 
      
 18 
     | 
    
         
            +
            Specify the input format\. Available input formats: \fIkramdown\fP (this is the default), \fImarkdown\fP, or \fIhtml\fP\&\. The input format \fIGFM\fP is available through the \fBkramdown\-parser\-gfm\fP gem\.
         
     | 
| 
       19 
19 
     | 
    
         
             
            .TP
         
     | 
| 
       20 
20 
     | 
    
         
             
            \fB\-o\fP \fIFORMAT\fP, \fB\-\-output\fP \fIFORMAT\fP
         
     | 
| 
       21 
     | 
    
         
            -
            Specify one or more output formats separated by commas: \fIhtml\fP (default), \fIkramdown\fP, \fIlatex\fP, \ 
     | 
| 
      
 21 
     | 
    
         
            +
            Specify one or more output formats separated by commas: \fIhtml\fP (default), \fIkramdown\fP, \fIlatex\fP, \fIman\fP or \fIremove_html_tags\fP\&\. The converter \fIpdf\fP is available through the \fBkramdown\-converter\-pdf\fP gem\.
         
     | 
| 
       22 
22 
     | 
    
         
             
            .TP
         
     | 
| 
       23 
23 
     | 
    
         
             
            \fB\-\-no\-config\-file\fP
         
     | 
| 
       24 
24 
     | 
    
         
             
            Do not read any configuration file\. Default behavior is to check for a configuration file and read it if it exists\.
         
     | 
| 
         @@ -62,74 +62,6 @@ If this option is \fBtrue\fP, ID values for all headers are automatically genera 
     | 
|
| 
       62 
62 
     | 
    
         
             
            Default: true Used by: HTML/Latex converter
         
     | 
| 
       63 
63 
     | 
    
         
             
            .RE
         
     | 
| 
       64 
64 
     | 
    
         
             
            .TP
         
     | 
| 
       65 
     | 
    
         
            -
            \fB\-\-coderay\-bold\-every\fP \fIARG\fP
         
     | 
| 
       66 
     | 
    
         
            -
            Defines how often a line number should be made bold
         
     | 
| 
       67 
     | 
    
         
            -
            .RS
         
     | 
| 
       68 
     | 
    
         
            -
            .P
         
     | 
| 
       69 
     | 
    
         
            -
            Can either be an integer or false (to turn off bold line numbers completely)\.
         
     | 
| 
       70 
     | 
    
         
            -
            .P
         
     | 
| 
       71 
     | 
    
         
            -
            Default: 10 Used by: HTML converter
         
     | 
| 
       72 
     | 
    
         
            -
            .RE
         
     | 
| 
       73 
     | 
    
         
            -
            .TP
         
     | 
| 
       74 
     | 
    
         
            -
            \fB\-\-coderay\-css\fP \fIARG\fP
         
     | 
| 
       75 
     | 
    
         
            -
            Defines how the highlighted code gets styled
         
     | 
| 
       76 
     | 
    
         
            -
            .RS
         
     | 
| 
       77 
     | 
    
         
            -
            .P
         
     | 
| 
       78 
     | 
    
         
            -
            Possible values are :class (CSS classes are applied to the code elements, one must supply the needed CSS file) or :style (default CSS styles are directly applied to the code elements)\.
         
     | 
| 
       79 
     | 
    
         
            -
            .P
         
     | 
| 
       80 
     | 
    
         
            -
            Default: style Used by: HTML converter
         
     | 
| 
       81 
     | 
    
         
            -
            .RE
         
     | 
| 
       82 
     | 
    
         
            -
            .TP
         
     | 
| 
       83 
     | 
    
         
            -
            \fB\-\-coderay\-default\-lang\fP \fIARG\fP
         
     | 
| 
       84 
     | 
    
         
            -
            Sets the default language for highlighting code blocks
         
     | 
| 
       85 
     | 
    
         
            -
            .RS
         
     | 
| 
       86 
     | 
    
         
            -
            .P
         
     | 
| 
       87 
     | 
    
         
            -
            If no language is set for a code block, the default language is used instead\. The value has to be one of the languages supported by coderay or nil if no default language should be used\.
         
     | 
| 
       88 
     | 
    
         
            -
            .P
         
     | 
| 
       89 
     | 
    
         
            -
            Default: nil Used by: HTML converter
         
     | 
| 
       90 
     | 
    
         
            -
            .RE
         
     | 
| 
       91 
     | 
    
         
            -
            .TP
         
     | 
| 
       92 
     | 
    
         
            -
            \fB\-\-coderay\-line\-number\-start\fP \fIARG\fP
         
     | 
| 
       93 
     | 
    
         
            -
            The start value for the line numbers
         
     | 
| 
       94 
     | 
    
         
            -
            .RS
         
     | 
| 
       95 
     | 
    
         
            -
            .P
         
     | 
| 
       96 
     | 
    
         
            -
            Default: 1 Used by: HTML converter
         
     | 
| 
       97 
     | 
    
         
            -
            .RE
         
     | 
| 
       98 
     | 
    
         
            -
            .TP
         
     | 
| 
       99 
     | 
    
         
            -
            \fB\-\-coderay\-line\-numbers\fP \fIARG\fP
         
     | 
| 
       100 
     | 
    
         
            -
            Defines how and if line numbers should be shown
         
     | 
| 
       101 
     | 
    
         
            -
            .RS
         
     | 
| 
       102 
     | 
    
         
            -
            .P
         
     | 
| 
       103 
     | 
    
         
            -
            The possible values are :table, :inline or nil\. If this option is nil, no line numbers are shown\.
         
     | 
| 
       104 
     | 
    
         
            -
            .P
         
     | 
| 
       105 
     | 
    
         
            -
            Default: :inline Used by: HTML converter
         
     | 
| 
       106 
     | 
    
         
            -
            .RE
         
     | 
| 
       107 
     | 
    
         
            -
            .TP
         
     | 
| 
       108 
     | 
    
         
            -
            \fB\-\-coderay\-tab\-width\fP \fIARG\fP
         
     | 
| 
       109 
     | 
    
         
            -
            The tab width used in highlighted code
         
     | 
| 
       110 
     | 
    
         
            -
            .RS
         
     | 
| 
       111 
     | 
    
         
            -
            .P
         
     | 
| 
       112 
     | 
    
         
            -
            Used by: HTML converter
         
     | 
| 
       113 
     | 
    
         
            -
            .RE
         
     | 
| 
       114 
     | 
    
         
            -
            .TP
         
     | 
| 
       115 
     | 
    
         
            -
            \fB\-\-coderay\-wrap\fP \fIARG\fP
         
     | 
| 
       116 
     | 
    
         
            -
            Defines how the highlighted code should be wrapped
         
     | 
| 
       117 
     | 
    
         
            -
            .RS
         
     | 
| 
       118 
     | 
    
         
            -
            .P
         
     | 
| 
       119 
     | 
    
         
            -
            The possible values are :span, :div or nil\.
         
     | 
| 
       120 
     | 
    
         
            -
            .P
         
     | 
| 
       121 
     | 
    
         
            -
            Default: :div Used by: HTML converter
         
     | 
| 
       122 
     | 
    
         
            -
            .RE
         
     | 
| 
       123 
     | 
    
         
            -
            .TP
         
     | 
| 
       124 
     | 
    
         
            -
            \fB\-\-[no\-]enable\-coderay\fP
         
     | 
| 
       125 
     | 
    
         
            -
            Use coderay for syntax highlighting
         
     | 
| 
       126 
     | 
    
         
            -
            .RS
         
     | 
| 
       127 
     | 
    
         
            -
            .P
         
     | 
| 
       128 
     | 
    
         
            -
            If this option is \fBtrue\fP, coderay is used by the HTML converter for syntax highlighting the content of code spans and code blocks\.
         
     | 
| 
       129 
     | 
    
         
            -
            .P
         
     | 
| 
       130 
     | 
    
         
            -
            Default: true Used by: HTML converter
         
     | 
| 
       131 
     | 
    
         
            -
            .RE
         
     | 
| 
       132 
     | 
    
         
            -
            .TP
         
     | 
| 
       133 
65 
     | 
    
         
             
            \fB\-\-entity\-output\fP \fIARG\fP
         
     | 
| 
       134 
66 
     | 
    
         
             
            Defines how entities are output
         
     | 
| 
       135 
67 
     | 
    
         
             
            .RS
         
     | 
| 
         @@ -170,42 +102,6 @@ This option can be used to specify the number that is used for the first footnot 
     | 
|
| 
       170 
102 
     | 
    
         
             
            Default: 1 Used by: HTML converter
         
     | 
| 
       171 
103 
     | 
    
         
             
            .RE
         
     | 
| 
       172 
104 
     | 
    
         
             
            .TP
         
     | 
| 
       173 
     | 
    
         
            -
            \fB\-\-gfm\-quirks\fP \fIARG\fP
         
     | 
| 
       174 
     | 
    
         
            -
            Enables a set of GFM specific quirks
         
     | 
| 
       175 
     | 
    
         
            -
            .RS
         
     | 
| 
       176 
     | 
    
         
            -
            .P
         
     | 
| 
       177 
     | 
    
         
            -
            The way how GFM is transformed on Github often differs from the way kramdown does things\. Many of these differences are negligible but others are not\.
         
     | 
| 
       178 
     | 
    
         
            -
            .P
         
     | 
| 
       179 
     | 
    
         
            -
            This option allows one to enable/disable certain GFM quirks, i\.e\. ways in which GFM parsing differs from kramdown parsing\.
         
     | 
| 
       180 
     | 
    
         
            -
            .P
         
     | 
| 
       181 
     | 
    
         
            -
            The value has to be a list of quirk names that should be enabled, separated by commas\. Possible names are:
         
     | 
| 
       182 
     | 
    
         
            -
            .IP \(bu 4
         
     | 
| 
       183 
     | 
    
         
            -
            paragraph_end
         
     | 
| 
       184 
     | 
    
         
            -
            .RS
         
     | 
| 
       185 
     | 
    
         
            -
            .P
         
     | 
| 
       186 
     | 
    
         
            -
            Disables the kramdown restriction that at least one blank line has to be used after a paragraph before a new block element can be started\.
         
     | 
| 
       187 
     | 
    
         
            -
            .P
         
     | 
| 
       188 
     | 
    
         
            -
            Note that if this quirk is used, lazy line wrapping does not fully work anymore!
         
     | 
| 
       189 
     | 
    
         
            -
            .RE
         
     | 
| 
       190 
     | 
    
         
            -
            .IP \(bu 4
         
     | 
| 
       191 
     | 
    
         
            -
            no_auto_typographic
         
     | 
| 
       192 
     | 
    
         
            -
            .RS
         
     | 
| 
       193 
     | 
    
         
            -
            .P
         
     | 
| 
       194 
     | 
    
         
            -
            Disables automatic conversion of some characters into their corresponding typographic symbols (like \fB\-\-\fP to em\-dash etc)\. This helps to achieve results closer to what GitHub Flavored Markdown produces\.
         
     | 
| 
       195 
     | 
    
         
            -
            .RE
         
     | 
| 
       196 
     | 
    
         
            -
            .P
         
     | 
| 
       197 
     | 
    
         
            -
            Default: paragraph_end Used by: GFM parser
         
     | 
| 
       198 
     | 
    
         
            -
            .RE
         
     | 
| 
       199 
     | 
    
         
            -
            .TP
         
     | 
| 
       200 
     | 
    
         
            -
            \fB\-\-[no\-]hard\-wrap\fP
         
     | 
| 
       201 
     | 
    
         
            -
            Interprets line breaks literally
         
     | 
| 
       202 
     | 
    
         
            -
            .RS
         
     | 
| 
       203 
     | 
    
         
            -
            .P
         
     | 
| 
       204 
     | 
    
         
            -
            Insert HTML \fB<br />\fP tags inside paragraphs where the original Markdown document had newlines (by default, Markdown ignores these newlines)\.
         
     | 
| 
       205 
     | 
    
         
            -
            .P
         
     | 
| 
       206 
     | 
    
         
            -
            Default: true Used by: GFM parser
         
     | 
| 
       207 
     | 
    
         
            -
            .RE
         
     | 
| 
       208 
     | 
    
         
            -
            .TP
         
     | 
| 
       209 
105 
     | 
    
         
             
            \fB\-\-header\-offset\fP \fIARG\fP
         
     | 
| 
       210 
106 
     | 
    
         
             
            Sets the output offset for headers
         
     | 
| 
       211 
107 
     | 
    
         
             
            .RS
         
     | 
| 
         @@ -328,7 +224,7 @@ Specifies the syntax highlighter that should be used for highlighting code block 
     | 
|
| 
       328 
224 
     | 
    
         
             
            .P
         
     | 
| 
       329 
225 
     | 
    
         
             
            Options for the syntax highlighter can be set with the syntax_highlighter_opts configuration option\.
         
     | 
| 
       330 
226 
     | 
    
         
             
            .P
         
     | 
| 
       331 
     | 
    
         
            -
            Default:  
     | 
| 
      
 227 
     | 
    
         
            +
            Default: rouge Used by: HTML/Latex converter
         
     | 
| 
       332 
228 
     | 
    
         
             
            .RE
         
     | 
| 
       333 
229 
     | 
    
         
             
            .TP
         
     | 
| 
       334 
230 
     | 
    
         
             
            \fB\-\-syntax\-highlighter\-opts\fP \fIARG\fP
         
     | 
    
        data/test/run_tests.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # This file is part of kramdown which is licensed under the MIT.
         
     | 
| 
       7 
7 
     | 
    
         
             
            #++
         
     | 
| 
         @@ -22,7 +22,7 @@ arg = if File.directory?(arg) 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    arg + '.text'
         
     | 
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            width = ((size =  
     | 
| 
      
 25 
     | 
    
         
            +
            width = ((size = `stty size 2>/dev/null`).length > 0 ? size.split.last.to_i : 72) rescue 72
         
     | 
| 
       26 
26 
     | 
    
         
             
            width -= 8
         
     | 
| 
       27 
27 
     | 
    
         
             
            fwidth = 0
         
     | 
| 
       28 
28 
     | 
    
         
             
            Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].max }.each do |file|
         
     | 
| 
         @@ -31,13 +31,13 @@ Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].max }.each do |file| 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
              html_file = file.sub('.text', '.html')
         
     | 
| 
       33 
33 
     | 
    
         
             
              opts_file = file.sub('.text', '.options')
         
     | 
| 
       34 
     | 
    
         
            -
              opts_file = File.join(File.dirname(file), 'options')  
     | 
| 
       35 
     | 
    
         
            -
              options = File.exist?(opts_file) ? YAML 
     | 
| 
      
 34 
     | 
    
         
            +
              opts_file = File.join(File.dirname(file), 'options') unless File.exist?(opts_file)
         
     | 
| 
      
 35 
     | 
    
         
            +
              options = File.exist?(opts_file) ? YAML.safe_load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
       36 
36 
     | 
    
         
             
              doc = Kramdown::Document.new(File.read(file), options)
         
     | 
| 
       37 
37 
     | 
    
         
             
              begin
         
     | 
| 
       38 
38 
     | 
    
         
             
                assert_equal(File.read(html_file), doc.to_html)
         
     | 
| 
       39 
39 
     | 
    
         
             
                puts 'PASSED'
         
     | 
| 
       40 
     | 
    
         
            -
              rescue  
     | 
| 
      
 40 
     | 
    
         
            +
              rescue StandardError
         
     | 
| 
       41 
41 
     | 
    
         
             
                puts '  FAILED'
         
     | 
| 
       42 
42 
     | 
    
         
             
                puts $!.message if $VERBOSE
         
     | 
| 
       43 
43 
     | 
    
         
             
                puts $!.backtrace if $DEBUG
         
     | 
    
        data/test/test_files.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8; frozen_string_literal: true -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (C) 2009- 
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # This file is part of kramdown which is licensed under the MIT.
         
     | 
| 
       7 
7 
     | 
    
         
             
            #++
         
     | 
| 
         @@ -21,6 +21,7 @@ begin 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              # custom formatter for tests
         
     | 
| 
       23 
23 
     | 
    
         
             
              class RougeHTMLFormatters < Kramdown::Converter::SyntaxHighlighter::Rouge.formatter_class
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       24 
25 
     | 
    
         
             
                tag 'rouge_html_formatters'
         
     | 
| 
       25 
26 
     | 
    
         | 
| 
       26 
27 
     | 
    
         
             
                def stream(tokens, &b)
         
     | 
| 
         @@ -28,58 +29,28 @@ begin 
     | 
|
| 
       28 
29 
     | 
    
         
             
                  super
         
     | 
| 
       29 
30 
     | 
    
         
             
                  yield %(</div>)
         
     | 
| 
       30 
31 
     | 
    
         
             
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       31 
33 
     | 
    
         
             
              end
         
     | 
| 
       32 
34 
     | 
    
         
             
            rescue LoadError, SyntaxError, NameError
         
     | 
| 
       33 
35 
     | 
    
         
             
            end
         
     | 
| 
       34 
36 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
            Encoding.default_external = 'utf-8' 
     | 
| 
      
 37 
     | 
    
         
            +
            Encoding.default_external = 'utf-8'
         
     | 
| 
       36 
38 
     | 
    
         | 
| 
       37 
39 
     | 
    
         
             
            class TestFiles < Minitest::Test
         
     | 
| 
       38 
40 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
       40 
     | 
    
         
            -
                                         require 'kramdown/converter/math_engine/mathjaxnode'
         
     | 
| 
       41 
     | 
    
         
            -
                                         Kramdown::Converter::MathEngine::MathjaxNode::AVAILABLE or
         
     | 
| 
       42 
     | 
    
         
            -
                                           warn("Skipping MathjaxNode tests as MathjaxNode is not available")
         
     | 
| 
       43 
     | 
    
         
            -
                                       end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
              SSKATEX_AVAILABLE = begin
         
     | 
| 
       46 
     | 
    
         
            -
                                    / class="katex"/ === Kramdown::Document.
         
     | 
| 
       47 
     | 
    
         
            -
                                      new('$$a$$', {:math_engine => :sskatex}).to_html or
         
     | 
| 
       48 
     | 
    
         
            -
                                      warn("Skipping SsKaTeX tests as SsKaTeX is not available.")
         
     | 
| 
       49 
     | 
    
         
            -
                                  rescue
         
     | 
| 
       50 
     | 
    
         
            -
                                    warn("Skipping SsKaTeX tests as default SsKaTeX config does not work.")
         
     | 
| 
       51 
     | 
    
         
            -
                                  end or warn("Run \"rake dev:test_sskatex_deps\" to see why.")
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              KATEX_AVAILABLE = RUBY_VERSION >= '2.3'
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
              EXCLUDE_KD_FILES = [('test/testcases/block/04_header/with_auto_ids.text' if RUBY_VERSION <= '1.8.6'), # bc of dep stringex not working
         
     | 
| 
       56 
     | 
    
         
            -
                                  ('test/testcases/span/03_codespan/rouge/' if RUBY_VERSION < '2.0'), #bc of rouge
         
     | 
| 
       57 
     | 
    
         
            -
                                  ('test/testcases/block/06_codeblock/rouge/' if RUBY_VERSION < '2.0'), #bc of rouge
         
     | 
| 
       58 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/itex2mml.text' if RUBY_PLATFORM == 'java'), # bc of itextomml
         
     | 
| 
       59 
     | 
    
         
            -
                                  ('test/testcases/span/math/itex2mml.text' if RUBY_PLATFORM == 'java'), # bc of itextomml
         
     | 
| 
       60 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/mathjaxnode.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       61 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/mathjaxnode_notexhints.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       62 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/mathjaxnode_semantics.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       63 
     | 
    
         
            -
                                  ('test/testcases/span/math/mathjaxnode.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       64 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       65 
     | 
    
         
            -
                                  ('test/testcases/span/math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       66 
     | 
    
         
            -
                                  ('test/testcases/block/15_math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       67 
     | 
    
         
            -
                                  ('test/testcases/span/math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       68 
     | 
    
         
            -
                                 ].compact
         
     | 
| 
      
 41 
     | 
    
         
            +
              EXCLUDE_KD_FILES = [].compact
         
     | 
| 
       69 
42 
     | 
    
         | 
| 
       70 
43 
     | 
    
         
             
              # Generate test methods for kramdown-to-xxx conversion
         
     | 
| 
       71 
44 
     | 
    
         
             
              Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
         
     | 
| 
       72 
     | 
    
         
            -
                next if EXCLUDE_KD_FILES.any? {|f| text_file =~ /#{f}/}
         
     | 
| 
      
 45 
     | 
    
         
            +
                next if EXCLUDE_KD_FILES.any? {|f| text_file =~ /#{f}/ }
         
     | 
| 
       73 
46 
     | 
    
         
             
                basename = text_file.sub(/\.text$/, '')
         
     | 
| 
       74 
47 
     | 
    
         
             
                opts_file = text_file.sub(/\.text$/, '.options')
         
     | 
| 
       75 
48 
     | 
    
         
             
                (Dir[basename + ".*"] - [text_file, opts_file]).each do |output_file|
         
     | 
| 
       76 
     | 
    
         
            -
                   
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                  output_format = File.extname(output_file.sub(/\.19$/, ''))[1..-1]
         
     | 
| 
       79 
     | 
    
         
            -
                  next if !Kramdown::Converter.const_defined?(output_format[0..0].upcase + output_format[1..-1])
         
     | 
| 
      
 49 
     | 
    
         
            +
                  output_format = File.extname(output_file)[1..-1]
         
     | 
| 
      
 50 
     | 
    
         
            +
                  next unless Kramdown::Converter.const_defined?(output_format[0..0].upcase + output_format[1..-1])
         
     | 
| 
       80 
51 
     | 
    
         
             
                  define_method('test_' + text_file.tr('.', '_') + "_to_#{output_format}") do
         
     | 
| 
       81 
     | 
    
         
            -
                    opts_file = File.join(File.dirname(text_file), 'options')  
     | 
| 
       82 
     | 
    
         
            -
                    options = File.exist?(opts_file) ? YAML 
     | 
| 
      
 52 
     | 
    
         
            +
                    opts_file = File.join(File.dirname(text_file), 'options') unless File.exist?(opts_file)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    options = File.exist?(opts_file) ? YAML.load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
       83 
54 
     | 
    
         
             
                    doc = Kramdown::Document.new(File.read(text_file), options)
         
     | 
| 
       84 
55 
     | 
    
         
             
                    assert_equal(File.read(output_file), doc.send("to_#{output_format}"))
         
     | 
| 
       85 
56 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -91,54 +62,43 @@ class TestFiles < Minitest::Test 
     | 
|
| 
       91 
62 
     | 
    
         
             
              if $?.exitstatus != 0
         
     | 
| 
       92 
63 
     | 
    
         
             
                warn("Skipping html-to-{html,kramdown} tests because tidy executable is missing")
         
     | 
| 
       93 
64 
     | 
    
         
             
              else
         
     | 
| 
       94 
     | 
    
         
            -
                EXCLUDE_HTML_FILES = [ 
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
                                      'test/testcases/span/05_html/mark_element.html', # bc of tidy
         
     | 
| 
       120 
     | 
    
         
            -
                                      'test/testcases/block/09_html/xml.html', # bc of tidy
         
     | 
| 
       121 
     | 
    
         
            -
                                      'test/testcases/span/05_html/xml.html', # bc of tidy
         
     | 
| 
       122 
     | 
    
         
            -
                                     ].compact
         
     | 
| 
       123 
     | 
    
         
            -
                EXCLUDE_HTML_TEXT_FILES = ['test/testcases/block/09_html/parse_as_span.htmlinput',
         
     | 
| 
       124 
     | 
    
         
            -
                                           'test/testcases/block/09_html/parse_as_raw.htmlinput',
         
     | 
| 
       125 
     | 
    
         
            -
                                          ].compact
         
     | 
| 
       126 
     | 
    
         
            -
                Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,html.19,htmlinput,htmlinput.19}'].each do |html_file|
         
     | 
| 
       127 
     | 
    
         
            -
                  next if EXCLUDE_HTML_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
         
     | 
| 
       128 
     | 
    
         
            -
                  next if (RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')) ||
         
     | 
| 
       129 
     | 
    
         
            -
                    (RUBY_VERSION < '1.9' && html_file =~ /\.19$/)
         
     | 
| 
      
 65 
     | 
    
         
            +
                EXCLUDE_HTML_FILES = [
         
     | 
| 
      
 66 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/whitespace.html', # bc of span inside pre
         
     | 
| 
      
 67 
     | 
    
         
            +
                  'test/testcases/block/09_html/simple.html', # bc of xml elements
         
     | 
| 
      
 68 
     | 
    
         
            +
                  'test/testcases/span/03_codespan/highlighting.html', # bc of span elements inside code element
         
     | 
| 
      
 69 
     | 
    
         
            +
                  'test/testcases/block/04_header/with_auto_ids.html', # bc of auto_ids=true option
         
     | 
| 
      
 70 
     | 
    
         
            +
                  'test/testcases/block/04_header/header_type_offset.html', # bc of header_offset option
         
     | 
| 
      
 71 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/simple.html', # bc of double surrounding <div>
         
     | 
| 
      
 72 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/multiple.html', # bc of double surrounding <div>
         
     | 
| 
      
 73 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/highlighting.html', # bc of span elements inside code element
         
     | 
| 
      
 74 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/highlighting-opts.html', # bc of span elements inside code element
         
     | 
| 
      
 75 
     | 
    
         
            +
                  'test/testcases/block/12_extension/options3.html', # bc of rouge
         
     | 
| 
      
 76 
     | 
    
         
            +
                  'test/testcases/block/14_table/empty_tag_in_cell.html', # bc of tidy
         
     | 
| 
      
 77 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview.html', # bc of mathjax preview
         
     | 
| 
      
 78 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview_simple.html', # bc of mathjax preview
         
     | 
| 
      
 79 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview_as_code.html', # bc of mathjax preview
         
     | 
| 
      
 80 
     | 
    
         
            +
                  'test/testcases/span/05_html/mark_element.html', # bc of tidy
         
     | 
| 
      
 81 
     | 
    
         
            +
                  'test/testcases/block/09_html/xml.html', # bc of tidy
         
     | 
| 
      
 82 
     | 
    
         
            +
                  'test/testcases/span/05_html/xml.html', # bc of tidy
         
     | 
| 
      
 83 
     | 
    
         
            +
                ].compact
         
     | 
| 
      
 84 
     | 
    
         
            +
                EXCLUDE_HTML_TEXT_FILES = [
         
     | 
| 
      
 85 
     | 
    
         
            +
                  'test/testcases/block/09_html/parse_as_span.htmlinput',
         
     | 
| 
      
 86 
     | 
    
         
            +
                  'test/testcases/block/09_html/parse_as_raw.htmlinput',
         
     | 
| 
      
 87 
     | 
    
         
            +
                ].compact
         
     | 
| 
      
 88 
     | 
    
         
            +
                Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,htmlinput}'].each do |html_file|
         
     | 
| 
      
 89 
     | 
    
         
            +
                  next if EXCLUDE_HTML_FILES.any? {|f| html_file =~ /#{f}/ }
         
     | 
| 
       130 
90 
     | 
    
         | 
| 
       131 
91 
     | 
    
         
             
                  out_files = []
         
     | 
| 
       132 
     | 
    
         
            -
                  out_files << [(html_file =~ /\.htmlinput 
     | 
| 
       133 
     | 
    
         
            -
                  if html_file =~ /\.htmlinput 
     | 
| 
       134 
     | 
    
         
            -
                    out_files << [html_file.sub(/htmlinput 
     | 
| 
      
 92 
     | 
    
         
            +
                  out_files << [(html_file =~ /\.htmlinput$/ ? html_file.sub(/input$/, '') : html_file), :to_html]
         
     | 
| 
      
 93 
     | 
    
         
            +
                  if html_file =~ /\.htmlinput$/ && EXCLUDE_HTML_TEXT_FILES.none? {|f| html_file =~ /#{f}/ }
         
     | 
| 
      
 94 
     | 
    
         
            +
                    out_files << [html_file.sub(/htmlinput$/, 'text'), :to_kramdown]
         
     | 
| 
       135 
95 
     | 
    
         
             
                  end
         
     | 
| 
       136 
     | 
    
         
            -
                  out_files.select {|f, _| File.exist?(f)}.each do |out_file, out_method|
         
     | 
| 
      
 96 
     | 
    
         
            +
                  out_files.select {|f, _| File.exist?(f) }.each do |out_file, out_method|
         
     | 
| 
       137 
97 
     | 
    
         
             
                    define_method('test_' + html_file.tr('.', '_') + "_to_#{File.extname(out_file)}") do
         
     | 
| 
       138 
     | 
    
         
            -
                      opts_file = html_file.sub(/\.html(input) 
     | 
| 
       139 
     | 
    
         
            -
                      opts_file = File.join(File.dirname(html_file), 'options')  
     | 
| 
       140 
     | 
    
         
            -
                      options = File.exist?(opts_file) ? YAML 
     | 
| 
       141 
     | 
    
         
            -
                      doc = Kramdown::Document.new(File.read(html_file), options.merge(: 
     | 
| 
      
 98 
     | 
    
         
            +
                      opts_file = html_file.sub(/\.html(input)?$/, '.options')
         
     | 
| 
      
 99 
     | 
    
         
            +
                      opts_file = File.join(File.dirname(html_file), 'options') unless File.exist?(opts_file)
         
     | 
| 
      
 100 
     | 
    
         
            +
                      options = File.exist?(opts_file) ? YAML.load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
      
 101 
     | 
    
         
            +
                      doc = Kramdown::Document.new(File.read(html_file), options.merge(input: 'html'))
         
     | 
| 
       142 
102 
     | 
    
         
             
                      if out_method == :to_html
         
     | 
| 
       143 
103 
     | 
    
         
             
                        assert_equal(tidy_output(File.read(out_file)), tidy_output(doc.send(out_method)))
         
     | 
| 
       144 
104 
     | 
    
         
             
                      else
         
     | 
| 
         @@ -167,19 +127,19 @@ class TestFiles < Minitest::Test 
     | 
|
| 
       167 
127 
     | 
    
         
             
              if $?.exitstatus != 0
         
     | 
| 
       168 
128 
     | 
    
         
             
                warn("Skipping latex compilation tests because latex executable is missing")
         
     | 
| 
       169 
129 
     | 
    
         
             
              else
         
     | 
| 
       170 
     | 
    
         
            -
                EXCLUDE_LATEX_FILES = [ 
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 130 
     | 
    
         
            +
                EXCLUDE_LATEX_FILES = [
         
     | 
| 
      
 131 
     | 
    
         
            +
                  'test/testcases/span/01_link/image_in_a.text', # bc of image link
         
     | 
| 
      
 132 
     | 
    
         
            +
                  'test/testcases/span/01_link/imagelinks.text', # bc of image links
         
     | 
| 
      
 133 
     | 
    
         
            +
                  'test/testcases/span/01_link/empty_title.text',
         
     | 
| 
      
 134 
     | 
    
         
            +
                  'test/testcases/span/04_footnote/markers.text', # bc of footnote in header
         
     | 
| 
      
 135 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.text',
         
     | 
| 
      
 136 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.text',
         
     | 
| 
      
 137 
     | 
    
         
            +
                ].compact
         
     | 
| 
       177 
138 
     | 
    
         
             
                Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
         
     | 
| 
       178 
     | 
    
         
            -
                  next if EXCLUDE_LATEX_FILES.any? {|f| text_file =~ /#{f}$/}
         
     | 
| 
      
 139 
     | 
    
         
            +
                  next if EXCLUDE_LATEX_FILES.any? {|f| text_file =~ /#{f}$/ }
         
     | 
| 
       179 
140 
     | 
    
         
             
                  define_method('test_' + text_file.tr('.', '_') + "_to_latex_compilation") do
         
     | 
| 
       180 
     | 
    
         
            -
                    latex = 
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                                                    :template => 'document').to_latex
         
     | 
| 
      
 141 
     | 
    
         
            +
                    latex = Kramdown::Document.new(File.read(text_file), auto_ids: false, footnote_nr: 1,
         
     | 
| 
      
 142 
     | 
    
         
            +
                                                   template: 'document').to_latex
         
     | 
| 
       183 
143 
     | 
    
         
             
                    Dir.mktmpdir do |tmpdir|
         
     | 
| 
       184 
144 
     | 
    
         
             
                      result = IO.popen("latex -output-directory='#{tmpdir}' 2>/dev/null", 'r+') do |io|
         
     | 
| 
       185 
145 
     | 
    
         
             
                        io.write(latex)
         
     | 
| 
         @@ -197,50 +157,35 @@ class TestFiles < Minitest::Test 
     | 
|
| 
       197 
157 
     | 
    
         
             
              if $?.exitstatus != 0
         
     | 
| 
       198 
158 
     | 
    
         
             
                warn("Skipping text->kramdown->html tests because tidy executable is missing")
         
     | 
| 
       199 
159 
     | 
    
         
             
              else
         
     | 
| 
       200 
     | 
    
         
            -
                EXCLUDE_TEXT_FILES = [ 
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                                      'test/testcases/span/math/itex2mml.text', # bc of tidy
         
     | 
| 
       222 
     | 
    
         
            -
                                      'test/testcases/block/15_math/mathjaxnode.text', # bc of tidy
         
     | 
| 
       223 
     | 
    
         
            -
                                      'test/testcases/block/15_math/mathjaxnode_notexhints.text', # bc of tidy
         
     | 
| 
       224 
     | 
    
         
            -
                                      'test/testcases/block/15_math/mathjaxnode_semantics.text', # bc of tidy
         
     | 
| 
       225 
     | 
    
         
            -
                                      'test/testcases/span/math/mathjaxnode.text', # bc of tidy
         
     | 
| 
       226 
     | 
    
         
            -
                                      'test/testcases/block/15_math/sskatex.text', # bc of tidy
         
     | 
| 
       227 
     | 
    
         
            -
                                      'test/testcases/span/math/sskatex.text', # bc of tidy
         
     | 
| 
       228 
     | 
    
         
            -
                                      'test/testcases/block/15_math/katex.text', # bc of tidy
         
     | 
| 
       229 
     | 
    
         
            -
                                      'test/testcases/span/math/katex.text', # bc of tidy
         
     | 
| 
       230 
     | 
    
         
            -
                                      'test/testcases/span/01_link/link_defs_with_ial.text', # bc of attribute ordering
         
     | 
| 
       231 
     | 
    
         
            -
                                      'test/testcases/span/05_html/mark_element.text', # bc of tidy
         
     | 
| 
       232 
     | 
    
         
            -
                                      'test/testcases/block/09_html/xml.text', # bc of tidy
         
     | 
| 
       233 
     | 
    
         
            -
                                      'test/testcases/span/05_html/xml.text', # bc of tidy
         
     | 
| 
       234 
     | 
    
         
            -
                                     ].compact
         
     | 
| 
      
 160 
     | 
    
         
            +
                EXCLUDE_TEXT_FILES = [
         
     | 
| 
      
 161 
     | 
    
         
            +
                  'test/testcases/span/05_html/markdown_attr.text',  # bc of markdown attr
         
     | 
| 
      
 162 
     | 
    
         
            +
                  'test/testcases/block/09_html/markdown_attr.text', # bc of markdown attr
         
     | 
| 
      
 163 
     | 
    
         
            +
                  'test/testcases/span/extension/options.text',      # bc of parse_span_html option
         
     | 
| 
      
 164 
     | 
    
         
            +
                  'test/testcases/block/12_extension/options.text',  # bc of options option
         
     | 
| 
      
 165 
     | 
    
         
            +
                  'test/testcases/block/12_extension/options3.text', # bc of options option
         
     | 
| 
      
 166 
     | 
    
         
            +
                  'test/testcases/block/09_html/content_model/tables.text',  # bc of parse_block_html option
         
     | 
| 
      
 167 
     | 
    
         
            +
                  'test/testcases/block/09_html/html_to_native/header.text', # bc of auto_ids option that interferes
         
     | 
| 
      
 168 
     | 
    
         
            +
                  'test/testcases/block/09_html/html_to_native/table_simple.text', # bc of tr style attr getting removed
         
     | 
| 
      
 169 
     | 
    
         
            +
                  'test/testcases/block/09_html/simple.text',        # bc of webgen:block elements
         
     | 
| 
      
 170 
     | 
    
         
            +
                  'test/testcases/block/11_ial/simple.text',         # bc of change of ordering of attributes in header
         
     | 
| 
      
 171 
     | 
    
         
            +
                  'test/testcases/span/extension/comment.text',      # bc of comment text modifications (can this be avoided?)
         
     | 
| 
      
 172 
     | 
    
         
            +
                  'test/testcases/block/04_header/header_type_offset.text', # bc of header_offset being applied twice
         
     | 
| 
      
 173 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/simple.text',
         
     | 
| 
      
 174 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/multiple.text', # check, what document contain more, than one code block
         
     | 
| 
      
 175 
     | 
    
         
            +
                  'test/testcases/block/14_table/empty_tag_in_cell.text', # bc of tidy
         
     | 
| 
      
 176 
     | 
    
         
            +
                  'test/testcases/span/01_link/link_defs_with_ial.text', # bc of attribute ordering
         
     | 
| 
      
 177 
     | 
    
         
            +
                  'test/testcases/span/05_html/mark_element.text', # bc of tidy
         
     | 
| 
      
 178 
     | 
    
         
            +
                  'test/testcases/block/09_html/xml.text', # bc of tidy
         
     | 
| 
      
 179 
     | 
    
         
            +
                  'test/testcases/span/05_html/xml.text', # bc of tidy
         
     | 
| 
      
 180 
     | 
    
         
            +
                ].compact
         
     | 
| 
       235 
181 
     | 
    
         
             
                Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
         
     | 
| 
       236 
     | 
    
         
            -
                  next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/}
         
     | 
| 
      
 182 
     | 
    
         
            +
                  next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/ }
         
     | 
| 
       237 
183 
     | 
    
         
             
                  html_file = text_file.sub(/\.text$/, '.html')
         
     | 
| 
       238 
     | 
    
         
            -
                  html_file += '.19' if RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')
         
     | 
| 
       239 
184 
     | 
    
         
             
                  next unless File.exist?(html_file)
         
     | 
| 
       240 
185 
     | 
    
         
             
                  define_method('test_' + text_file.tr('.', '_') + "_to_kramdown_to_html") do
         
     | 
| 
       241 
186 
     | 
    
         
             
                    opts_file = text_file.sub(/\.text$/, '.options')
         
     | 
| 
       242 
     | 
    
         
            -
                    opts_file = File.join(File.dirname(text_file), 'options')  
     | 
| 
       243 
     | 
    
         
            -
                    options = File.exist?(opts_file) ? YAML 
     | 
| 
      
 187 
     | 
    
         
            +
                    opts_file = File.join(File.dirname(text_file), 'options') unless File.exist?(opts_file)
         
     | 
| 
      
 188 
     | 
    
         
            +
                    options = File.exist?(opts_file) ? YAML.load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
       244 
189 
     | 
    
         
             
                    kdtext = Kramdown::Document.new(File.read(text_file), options).to_kramdown
         
     | 
| 
       245 
190 
     | 
    
         
             
                    html = Kramdown::Document.new(kdtext, options).to_html
         
     | 
| 
       246 
191 
     | 
    
         
             
                    assert_equal(tidy_output(File.read(html_file)), tidy_output(html))
         
     | 
| 
         @@ -253,53 +198,42 @@ class TestFiles < Minitest::Test 
     | 
|
| 
       253 
198 
     | 
    
         
             
              if $?.exitstatus != 0
         
     | 
| 
       254 
199 
     | 
    
         
             
                warn("Skipping html-to-kramdown-to-html tests because tidy executable is missing")
         
     | 
| 
       255 
200 
     | 
    
         
             
              else
         
     | 
| 
       256 
     | 
    
         
            -
                EXCLUDE_HTML_KD_FILES = [ 
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
             
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
                                         'test/testcases/block/15_math/mathjax_preview.html', # bc of mathjax preview
         
     | 
| 
       287 
     | 
    
         
            -
                                         'test/testcases/block/15_math/mathjax_preview_simple.html', # bc of mathjax preview
         
     | 
| 
       288 
     | 
    
         
            -
                                         'test/testcases/block/15_math/mathjax_preview_as_code.html', # bc of mathjax preview
         
     | 
| 
       289 
     | 
    
         
            -
                                         'test/testcases/span/01_link/link_defs_with_ial.html', # bc of attribute ordering
         
     | 
| 
       290 
     | 
    
         
            -
                                         'test/testcases/span/05_html/mark_element.html', # bc of tidy
         
     | 
| 
       291 
     | 
    
         
            -
                                         'test/testcases/block/09_html/xml.html', # bc of tidy
         
     | 
| 
       292 
     | 
    
         
            -
                                         'test/testcases/span/05_html/xml.html', # bc of tidy
         
     | 
| 
       293 
     | 
    
         
            -
                                        ].compact
         
     | 
| 
       294 
     | 
    
         
            -
                Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,html.19}'].each do |html_file|
         
     | 
| 
       295 
     | 
    
         
            -
                  next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
         
     | 
| 
       296 
     | 
    
         
            -
                  next if (RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')) ||
         
     | 
| 
       297 
     | 
    
         
            -
                    (RUBY_VERSION < '1.9' && html_file =~ /\.19$/)
         
     | 
| 
      
 201 
     | 
    
         
            +
                EXCLUDE_HTML_KD_FILES = [
         
     | 
| 
      
 202 
     | 
    
         
            +
                  'test/testcases/span/extension/options.html',        # bc of parse_span_html option
         
     | 
| 
      
 203 
     | 
    
         
            +
                  'test/testcases/span/05_html/normal.html',           # bc of br tag before closing p tag
         
     | 
| 
      
 204 
     | 
    
         
            +
                  'test/testcases/block/12_extension/nomarkdown.html', # bc of nomarkdown extension
         
     | 
| 
      
 205 
     | 
    
         
            +
                  'test/testcases/block/12_extension/options3.html', # bc of rouge
         
     | 
| 
      
 206 
     | 
    
         
            +
                  'test/testcases/block/09_html/simple.html',          # bc of webgen:block elements
         
     | 
| 
      
 207 
     | 
    
         
            +
                  'test/testcases/block/09_html/markdown_attr.html',   # bc of markdown attr
         
     | 
| 
      
 208 
     | 
    
         
            +
                  'test/testcases/block/09_html/html_to_native/table_simple.html', # bc of invalidly converted simple table
         
     | 
| 
      
 209 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/whitespace.html', # bc of entity to char conversion
         
     | 
| 
      
 210 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/simple.html', # bc of double surrounding <div>
         
     | 
| 
      
 211 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/rouge/multiple.html', # bc of double surrounding <div>
         
     | 
| 
      
 212 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/highlighting.html', # bc of span elements inside code element
         
     | 
| 
      
 213 
     | 
    
         
            +
                  'test/testcases/block/06_codeblock/highlighting-opts.html', # bc of span elements inside code element
         
     | 
| 
      
 214 
     | 
    
         
            +
                  'test/testcases/block/11_ial/simple.html',           # bc of change of ordering of attributes in header
         
     | 
| 
      
 215 
     | 
    
         
            +
                  'test/testcases/span/03_codespan/highlighting.html', # bc of span elements inside code element
         
     | 
| 
      
 216 
     | 
    
         
            +
                  'test/testcases/block/04_header/with_auto_ids.html', # bc of auto_ids=true option
         
     | 
| 
      
 217 
     | 
    
         
            +
                  'test/testcases/block/04_header/header_type_offset.html', # bc of header_offset option
         
     | 
| 
      
 218 
     | 
    
         
            +
                  'test/testcases/block/16_toc/toc_exclude.html',      # bc of different attribute ordering
         
     | 
| 
      
 219 
     | 
    
         
            +
                  'test/testcases/span/autolinks/url_links.html',      # bc of quot entity being converted to char
         
     | 
| 
      
 220 
     | 
    
         
            +
                  'test/testcases/block/14_table/empty_tag_in_cell.html', # bc of tidy
         
     | 
| 
      
 221 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview.html', # bc of mathjax preview
         
     | 
| 
      
 222 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview_simple.html', # bc of mathjax preview
         
     | 
| 
      
 223 
     | 
    
         
            +
                  'test/testcases/block/15_math/mathjax_preview_as_code.html', # bc of mathjax preview
         
     | 
| 
      
 224 
     | 
    
         
            +
                  'test/testcases/span/01_link/link_defs_with_ial.html', # bc of attribute ordering
         
     | 
| 
      
 225 
     | 
    
         
            +
                  'test/testcases/span/05_html/mark_element.html', # bc of tidy
         
     | 
| 
      
 226 
     | 
    
         
            +
                  'test/testcases/block/09_html/xml.html', # bc of tidy
         
     | 
| 
      
 227 
     | 
    
         
            +
                  'test/testcases/span/05_html/xml.html', # bc of tidy
         
     | 
| 
      
 228 
     | 
    
         
            +
                ].compact
         
     | 
| 
      
 229 
     | 
    
         
            +
                Dir[File.dirname(__FILE__) + '/testcases/**/*.html'].each do |html_file|
         
     | 
| 
      
 230 
     | 
    
         
            +
                  next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}$/ }
         
     | 
| 
       298 
231 
     | 
    
         
             
                  define_method('test_' + html_file.tr('.', '_') + "_to_kramdown_to_html") do
         
     | 
| 
       299 
     | 
    
         
            -
                    kd = Kramdown::Document.new(File.read(html_file), : 
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
                    opts_file =  
     | 
| 
       302 
     | 
    
         
            -
                     
     | 
| 
      
 232 
     | 
    
         
            +
                    kd = Kramdown::Document.new(File.read(html_file), input: 'html',
         
     | 
| 
      
 233 
     | 
    
         
            +
                                                auto_ids: false, footnote_nr: 1).to_kramdown
         
     | 
| 
      
 234 
     | 
    
         
            +
                    opts_file = html_file.sub(/\.html$/, '.options')
         
     | 
| 
      
 235 
     | 
    
         
            +
                    opts_file = File.join(File.dirname(html_file), 'options') unless File.exist?(opts_file)
         
     | 
| 
      
 236 
     | 
    
         
            +
                    options = File.exist?(opts_file) ? YAML.load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
       303 
237 
     | 
    
         
             
                    doc = Kramdown::Document.new(kd, options)
         
     | 
| 
       304 
238 
     | 
    
         
             
                    assert_equal(tidy_output(File.read(html_file)), tidy_output(doc.to_html))
         
     | 
| 
       305 
239 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -310,132 +244,22 @@ class TestFiles < Minitest::Test 
     | 
|
| 
       310 
244 
     | 
    
         
             
              Dir[File.dirname(__FILE__) + '/testcases/man/**/*.text'].each do |text_file|
         
     | 
| 
       311 
245 
     | 
    
         
             
                define_method('test_' + text_file.tr('.', '_') + "_to_man") do
         
     | 
| 
       312 
246 
     | 
    
         
             
                  man_file = text_file.sub(/\.text$/, '.man')
         
     | 
| 
       313 
     | 
    
         
            -
                  doc = 
     | 
| 
      
 247 
     | 
    
         
            +
                  doc = Kramdown::Document.new(File.read(text_file))
         
     | 
| 
       314 
248 
     | 
    
         
             
                  assert_equal(File.read(man_file), doc.to_man)
         
     | 
| 
       315 
249 
     | 
    
         
             
                end
         
     | 
| 
       316 
250 
     | 
    
         
             
              end
         
     | 
| 
       317 
251 
     | 
    
         | 
| 
       318 
     | 
    
         
            -
               
     | 
| 
       319 
     | 
    
         
            -
             
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
                                   'test/testcases/block/03_paragraph/two_para.text',
         
     | 
| 
       322 
     | 
    
         
            -
                                   'test/testcases/block/03_paragraph/line_break_last_line.text',
         
     | 
| 
       323 
     | 
    
         
            -
                                   'test/testcases/block/04_header/atx_header.text',
         
     | 
| 
       324 
     | 
    
         
            -
                                   'test/testcases/block/04_header/setext_header.text',
         
     | 
| 
       325 
     | 
    
         
            -
                                   'test/testcases/block/04_header/with_auto_ids.text', # bc of ID generation difference
         
     | 
| 
       326 
     | 
    
         
            -
                                   'test/testcases/block/04_header/with_auto_id_prefix.text', # bc of ID generation difference
         
     | 
| 
       327 
     | 
    
         
            -
                                   'test/testcases/block/05_blockquote/indented.text',
         
     | 
| 
       328 
     | 
    
         
            -
                                   'test/testcases/block/05_blockquote/lazy.text',
         
     | 
| 
       329 
     | 
    
         
            -
                                   'test/testcases/block/05_blockquote/nested.text',
         
     | 
| 
       330 
     | 
    
         
            -
                                   'test/testcases/block/05_blockquote/no_newline_at_end.text',
         
     | 
| 
       331 
     | 
    
         
            -
                                   'test/testcases/block/06_codeblock/error.text',
         
     | 
| 
       332 
     | 
    
         
            -
                                   'test/testcases/block/07_horizontal_rule/error.text',
         
     | 
| 
       333 
     | 
    
         
            -
                                   'test/testcases/block/08_list/escaping.text',
         
     | 
| 
       334 
     | 
    
         
            -
                                   'test/testcases/block/08_list/item_ial.text',
         
     | 
| 
       335 
     | 
    
         
            -
                                   'test/testcases/block/08_list/lazy.text',
         
     | 
| 
       336 
     | 
    
         
            -
                                   'test/testcases/block/08_list/list_and_others.text',
         
     | 
| 
       337 
     | 
    
         
            -
                                   'test/testcases/block/08_list/other_first_element.text',
         
     | 
| 
       338 
     | 
    
         
            -
                                   'test/testcases/block/08_list/simple_ul.text',
         
     | 
| 
       339 
     | 
    
         
            -
                                   'test/testcases/block/08_list/special_cases.text',
         
     | 
| 
       340 
     | 
    
         
            -
                                   'test/testcases/block/08_list/lazy_and_nested.text', # bc of change in lazy line handling
         
     | 
| 
       341 
     | 
    
         
            -
                                   'test/testcases/block/09_html/comment.text',
         
     | 
| 
       342 
     | 
    
         
            -
                                   'test/testcases/block/09_html/html_to_native/code.text',
         
     | 
| 
       343 
     | 
    
         
            -
                                   'test/testcases/block/09_html/html_to_native/emphasis.text',
         
     | 
| 
       344 
     | 
    
         
            -
                                   'test/testcases/block/09_html/html_to_native/typography.text',
         
     | 
| 
       345 
     | 
    
         
            -
                                   'test/testcases/block/09_html/parse_as_raw.text',
         
     | 
| 
       346 
     | 
    
         
            -
                                   'test/testcases/block/09_html/simple.text',
         
     | 
| 
       347 
     | 
    
         
            -
                                   'test/testcases/block/12_extension/comment.text',
         
     | 
| 
       348 
     | 
    
         
            -
                                   'test/testcases/block/12_extension/ignored.text',
         
     | 
| 
       349 
     | 
    
         
            -
                                   'test/testcases/block/12_extension/nomarkdown.text',
         
     | 
| 
       350 
     | 
    
         
            -
                                   'test/testcases/block/13_definition_list/item_ial.text',
         
     | 
| 
       351 
     | 
    
         
            -
                                   'test/testcases/block/13_definition_list/multiple_terms.text',
         
     | 
| 
       352 
     | 
    
         
            -
                                   'test/testcases/block/13_definition_list/no_def_list.text',
         
     | 
| 
       353 
     | 
    
         
            -
                                   'test/testcases/block/13_definition_list/simple.text',
         
     | 
| 
       354 
     | 
    
         
            -
                                   'test/testcases/block/13_definition_list/with_blocks.text',
         
     | 
| 
       355 
     | 
    
         
            -
                                   'test/testcases/block/14_table/errors.text',
         
     | 
| 
       356 
     | 
    
         
            -
                                   'test/testcases/block/14_table/escaping.text',
         
     | 
| 
       357 
     | 
    
         
            -
                                   'test/testcases/block/14_table/simple.text',
         
     | 
| 
       358 
     | 
    
         
            -
                                   'test/testcases/block/15_math/normal.text',
         
     | 
| 
       359 
     | 
    
         
            -
                                   'test/testcases/block/16_toc/toc_with_footnotes.text', # bc of ID generation difference
         
     | 
| 
       360 
     | 
    
         
            -
                                   'test/testcases/encoding.text',
         
     | 
| 
       361 
     | 
    
         
            -
                                   'test/testcases/span/01_link/inline.text',
         
     | 
| 
       362 
     | 
    
         
            -
                                   'test/testcases/span/01_link/link_defs.text',
         
     | 
| 
       363 
     | 
    
         
            -
                                   'test/testcases/span/01_link/reference.text',
         
     | 
| 
       364 
     | 
    
         
            -
                                   'test/testcases/span/02_emphasis/normal.text',
         
     | 
| 
       365 
     | 
    
         
            -
                                   'test/testcases/span/03_codespan/normal.text',
         
     | 
| 
       366 
     | 
    
         
            -
                                   'test/testcases/span/04_footnote/definitions.text',
         
     | 
| 
       367 
     | 
    
         
            -
                                   'test/testcases/span/04_footnote/markers.text',
         
     | 
| 
       368 
     | 
    
         
            -
                                   'test/testcases/span/05_html/across_lines.text',
         
     | 
| 
       369 
     | 
    
         
            -
                                   'test/testcases/span/05_html/markdown_attr.text',
         
     | 
| 
       370 
     | 
    
         
            -
                                   'test/testcases/span/05_html/normal.text',
         
     | 
| 
       371 
     | 
    
         
            -
                                   'test/testcases/span/05_html/raw_span_elements.text',
         
     | 
| 
       372 
     | 
    
         
            -
                                   'test/testcases/span/autolinks/url_links.text',
         
     | 
| 
       373 
     | 
    
         
            -
                                   'test/testcases/span/extension/comment.text',
         
     | 
| 
       374 
     | 
    
         
            -
                                   'test/testcases/span/ial/simple.text',
         
     | 
| 
       375 
     | 
    
         
            -
                                   'test/testcases/span/line_breaks/normal.text',
         
     | 
| 
       376 
     | 
    
         
            -
                                   'test/testcases/span/math/normal.text',
         
     | 
| 
       377 
     | 
    
         
            -
                                   'test/testcases/span/text_substitutions/entities_as_char.text',
         
     | 
| 
       378 
     | 
    
         
            -
                                   'test/testcases/span/text_substitutions/entities.text',
         
     | 
| 
       379 
     | 
    
         
            -
                                   'test/testcases/span/text_substitutions/typography.text',
         
     | 
| 
       380 
     | 
    
         
            -
                                   ('test/testcases/span/03_codespan/rouge/simple.text' if RUBY_VERSION < '2.0'),
         
     | 
| 
       381 
     | 
    
         
            -
                                   ('test/testcases/span/03_codespan/rouge/disabled.text' if RUBY_VERSION < '2.0'),
         
     | 
| 
       382 
     | 
    
         
            -
                                   ('test/testcases/block/06_codeblock/rouge/simple.text' if RUBY_VERSION < '2.0'), #bc of rouge
         
     | 
| 
       383 
     | 
    
         
            -
                                   ('test/testcases/block/06_codeblock/rouge/disabled.text' if RUBY_VERSION < '2.0'), #bc of rouge
         
     | 
| 
       384 
     | 
    
         
            -
                                   ('test/testcases/block/06_codeblock/rouge/multiple.text' if RUBY_VERSION < '2.0'), #bc of rouge
         
     | 
| 
       385 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/itex2mml.text' if RUBY_PLATFORM == 'java'), # bc of itextomml
         
     | 
| 
       386 
     | 
    
         
            -
                                   ('test/testcases/span/math/itex2mml.text' if RUBY_PLATFORM == 'java'), # bc of itextomml
         
     | 
| 
       387 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/mathjaxnode.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       388 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/mathjaxnode_notexhints.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       389 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/mathjaxnode_semantics.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       390 
     | 
    
         
            -
                                   ('test/testcases/span/math/mathjaxnode.text' unless MATHJAX_NODE_AVAILABLE),
         
     | 
| 
       391 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       392 
     | 
    
         
            -
                                   ('test/testcases/span/math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       393 
     | 
    
         
            -
                                   ('test/testcases/block/15_math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       394 
     | 
    
         
            -
                                   ('test/testcases/span/math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       395 
     | 
    
         
            -
                                  ].compact
         
     | 
| 
       396 
     | 
    
         
            -
             
     | 
| 
       397 
     | 
    
         
            -
              # Generate test methods for gfm-to-html conversion
         
     | 
| 
       398 
     | 
    
         
            -
              Dir[File.dirname(__FILE__) + '/{testcases,testcases_gfm}/**/*.text'].each do |text_file|
         
     | 
| 
       399 
     | 
    
         
            -
                next if EXCLUDE_GFM_FILES.any? {|f| text_file =~ /#{f}$/}
         
     | 
| 
       400 
     | 
    
         
            -
                basename = text_file.sub(/\.text$/, '')
         
     | 
| 
       401 
     | 
    
         
            -
             
     | 
| 
       402 
     | 
    
         
            -
                html_file = [(".html.19" if RUBY_VERSION >= '1.9'), ".html"].compact.
         
     | 
| 
       403 
     | 
    
         
            -
                  map {|ext| basename + ext }.
         
     | 
| 
       404 
     | 
    
         
            -
                  detect {|file| File.exist?(file) }
         
     | 
| 
       405 
     | 
    
         
            -
                next unless html_file
         
     | 
| 
       406 
     | 
    
         
            -
             
     | 
| 
       407 
     | 
    
         
            -
                define_method('test_gfm_' + text_file.tr('.', '_') + "_to_html") do
         
     | 
| 
       408 
     | 
    
         
            -
                  opts_file = basename + '.options'
         
     | 
| 
       409 
     | 
    
         
            -
                  opts_file = File.join(File.dirname(html_file), 'options') if !File.exist?(opts_file)
         
     | 
| 
       410 
     | 
    
         
            -
                  options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :footnote_nr => 1}
         
     | 
| 
       411 
     | 
    
         
            -
                  doc = Kramdown::Document.new(File.read(text_file), options.merge(:input => 'GFM'))
         
     | 
| 
       412 
     | 
    
         
            -
                  assert_equal(File.read(html_file), doc.to_html)
         
     | 
| 
       413 
     | 
    
         
            -
                end
         
     | 
| 
       414 
     | 
    
         
            -
              end
         
     | 
| 
       415 
     | 
    
         
            -
             
     | 
| 
       416 
     | 
    
         
            -
             
     | 
| 
       417 
     | 
    
         
            -
              EXCLUDE_PDF_MODIFY = ['test/testcases/span/text_substitutions/entities.text',
         
     | 
| 
       418 
     | 
    
         
            -
                                    'test/testcases/span/text_substitutions/entities_numeric.text',
         
     | 
| 
       419 
     | 
    
         
            -
                                    'test/testcases/span/text_substitutions/entities_as_char.text',
         
     | 
| 
       420 
     | 
    
         
            -
                                    'test/testcases/span/text_substitutions/entities_as_input.text',
         
     | 
| 
       421 
     | 
    
         
            -
                                    'test/testcases/span/text_substitutions/entities_symbolic.text',
         
     | 
| 
       422 
     | 
    
         
            -
                                    'test/testcases/block/04_header/with_auto_ids.text',
         
     | 
| 
       423 
     | 
    
         
            -
                                   ].compact
         
     | 
| 
       424 
     | 
    
         
            -
             
     | 
| 
       425 
     | 
    
         
            -
              EXCLUDE_MODIFY = ['test/testcases/block/06_codeblock/rouge/multiple.text', # bc of HTMLFormater in options
         
     | 
| 
       426 
     | 
    
         
            -
                                ('test/testcases/block/15_math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       427 
     | 
    
         
            -
                                ('test/testcases/span/math/sskatex.text' unless SSKATEX_AVAILABLE),
         
     | 
| 
       428 
     | 
    
         
            -
                                ('test/testcases/block/15_math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       429 
     | 
    
         
            -
                                ('test/testcases/span/math/katex.text' unless KATEX_AVAILABLE),
         
     | 
| 
       430 
     | 
    
         
            -
                               ].compact
         
     | 
| 
      
 252 
     | 
    
         
            +
              EXCLUDE_MODIFY = [
         
     | 
| 
      
 253 
     | 
    
         
            +
                'test/testcases/block/06_codeblock/rouge/multiple.text', # bc of HTMLFormater in options
         
     | 
| 
      
 254 
     | 
    
         
            +
              ].compact
         
     | 
| 
       431 
255 
     | 
    
         | 
| 
       432 
256 
     | 
    
         
             
              # Generate test methods for asserting that converters don't modify the document tree.
         
     | 
| 
       433 
257 
     | 
    
         
             
              Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
         
     | 
| 
       434 
258 
     | 
    
         
             
                opts_file = text_file.sub(/\.text$/, '.options')
         
     | 
| 
       435 
     | 
    
         
            -
                options = File.exist?(opts_file) ? YAML 
     | 
| 
       436 
     | 
    
         
            -
                (Kramdown::Converter.constants.map 
     | 
| 
       437 
     | 
    
         
            -
             
     | 
| 
       438 
     | 
    
         
            -
                  next if  
     | 
| 
      
 259 
     | 
    
         
            +
                options = File.exist?(opts_file) ? YAML.load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
         
     | 
| 
      
 260 
     | 
    
         
            +
                (Kramdown::Converter.constants.map(&:to_sym) -
         
     | 
| 
      
 261 
     | 
    
         
            +
                 [:Base, :RemoveHtmlTags, :MathEngine, :SyntaxHighlighter]).each do |conv_class|
         
     | 
| 
      
 262 
     | 
    
         
            +
                  next if EXCLUDE_MODIFY.any? {|f| text_file =~ /#{f}$/ }
         
     | 
| 
       439 
263 
     | 
    
         
             
                  define_method("test_whether_#{conv_class}_modifies_tree_with_file_#{text_file.tr('.', '_')}") do
         
     | 
| 
       440 
264 
     | 
    
         
             
                    doc = Kramdown::Document.new(File.read(text_file), options)
         
     | 
| 
       441 
265 
     | 
    
         
             
                    options_before = Marshal.load(Marshal.dump(doc.options))
         
     |