kramdown 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kramdown might be problematic. Click here for more details.

Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTERS +3 -1
  3. data/README.md +6 -6
  4. data/Rakefile +3 -3
  5. data/VERSION +1 -1
  6. data/bin/kramdown +1 -1
  7. data/doc/default.template +2 -2
  8. data/doc/index.page +21 -7
  9. data/doc/options.page +42 -3
  10. data/doc/sidebar.template +0 -7
  11. data/doc/sitemap.sitemap +5 -0
  12. data/doc/syntax.page +31 -3
  13. data/doc/virtual +3 -0
  14. data/lib/kramdown.rb +1 -1
  15. data/lib/kramdown/compatibility.rb +1 -1
  16. data/lib/kramdown/converter.rb +1 -1
  17. data/lib/kramdown/converter/base.rb +2 -1
  18. data/lib/kramdown/converter/html.rb +10 -5
  19. data/lib/kramdown/converter/kramdown.rb +13 -7
  20. data/lib/kramdown/converter/latex.rb +2 -1
  21. data/lib/kramdown/converter/math_engine/itex2mml.rb +1 -1
  22. data/lib/kramdown/converter/math_engine/mathjax.rb +18 -3
  23. data/lib/kramdown/converter/math_engine/ritex.rb +1 -1
  24. data/lib/kramdown/converter/pdf.rb +3 -2
  25. data/lib/kramdown/converter/remove_html_tags.rb +3 -1
  26. data/lib/kramdown/converter/syntax_highlighter.rb +53 -0
  27. data/lib/kramdown/converter/syntax_highlighter/coderay.rb +1 -1
  28. data/lib/kramdown/converter/syntax_highlighter/rouge.rb +2 -2
  29. data/lib/kramdown/converter/toc.rb +2 -2
  30. data/lib/kramdown/document.rb +5 -5
  31. data/lib/kramdown/element.rb +4 -1
  32. data/lib/kramdown/error.rb +1 -1
  33. data/lib/kramdown/options.rb +4 -3
  34. data/lib/kramdown/parser.rb +1 -1
  35. data/lib/kramdown/parser/base.rb +8 -4
  36. data/lib/kramdown/parser/gfm.rb +9 -1
  37. data/lib/kramdown/parser/html.rb +18 -3
  38. data/lib/kramdown/parser/kramdown.rb +8 -5
  39. data/lib/kramdown/parser/kramdown/abbreviation.rb +10 -2
  40. data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
  41. data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
  42. data/lib/kramdown/parser/kramdown/block_boundary.rb +1 -1
  43. data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
  44. data/lib/kramdown/parser/kramdown/codeblock.rb +1 -1
  45. data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
  46. data/lib/kramdown/parser/kramdown/emphasis.rb +2 -2
  47. data/lib/kramdown/parser/kramdown/eob.rb +1 -1
  48. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  49. data/lib/kramdown/parser/kramdown/extensions.rb +8 -7
  50. data/lib/kramdown/parser/kramdown/footnote.rb +11 -4
  51. data/lib/kramdown/parser/kramdown/header.rb +1 -1
  52. data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
  53. data/lib/kramdown/parser/kramdown/html.rb +7 -4
  54. data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
  55. data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
  56. data/lib/kramdown/parser/kramdown/link.rb +8 -5
  57. data/lib/kramdown/parser/kramdown/list.rb +12 -7
  58. data/lib/kramdown/parser/kramdown/math.rb +3 -3
  59. data/lib/kramdown/parser/kramdown/paragraph.rb +3 -3
  60. data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
  61. data/lib/kramdown/parser/kramdown/table.rb +1 -1
  62. data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
  63. data/lib/kramdown/parser/markdown.rb +2 -2
  64. data/lib/kramdown/utils.rb +1 -1
  65. data/lib/kramdown/utils/configurable.rb +1 -1
  66. data/lib/kramdown/utils/entities.rb +1 -1
  67. data/lib/kramdown/utils/html.rb +3 -1
  68. data/lib/kramdown/utils/ordered_hash.rb +1 -1
  69. data/lib/kramdown/utils/string_scanner.rb +8 -0
  70. data/lib/kramdown/utils/unidecoder.rb +1 -1
  71. data/lib/kramdown/version.rb +2 -2
  72. data/man/man1/kramdown.1 +1 -1
  73. data/test/run_tests.rb +1 -1
  74. data/test/test_files.rb +48 -17
  75. data/test/test_location.rb +8 -0
  76. data/test/test_string_scanner_kramdown.rb +8 -0
  77. data/test/testcases/block/04_header/atx_header.html +1 -1
  78. data/test/testcases/block/06_codeblock/highlighting-rouge.html +2 -2
  79. data/test/testcases/block/09_html/html_after_block.html +7 -0
  80. data/test/testcases/block/09_html/html_after_block.text +5 -0
  81. data/test/testcases/block/11_ial/simple.html +3 -1
  82. data/test/testcases/block/11_ial/simple.text +5 -1
  83. data/test/testcases/block/15_math/gh_128.html +1 -1
  84. data/test/testcases/block/15_math/mathjax_preview.html +4 -0
  85. data/test/testcases/block/15_math/mathjax_preview.options +2 -0
  86. data/test/testcases/block/15_math/mathjax_preview.text +5 -0
  87. data/test/testcases/block/15_math/mathjax_preview_simple.html +4 -0
  88. data/test/testcases/block/15_math/mathjax_preview_simple.options +2 -0
  89. data/test/testcases/block/15_math/mathjax_preview_simple.text +5 -0
  90. data/test/testcases/block/15_math/normal.html +1 -1
  91. data/test/testcases/block/16_toc/toc_exclude.html +7 -7
  92. data/test/testcases/block/16_toc/toc_levels.html +4 -4
  93. data/test/testcases/block/16_toc/toc_with_footnotes.html +1 -1
  94. data/test/testcases/span/01_link/empty_title.htmlinput +3 -0
  95. data/test/testcases/span/01_link/empty_title.text +7 -0
  96. data/test/testcases/span/01_link/link_defs_with_ial.html +4 -0
  97. data/test/testcases/span/01_link/link_defs_with_ial.text +16 -0
  98. data/test/testcases/span/02_emphasis/normal.html +2 -0
  99. data/test/testcases/span/02_emphasis/normal.text +2 -0
  100. data/test/testcases/span/04_footnote/markers.text +1 -0
  101. data/test/testcases/span/abbreviations/abbrev.html +3 -1
  102. data/test/testcases/span/abbreviations/abbrev.text +7 -0
  103. data/test/testcases/span/line_breaks/normal.html +2 -2
  104. data/test/testcases/span/line_breaks/normal.latex +2 -2
  105. metadata +20 -6
