[DRE-commits] [ruby-kramdown] 01/03: Imported Upstream version 1.4.1

Youhei SASAKI uwabami-guest at moszumanska.debian.org
Mon Aug 11 18:38:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

uwabami-guest pushed a commit to annotated tag debian/1.4.1-1
in repository ruby-kramdown.

commit 92486047d8dd17a2f770665b6f450c3f9e29770f
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Tue Aug 12 03:36:06 2014 +0900

    Imported Upstream version 1.4.1
---
 CONTRIBUTERS                               |   5 ++++-
 VERSION                                    |   2 +-
 bin/kramdown                               |   4 ++--
 checksums.yaml.gz                          | Bin 267 -> 267 bytes
 doc/sidebar.template                       |   4 ++--
 doc/syntax.page                            |   2 +-
 lib/kramdown/converter/latex.rb            |   5 +++--
 lib/kramdown/converter/pdf.rb              |  15 ++++++++++-----
 lib/kramdown/parser/html.rb                |  27 +++++++++++++++++++--------
 lib/kramdown/parser/kramdown/footnote.rb   |   2 +-
 lib/kramdown/parser/kramdown/html.rb       |  28 +++++++++++++++-------------
 lib/kramdown/parser/kramdown/link.rb       |   4 ++--
 lib/kramdown/parser/kramdown/table.rb      |   2 +-
 lib/kramdown/version.rb                    |   2 +-
 metadata.yml                               |   6 ++++--
 test/testcases/block/09_html/textarea.html |   8 ++++++++
 test/testcases/block/09_html/textarea.text |   8 ++++++++
 test/testcases/span/05_html/normal.html    |   2 ++
 test/testcases/span/05_html/normal.text    |   2 ++
 19 files changed, 86 insertions(+), 42 deletions(-)

diff --git a/CONTRIBUTERS b/CONTRIBUTERS
index 0795ad7..f2dd78f 100644
--- a/CONTRIBUTERS
+++ b/CONTRIBUTERS
@@ -1,6 +1,6 @@
   Count Name
 ======= ====
-    676 Thomas Leitner <t_leitner at gmx.at>
+    681 Thomas Leitner <t_leitner at gmx.at>
       6 Gioele Barabucci <gioele at svario.it>
       4 Ted Pak <powerpak006 at gmail.com>
       4 Arne Brasseur <arne at arnebrasseur.net>
@@ -12,12 +12,15 @@
       2 Nathanael Jones <nathanael.jones at gmail.com>
       2 Jo Hund <jhund at clearcove.ca>
       2 Bran <m.versum at gmail.com>
+      1 utenmiki <utenmiki at gmail.com>
       1 Trevor Wennblom <trevor at well.com>
       1 tomykaira <tomykaira at gmail.com>
+      1 Tim Blair <tim at bla.ir>
       1 Tim Besard <tim.besard at gmail.com>
       1 Tim Bates <tim at rumpuslabs.com>
       1 Simon Lydell <simon.lydell at gmail.com>
       1 Shusaku NAKAZATO <cu393uc at gmail.com>
+      1 Sebastian Boehm <sebastian at sometimesfood.org>
       1 Postmodern <postmodern.mod3 at gmail.com>
       1 Pete Michaud <michaudp at gmail.com>
       1 myqlarson <myqlarson at gmail.com>
diff --git a/VERSION b/VERSION
index 88c5fb8..347f583 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.4.0
+1.4.1
diff --git a/bin/kramdown b/bin/kramdown
index 89bff8a..870c997 100755
--- a/bin/kramdown
+++ b/bin/kramdown
@@ -21,8 +21,8 @@ OptionParser.new do |opts|
   opts.separator "Command line options:"
   opts.separator ""
 