@@ -1,13 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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
10
  require 'set'
11
+ require 'kramdown/converter'
11
12
 
12
13
  module Kramdown
13
14
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -20,11 +20,26 @@ module Kramdown::Converter::MathEngine
20
20
  text = (el.value =~ /<|&/ ? "% <![CDATA[\n#{el.value} %]]>" : el.value)
21
21
  text.gsub!(/<\/?script>?/, '')
22
22
 
23
+ preview = preview_string(converter, el, opts)
24
+
23
25
  attr = {:type => "math/tex#{type == :block ? '; mode=display' : ''}"}
24
26
  if type == :block
25
- converter.format_as_block_html('script', attr, text, opts[:indent])
27
+ preview << converter.format_as_block_html('script', attr, text, opts[:indent])
28
+ else
29
+ preview << converter.format_as_span_html('script', attr, text)
30
+ end
31
+ end
32
+
33
+ def self.preview_string(converter, el, opts)
34
+ preview = converter.options[:math_engine_opts][:preview]
35
+ return '' unless preview
36
+
37
+ preview = (preview == true ? converter.escape_html(el.value) : preview.to_s)
38
+
39
+ if el.options[:category] == :block
40
+ converter.format_as_block_html('div', {'class' => 'MathJax_Preview'}, preview, opts[:indent])
26
41
  else