-  opts.on("-i", "--input ARG", "Specify the input format: kramdown (default) or html") {|v| options[:input] = v}
-  opts.on("-o", "--output ARG", Array, "Specify one or more output formats separated by commas: html (default), kramdown, latex or remove_html_tags") {|v| format = v}
+  opts.on("-i", "--input ARG", "Specify the input format: kramdown (default), html, GFM or markdown") {|v| options[:input] = v}
+  opts.on("-o", "--output ARG", Array, "Specify one or more output formats separated by commas: html (default), kramdown, latex, pdf or remove_html_tags") {|v| format = v}
 
   opts.on("-v", "--version", "Show the version of kramdown") do
     puts Kramdown::VERSION
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
index 25a8ff5..fb132dd 100644
Binary files a/checksums.yaml.gz and b/checksums.yaml.gz differ
diff --git a/doc/sidebar.template b/doc/sidebar.template
index 5557b1a..eee5470 100644
--- a/doc/sidebar.template
+++ b/doc/sidebar.template
@@ -1,7 +1,7 @@
 <h2>News</h2>
 
-<p>The latest version of kramdown is <span class="inline-important">1.4.0</span> and it was released
-on <span class="inline-important">2014-06-18</span></p>
+<p>The latest version of kramdown is <span class="inline-important">1.4.1</span> and it was released
+on <span class="inline-important">2014-08-02</span></p>
 
 <p>More <a href="{relocatable: news.html}">news</a>…</p>
 
diff --git a/doc/syntax.page b/doc/syntax.page
index 976bc56..94133d2 100644
--- a/doc/syntax.page
+++ b/doc/syntax.page
@@ -936,7 +936,7 @@ inline math statement, you need to escape the first dollar sign:
 
     \$$ 5 + 5 $$
 
-If you don't even won't the inline math statement, escape the first two dollar signs:
+If you don't even want the inline math statement, escape the first two dollar signs:
 
     \$\$ 5 + 5 $$
 
diff --git a/lib/kramdown/converter/latex.rb b/lib/kramdown/converter/latex.rb
index 00e7ae2..2d720fe 100644
--- a/lib/kramdown/converter/latex.rb
+++ b/lib/kramdown/converter/latex.rb
@@ -213,14 +213,15 @@ module Kramdown
       end
 
       def convert_img(el, opts)
+        line = el.options[:location]
         if el.attr['src'] =~ /^(https?|ftps?):\/\//