27
- converter.format_as_span_html('script', attr, text)
42
+ converter.format_as_span_html('span', {'class' => 'MathJax_Preview'}, preview)
28
43
  end
29
44
  end
30
45
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -9,7 +9,8 @@
9
9
 
10
10
  require 'prawn'
11
11
  require 'prawn/table'
12
- require 'kramdown/utils/entities'
12
+ require 'kramdown/converter'
13
+ require 'kramdown/utils'
13
14
  require 'open-uri'
14
15
 
15
16
  module Kramdown
@@ -1,12 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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
+ require 'kramdown/converter'
11
+
10
12
  module Kramdown
11
13
 
12
14
  module Converter
@@ -0,0 +1,53 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+
10
+ module Kramdown
11
+ module Converter
12
+
13
+ # == Container for Syntax Highlighters
14
+ #
15
+ # This module serves as container for the syntax highlighters that can be used together with
16
+ # kramdown.
17
+ #
18
+ # A syntax highlighter should not store any data itself but should use the provided converter
19
+ # object to do so (See Kramdown::Converter::Base#data).
20
+ #
21
+ # == Implementing a Syntax Highlighter
22
+ #
23
+ # Implementing a new syntax highlighter is easy because it is just an object that needs to
24
+ # respond to #call.
25
+ #
26
+ # The method #call needs to take the following arguments:
27
+ #
28
+ # converter:: This argument contains the converter object that calls the syntax highlighter. It
29
+ # can be used, for example, to store data in Kramdown::Converter::Base#data for one
30
+ # conversion run.
31
+ #
32
+ # text:: The raw text that should be highlighted.
33
+ #
34
+ # lang:: The language that the text should be highlighted for (e.g. ruby, python, ...).
35
+ #
36
+ # type:: The type of text, either :span for span-level code or :block for a codeblock.
37
+ #
38
+ # opts:: A Hash with options that may be passed from the converter.
39
+ #
40
+ # The return value of the method should be the highlighted text, suitable for the given
41
+ # converter (e.g. HTML for the HTML converter).
42
+ #
43
+ # == Special Implementation Details
44
+ #
45
+ # HTML converter:: If the syntax highlighter is used with a HTML converter, it should return
46
+ # :block type text correctly wrapped (i.e. normally inside a pre-tag, but may
47
+ # also be a table-tag or just a div-tag) but :span type text *without* a
48
+ # code-tag!
49
+ module SyntaxHighlighter
50
+ end
51
+
52
+ end
53
+ end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -28,7 +28,7 @@ module Kramdown::Converter::SyntaxHighlighter
28
28
 
29
29
  opts[:wrap] = false if type == :span
30
30
 
31
- formatter = ::Rouge::Formatters::HTML.new(opts)
31
+ formatter = (opts.delete(:formatter) || ::Rouge::Formatters::HTML).new(opts)
32
32
  formatter.format(lexer.lex(text))
33
33
  end
34
34
 
@@ -1,13 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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
- require 'rexml/parsers/baseparser'
10
+ require 'kramdown/converter'
11
11
 
12
12
  module Kramdown
13
13
 
@@ -1,29 +1,29 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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
  # = kramdown
10
10
  #
11
- # kramdown is yet-another-markdown-parser but fast, pure Ruby, using a strict syntax definition and
11
+ # kramdown is fast, pure Ruby Markdown superset converter, using a strict syntax definition and
12
12
  # supporting several common extensions.
13
13
  #
14
14
  # The kramdown library is mainly written to support the kramdown-to-HTML conversion chain. However,
15
15
  # due to its flexibility it supports other input and output formats as well. Here is a list of the
16
16
  # supported formats:
17
17
  #
18
- # * input formats: kramdown (a Markdown superset), Markdown, HTML
19
- # * output formats: HTML, kramdown, LaTeX (and therefore PDF)
18
+ # * input formats: kramdown (a Markdown superset), Markdown, GFM, HTML
19
+ # * output formats: HTML, kramdown, LaTeX (and therefore PDF), PDF via Prawn
20
20
  #
21
21
  # All the documentation on the available input and output formats is available at
22
22
  # http://kramdown.gettalong.org.
23
23
  #
24
24
  # == Usage
25
25
  #
26
- # kramdown has a basic *Cloth API, so using kramdown is as easy as
26
+ # kramdown has a simple API, so using kramdown is as easy as
27
27
  #
28
28
  # require 'kramdown'
29
29
  #
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -37,6 +37,9 @@ module Kramdown
37
37
  # :abbrev_defs:: This key may be used to store the mapping of abbreviation to abbreviation
38
38
  # definition.
39
39
  #
40
+ # :abbrev_attr:: This key may be used to store the mapping of abbreviation to abbreviation
41
+ # attributes.
42
+ #
40
43
  # :options:: This key may be used to store options that were set during parsing of the document.
41
44
  #
42
45
  #
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -418,7 +418,8 @@ specified levels are used for the table of contents.
418
418
  Default: 1..6
419
419
  Used by: HTML/Latex converter
420
420
  EOF
421
- if String === val
421
+ case val
422
+ when String
422
423
  if val =~ /^(\d)\.\.(\d)$/
423
424
  val = Range.new($1.to_i, $2.to_i).to_a
424
425
  elsif val =~ /^\d(?:,\d)*$/
@@ -426,7 +427,7 @@ EOF
426
427
  else
427
428
  raise Kramdown::Error, "Invalid syntax for option toc_levels"
428
429
  end
429
- elsif Array === val
430
+ when Array, Range
430
431
  val = val.map {|s| s.to_i}.uniq
431
432
  else
432
433
  raise Kramdown::Error, "Invalid type #{val.class} for option toc_levels"
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,13 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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
- require 'kramdown/utils/string_scanner'
10
+ require 'kramdown/utils'
11
+ require 'kramdown/parser'
11
12
 
12
13
  module Kramdown
13
14
 
@@ -51,7 +52,8 @@ module Kramdown
51
52
  def initialize(source, options)
52
53
  @source = source
53
54
  @options = Kramdown::Options.merge(options)
54
- @root = Element.new(:root, nil, nil, :encoding => (source.encoding rescue nil), :location => 1)
55
+ @root = Element.new(:root, nil, nil, :encoding => (source.encoding rescue nil), :location => 1,
56
+ :options => {}, :abbrev_defs => {}, :abbrev_attr => {})
55
57
  @warnings = []
56
58
  @text_type = :text
57
59
  end
@@ -88,7 +90,9 @@ module Kramdown
88
90
  # +\n+ and makes sure +source+ ends with a new line character).
89
91
  def adapt_source(source)
90
92
  if source.respond_to?(:encode)
91
- raise "The encoding of the source text is not valid!" if !source.valid_encoding?
93
+ if !source.valid_encoding?
94
+ raise "The source text contains invalid characters for the used encoding #{source.encoding}"
95
+ end
92
96
  source = source.encode('UTF-8')
93
97
  end
94
98
  source.gsub(/\r\n?/, "\n").chomp + "\n"
@@ -1,6 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
2
9
 
3
- require 'kramdown/parser/kramdown'
10
+
11
+ require 'kramdown/parser'
4
12
 
5
13
  module Kramdown
6
14
  module Parser
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 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,7 @@
10
10
  require 'rexml/parsers/baseparser'
11
11
  require 'strscan'
12
12
  require 'kramdown/utils'
13
+ require 'kramdown/parser'
13
14
 
14
15
  module Kramdown
15
16
 
@@ -78,8 +79,7 @@ module Kramdown
78
79
  def handle_html_start_tag(line = nil) # :yields: el, closed, handle_body