-          warning("Cannot include non-local image")
+          warning("Cannot include non-local image#{line ? " (line #{line})" : ''}")
           ''
         elsif !el.attr['src'].empty?
           @data[:packages] << 'graphicx'
           "#{latex_link_target(el)}\\includegraphics{#{el.attr['src']}}"
         else
-          warning("Cannot include image with empty path")
+          warning("Cannot include image with empty path#{line ? " (line #{line})" : ''}")
           ''
         end
       end
diff --git a/lib/kramdown/converter/pdf.rb b/lib/kramdown/converter/pdf.rb
index 808169b..90042f1 100644
--- a/lib/kramdown/converter/pdf.rb
+++ b/lib/kramdown/converter/pdf.rb
@@ -8,6 +8,7 @@
 #
 
 require 'prawn'
+require 'prawn/table'
 require 'kramdown/utils/entities'
 require 'open-uri'
 
@@ -139,12 +140,13 @@ module Kramdown
 
       def render_standalone_image(el, opts)
         img = el.children.first
+        line = img.options[:location]
 
         if img.attr['src'].empty?
-          warning("Rendering an image without a source is not possible")
+          warning("Rendering an image without a source is not possible#{line ? " (line #{line})" : ''}")
           return nil
         elsif img.attr['src'] !~ /\.jpe?g$|\.png$/
-          warning("Cannot render images other than JPEG or PNG, got #{img.attr['src']}")
+          warning("Cannot render images other than JPEG or PNG, got #{img.attr['src']}#{line ? " on line #{line}" : ''}")
           return nil
         end
 
@@ -287,7 +289,8 @@ module Kramdown
             data << []
             row.children.each do |cell|
               if cell.children.any? {|child| child.options[:category] == :block}
-                warning("Can't render tables with cells containing block elements")
+                line = el.options[:location]
+                warning("Can't render tables with cells containing block elements#{line ? " (line #{line})" : ''}")
                 return
               end
               cell_data = inner(cell, opts)
@@ -404,7 +407,8 @@ module Kramdown
       end
 
       def render_img(el, *args) #:nodoc:
-        warning("Rendering span images is not supported for PDF converter")
+        line = el.options[:location]
+        warning("Rendering span images is not supported for PDF converter#{line ? " (line #{line})" : ''}")
         nil
       end
 
@@ -428,7 +432,8 @@ module Kramdown
       alias_method :render_blank, :render_xml_comment
 
       def render_footnote(el, *args) #:nodoc:
-        warning("Rendering #{el.type} not supported for PDF converter")
+        line = el.options[:location]
+        warning("Rendering #{el.type} not supported for PDF converter#{line ? " (line #{line})" : ''}")
         nil
       end
       alias_method :render_raw, :render_footnote
diff --git a/lib/kramdown/parser/html.rb b/lib/kramdown/parser/html.rb
index 6ceffef..0b5fdfa 100644
--- a/lib/kramdown/parser/html.rb
+++ b/lib/kramdown/parser/html.rb
@@ -50,9 +50,10 @@ module Kramdown
 
         # Some HTML elements like script belong to both categories (i.e. are valid in block and
         # span HTML) and don't appear therefore!
+        # script, textarea
         HTML_SPAN_ELEMENTS = %w{a abbr acronym b big bdo br button cite code del dfn em i img input
                               ins kbd label option q rb rbc rp rt rtc ruby samp select small span
-                              strong sub sup textarea tt var}
+                              strong sub sup tt u var}
         HTML_BLOCK_ELEMENTS = %w{address article aside applet body button blockquote caption col colgroup dd div dl dt fieldset
                                figcaption footer form h1 h2 h3 h4 h5 h6 header hgroup hr html head iframe legend menu
                                li map nav ol optgroup p pre section summary table tbody td th thead tfoot tr ul}
@@ -74,17 +75,18 @@ module Kramdown
         # (first parameter is the created element; the second parameter is +true+ if the HTML
         # element is already closed, ie. contains no body; the third parameter specifies whether the
         # body - and the end tag - need to be handled in case closed=false).
-        def handle_html_start_tag # :yields: el, closed, handle_body
+        def handle_html_start_tag(line = nil) # :yields: el, closed, handle_body
           name = @src[1].downcase
           closed = !@src[4].nil?
           attrs = Utils::OrderedHash.new
           @src[2].scan(HTML_ATTRIBUTE_RE).each {|attr,sep,val| attrs[attr.downcase] = val || ""}
 
           el = Element.new(:html_element, name, attrs, :category => :block)
+          el.options[:location] = line if line
           @tree.children << el
 
           if !closed && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
-            warning("The HTML tag '#{el.value}' cannot have any content - auto-closing it")
+            warning("The HTML tag '#{el.value}' on line #{line} cannot have any content - auto-closing it")
             closed = true
           end
           if name == 'script' || name == 'style'
@@ -127,17 +129,22 @@ module Kramdown
           while !@src.eos? && !done
             if result = @src.scan_until(HTML_RAW_START)
               add_text(result, @tree, :text)
+              line = @src.current_line_number
               if result = @src.scan(HTML_COMMENT_RE)
-                @tree.children << Element.new(:xml_comment, result, nil, :category => :block)
+                @tree.children << Element.new(:xml_comment, result, nil, :category => :block, :location => line)
               elsif result = @src.scan(HTML_INSTRUCTION_RE)
-                @tree.children << Element.new(:xml_pi, result, nil, :category => :block)
+                @tree.children << Element.new(:xml_pi, result, nil, :category => :block, :location => line)
               elsif @src.scan(HTML_TAG_RE)
-                handle_html_start_tag(&block)
+                if method(:handle_html_start_tag).arity == 1
+                  handle_html_start_tag(line, &block)
+                else
+                  handle_html_start_tag(&block) # DEPRECATED: method needs to accept line number in 2.0
+                end
               elsif @src.scan(HTML_TAG_CLOSE_RE)
                 if @tree.value == @src[1].downcase
                   done = true
                 else
-                  warning("Found invalidly used HTML closing tag for '#{@src[1].downcase}' - ignoring it")
+                  warning("Found invalidly used HTML closing tag for '#{@src[1].downcase}' on line #{line} - ignoring it")
                 end
               else
                 add_text(@src.getch, @tree, :text)
@@ -145,7 +152,7 @@ module Kramdown
             else
               add_text(@src.rest, @tree, :text)
               @src.terminate
-              warning("Found no end tag for '#{@tree.value}' - auto-closing it") if @tree.type == :html_element
+              warning("Found no end tag for '#{@tree.value}' on line #{@tree.options[:location]} - auto-closing it") if @tree.type == :html_element
               done = true
             end
           end
@@ -330,6 +337,10 @@ module Kramdown
           el.children.each {|c| extract_text(c, raw)}
         end
 
+        def convert_textarea(el)
+          process_html_element(el, true, true)
+        end
+
         def convert_a(el)
           if el.attr['href']
             set_basics(el, :a)
diff --git a/lib/kramdown/parser/kramdown/footnote.rb b/lib/kramdown/parser/kramdown/footnote.rb
index ac801f3..78edd53 100644
--- a/lib/kramdown/parser/kramdown/footnote.rb
+++ b/lib/kramdown/parser/kramdown/footnote.rb
@@ -24,7 +24,7 @@ module Kramdown
 
         el = Element.new(:footnote_def, nil, nil, :location => start_line_number)
         parse_blocks(el, @src[2].gsub(INDENT, ''))
-        warning("Duplicate footnote name '#{@src[1]}' - overwriting") if @footnotes[@src[1]]
+        warning("Duplicate footnote name '#{@src[1]}' on line #{start_line_number} - overwriting") if @footnotes[@src[1]]
         (@footnotes[@src[1]] = {})[:content] = el
         @tree.children << Element.new(:eob, :footnote_def, nil, :location => start_line_number)
         true
diff --git a/lib/kramdown/parser/kramdown/html.rb b/lib/kramdown/parser/kramdown/html.rb
index 01e6a95..e71d817 100644
--- a/lib/kramdown/parser/kramdown/html.rb
+++ b/lib/kramdown/parser/kramdown/html.rb
@@ -41,7 +41,7 @@ module Kramdown
         if !closed && handle_body
           if content_model == :block
             if !parse_blocks(el)
-              warning("Found no end tag for '#{el.value}' - auto-closing it")
+              warning("Found no end tag for '#{el.value}' (line #{el.options[:location]}) - auto-closing it")
             end
           elsif content_model == :span
             curpos = @src.pos
@@ -51,7 +51,7 @@ module Kramdown
             else
               add_text(@src.rest, el)
               @src.terminate
-              warning("Found no end tag for '#{el.value}' - auto-closing it")
+              warning("Found no end tag for '#{el.value}' (line #{el.options[:location]}) - auto-closing it")
             end
           else
             parse_raw_html(el, &method(:handle_kramdown_html_tag))
@@ -65,18 +65,19 @@ module Kramdown
 
       # Parse the HTML at the current position as block-level HTML.
       def parse_block_html
+        line = @src.current_line_number
         if result = @src.scan(HTML_COMMENT_RE)
-          @tree.children << Element.new(:xml_comment, result, nil, :category => :block)
+          @tree.children << Element.new(:xml_comment, result, nil, :category => :block, :location => line)
           @src.scan(TRAILING_WHITESPACE)
           true
         elsif result = @src.scan(HTML_INSTRUCTION_RE)
-          @tree.children << Element.new(:xml_pi, result, nil, :category => :block)
+          @tree.children << Element.new(:xml_pi, result, nil, :category => :block, :location => line)
           @src.scan(TRAILING_WHITESPACE)
           true
         else
           if result = @src.check(/^#{OPT_SPACE}#{HTML_TAG_RE}/) && !HTML_SPAN_ELEMENTS.include?(@src[1].downcase)
             @src.pos += @src.matched_size
-            handle_html_start_tag(&method(:handle_kramdown_html_tag))
+            handle_html_start_tag(line, &method(:handle_kramdown_html_tag))
             Kramdown::Parser::Html::ElementConverter.convert(@root, @tree.children.last) if @options[:html_to_native]
             true
           elsif result = @src.check(/^#{OPT_SPACE}#{HTML_TAG_CLOSE_RE}/) && !HTML_SPAN_ELEMENTS.include?(@src[1].downcase)
@@ -100,17 +101,18 @@ module Kramdown
 
       # Parse the HTML at the current position as span-level HTML.
       def parse_span_html
+        line = @src.current_line_number
         if result = @src.scan(HTML_COMMENT_RE)
-          @tree.children << Element.new(:xml_comment, result, nil, :category => :span)
+          @tree.children << Element.new(:xml_comment, result, nil, :category => :span, :location => line)
         elsif result = @src.scan(HTML_INSTRUCTION_RE)
-          @tree.children << Element.new(:xml_pi, result, nil, :category => :span)
+          @tree.children << Element.new(:xml_pi, result, nil, :category => :span, :location => line)
         elsif result = @src.scan(HTML_TAG_CLOSE_RE)
-          warning("Found invalidly used HTML closing tag for '#{@src[1]}'")
+          warning("Found invalidly used HTML closing tag for '#{@src[1]}' on line #{line}")
           add_text(result)
         elsif result = @src.scan(HTML_TAG_RE)
           tag_name = @src[1].downcase
           if HTML_BLOCK_ELEMENTS.include?(tag_name)
-            warning("Found block HTML tag '#{tag_name}' in span-level text")
+            warning("Found block HTML tag '#{tag_name}' in span-level text on line #{line}")
             add_text(result)
             return
           end
@@ -121,7 +123,7 @@ module Kramdown
           do_parsing = (HTML_CONTENT_MODEL[tag_name] == :raw || @tree.options[:content_model] == :raw ? false : @options[:parse_span_html])
           if val = HTML_MARKDOWN_ATTR_MAP[attrs.delete('markdown')]
             if val == :block
-              warning("Cannot use block-level parsing in span-level HTML tag - using default mode")
+              warning("Cannot use block-level parsing in span-level HTML tag (line #{line}) - using default mode")
             elsif val == :span
               do_parsing = true
             elsif val == :default
@@ -131,17 +133,17 @@ module Kramdown
             end
           end
 
-          el = Element.new(:html_element, tag_name, attrs, :category => :span,
+          el = Element.new(:html_element, tag_name, attrs, :category => :span, :location => line,
                            :content_model => (do_parsing ? :span : :raw), :is_closed => !!@src[4])
           @tree.children << el
           stop_re = /<\/#{Regexp.escape(tag_name)}\s*>/i
           if !@src[4] && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
-            warning("The HTML tag '#{el.value}' cannot have any content - auto-closing it")
+            warning("The HTML tag '#{el.value}' on line #{line} cannot have any content - auto-closing it")
           elsif !@src[4]
             if parse_spans(el, stop_re, (do_parsing ? nil : [:span_html]))
               @src.scan(stop_re)
             else
-              warning("Found no end tag for '#{el.value}' - auto-closing it")
+              warning("Found no end tag for '#{el.value}' (line #{line}) - auto-closing it")
               add_text(@src.rest, el)
               @src.terminate
             end
diff --git a/lib/kramdown/parser/kramdown/link.rb b/lib/kramdown/parser/kramdown/link.rb
index 53cda6c..f03955a 100644
--- a/lib/kramdown/parser/kramdown/link.rb
+++ b/lib/kramdown/parser/kramdown/link.rb
@@ -15,7 +15,7 @@ module Kramdown
 
       # Normalize the link identifier.
       def normalize_link_id(id)
-        id.gsub(/[\s\n]+/, ' ').downcase
+        id.gsub(/[\s]+/, ' ').downcase
       end
 
       LINK_DEFINITION_START = /^#{OPT_SPACE}\[([^\n\]]+)\]:[ \t]*(?:<(.*?)>|([^'"\n]*?\S[^'"\n]*?))[ \t]*?(?:\n?[ \t]*?(["'])(.+?)\4[ \t]*?)?\n/
@@ -87,7 +87,7 @@ module Kramdown
           if @link_defs.has_key?(link_id)
             add_link(el, @link_defs[link_id].first, @link_defs[link_id].last, alt_text)
           else
-            warning("No link definition for link ID '#{link_id}' found")
+            warning("No link definition for link ID '#{link_id}' found on line #{start_line_number}")
             @src.pos = reset_pos
             add_text(result)
           end
diff --git a/lib/kramdown/parser/kramdown/table.rb b/lib/kramdown/parser/kramdown/table.rb
index 942c595..7f53b8c 100644
--- a/lib/kramdown/parser/kramdown/table.rb
+++ b/lib/kramdown/parser/kramdown/table.rb
@@ -140,7 +140,7 @@ module Kramdown
         add_container.call(has_footer ? :tfoot : :tbody, false) if !rows.empty?
 
         if !table.children.any? {|el| el.type == :tbody}
-          warning("Found table without body - ignoring it")
+          warning("Found table without body on line #{table.options[:location]} - ignoring it")
           @src.pos = orig_pos
           return false
         end
diff --git a/lib/kramdown/version.rb b/lib/kramdown/version.rb
index e5757af..a603fcc 100644
--- a/lib/kramdown/version.rb
+++ b/lib/kramdown/version.rb
@@ -10,6 +10,6 @@
 module Kramdown
 
   # The kramdown version.
-  VERSION = '1.4.0'
+  VERSION = '1.4.1'
 
 end
diff --git a/metadata.yml b/metadata.yml
index 9f20141..2b53100 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: kramdown
 version: !ruby/object:Gem::Version
-  version: 1.4.0
+  version: 1.4.1
 platform: ruby
 authors:
 - Thomas Leitner
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2014-06-18 00:00:00.000000000 Z
+date: 2014-08-02 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: minitest
@@ -350,6 +350,8 @@ files:
 - test/testcases/block/09_html/simple.html.19
 - test/testcases/block/09_html/simple.options
 - test/testcases/block/09_html/simple.text
+- test/testcases/block/09_html/textarea.html
+- test/testcases/block/09_html/textarea.text
 - test/testcases/block/10_ald/simple.html
 - test/testcases/block/10_ald/simple.text
 - test/testcases/block/11_ial/auto_id_and_ial.html
diff --git a/test/testcases/block/09_html/textarea.html b/test/testcases/block/09_html/textarea.html
new file mode 100644
index 0000000..6f5693e
--- /dev/null
+++ b/test/testcases/block/09_html/textarea.html
@@ -0,0 +1,8 @@
+<p>This is a <textarea>inline</textarea></p>
+
+<textarea>This
+is
+
+some
+text
+</textarea>
diff --git a/test/testcases/block/09_html/textarea.text b/test/testcases/block/09_html/textarea.text
new file mode 100644
index 0000000..a240f5c
--- /dev/null
+++ b/test/testcases/block/09_html/textarea.text
@@ -0,0 +1,8 @@
+This is a <textarea>inline</textarea>
+
+<textarea>This
+is
+
+some
+text
+</textarea>
diff --git a/test/testcases/span/05_html/normal.html b/test/testcases/span/05_html/normal.html
index 1efbee8..0da5f26 100644
--- a/test/testcases/span/05_html/normal.html
+++ b/test/testcases/span/05_html/normal.html
@@ -39,3 +39,5 @@ now </span>.</p>
 
 <p>Some <code>element with | pipe
 symbol|</code></p>
+
+<p><u>underlined</u></p>
diff --git a/test/testcases/span/05_html/normal.text b/test/testcases/span/05_html/normal.text
index 661e9c8..0156d7c 100644
--- a/test/testcases/span/05_html/normal.text
+++ b/test/testcases/span/05_html/normal.text
@@ -39,3 +39,5 @@ Some <span><code>element with | pipe symbol</code></span>
 
 Some <code>element with | pipe
 symbol|</code>
+
+<u>underlined</u>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-kramdown.git



More information about the Pkg-ruby-extras-commits mailing list