79
80
  name = @src[1].downcase
80
81
  closed = !@src[4].nil?
81
- attrs = Utils::OrderedHash.new
82
- @src[2].scan(HTML_ATTRIBUTE_RE).each {|attr,sep,val| attrs[attr.downcase] = val || ""}
82
+ attrs = parse_html_attributes(@src[2], line)
83
83
 
84
84
  el = Element.new(:html_element, name, attrs, :category => :block)
85
85
  el.options[:location] = line if line
@@ -97,6 +97,21 @@ module Kramdown
97
97
  end
98
98
  end
99
99
 
100
+ # Parses the given string for HTML attributes and returns the resulting hash.
101
+ #
102
+ # If the optional +line+ parameter is supplied, it is used in warning messages.
103
+ def parse_html_attributes(str, line = nil)
104
+ attrs = Utils::OrderedHash.new
105
+ str.scan(HTML_ATTRIBUTE_RE).each do |attr, sep, val|
106
+ attr.downcase!
107
+ if attrs.has_key?(attr)
108
+ warning("Duplicate HTML attribute '#{attr}' on line #{line || '?'} - overwriting previous one")
109
+ end
110
+ attrs[attr] = val || ""
111
+ end
112
+ attrs
113
+ end
114
+
100
115
  # Handle the raw HTML tag at the current position.
101
116
  def handle_raw_html_tag(name)
102
117
  curpos = @src.pos
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -9,6 +9,7 @@
9
9
 
10
10
  require 'strscan'
11
11
  require 'stringio'
12
+ require 'kramdown/parser'
12
13
 
13
14
  #TODO: use [[:alpha:]] in all regexp to allow parsing of international values in 1.9.1
14
15
  #NOTE: use @src.pre_match only before other check/match?/... operations, otherwise the content is changed
@@ -66,7 +67,6 @@ module Kramdown
66
67
 
67
68
  reset_env
68
69
 
69
- @root.options[:abbrev_defs] = {}
70
70
  @alds = {}
71
71
  @footnotes = {}
72
72
  @link_defs = {}
@@ -88,6 +88,7 @@ module Kramdown
88
88
  configure_parser
89
89
  parse_blocks(@root, adapt_source(source))
90
90
  update_tree(@root)
91
+ correct_abbreviations_attributes
91
92
  replace_abbreviations(@root)
92
93
  @footnotes.each {|name,data| update_tree(data[:content])}
93
94
  end
@@ -134,7 +135,6 @@ module Kramdown
134
135
 
135
136
  status = catch(:stop_block_parsing) do
136
137
  while !@src.eos?
137
- block_ial_set = @block_ial
138
138
  @block_parsers.any? do |name|
139
139
  if @src.check(@parsers[name].start_re)
140
140
  send(@parsers[name].method)
@@ -145,7 +145,6 @@ module Kramdown
145
145
  warning('Warning: this should not occur - no block parser handled the line')
146
146
  add_text(@src.scan(/.*\n/))
147
147
  end
148
- @block_ial = nil if block_ial_set
149
148
  end
150
149
  end
151
150
 
@@ -165,6 +164,7 @@ module Kramdown
165
164
  parse_spans(child)
166
165
  child.children
167
166
  elsif child.type == :eob
167
+ update_attr_with_ial(child.attr, child.options[:ial]) if child.options[:ial]
168
168
  []
169
169
  elsif child.type == :blank
170
170
  if last_blank
@@ -290,7 +290,10 @@ module Kramdown
290
290
  # exists. This method should always be used for creating a block-level element!
291
291
  def new_block_el(*args)
292
292
  el = Element.new(*args)
293
- el.options[:ial] = @block_ial if @block_ial && el.type != :blank && el.type != :eob
293
+ if @block_ial
294
+ el.options[:ial] = @block_ial
295
+ @block_ial = nil
296
+ end
294
297
  el
295
298
  end
296
299