kramdown-rfc2629 1.3.9 → 1.3.14
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.
- checksums.yaml +4 -4
- data/bin/doilit +6 -0
- data/bin/kdrfc +18 -9
- data/bin/kramdown-rfc2629 +4 -2
- data/kramdown-rfc2629.gemspec +1 -1
- data/lib/kramdown-rfc2629.rb +19 -4
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: be9c46d583cac4dc5a8b951b953e25819c77298d372f710a41f527a1cf18c609
         | 
| 4 | 
            +
              data.tar.gz: 124c338b7a9c7544c7c8d91c959af382a9996b681fac87daaa07ca572facfb08
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 59e5bb9e1236669a85c392b77cc5854d0a3070049fb76add45779b70663dc2b2d185c2ca5f0a0e79148d655272656ce53cbe97498b4e625eed248cb90c744485
         | 
| 7 | 
            +
              data.tar.gz: c2cc8cbc0a52a8bfdd71535b463affca2ab5a2d9f845f295c84d5983c1861b5e7a3a0470eb3c291d31fe03e29907e16e0f55d0fac0a1ece5bcdec17bcbab2875
         | 
    
        data/bin/doilit
    CHANGED
    
    | @@ -44,6 +44,12 @@ ARGV.each do |doi| | |
| 44 44 | 
             
              lit = {}
         | 
| 45 45 | 
             
              ser = lit["seriesinfo"] = {}
         | 
| 46 46 | 
             
              lit["title"] = cite["title"]
         | 
| 47 | 
            +
              if (st = cite["subtitle"]) && Array === st # defensive
         | 
| 48 | 
            +
                st.delete('')
         | 
| 49 | 
            +
                if st != []
         | 
| 50 | 
            +
                  lit["title"] << ": " << st.join("; ")
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
              end
         | 
| 47 53 | 
             
              if authors = cite["author"]
         | 
| 48 54 | 
             
                lit["author"] = authors.map do |au|
         | 
| 49 55 | 
             
                  lau = {}
         | 
    
        data/bin/kdrfc
    CHANGED
    
    | @@ -49,16 +49,21 @@ def process_xml_locally(input, output, *flags) | |
| 49 49 | 
             
              end
         | 
| 50 50 | 
             
            end
         | 
| 51 51 |  | 
| 52 | 
            +
            XML2RFC_WEBSERVICE = ENV["KRAMDOWN_XML2RFC_WEBSERVICE"] ||
         | 
| 53 | 
            +
                                 'http://xml2rfc.tools.ietf.org/cgi-bin/xml2rfc-dev.cgi'
         | 
| 54 | 
            +
             | 
| 55 | 
            +
             | 
| 52 56 | 
             
            def process_xml_remotely(input, output)
         | 
| 53 57 | 
             
              warn "* converting remotely from xml #{input} to txt #{output}" if $options.verbose
         | 
| 54 | 
            -
              url = URI( | 
| 58 | 
            +
              url = URI(XML2RFC_WEBSERVICE)
         | 
| 55 59 | 
             
              req = Net::HTTP::Post.new(url)
         | 
| 56 | 
            -
               | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 60 | 
            +
              form = [["modeAsFormat", "txt/#{"v3" if $options.v3}ascii"],
         | 
| 61 | 
            +
                      ["type", "binary"],
         | 
| 62 | 
            +
                      ["input", File.open(input),
         | 
| 63 | 
            +
                       {filename: "input.xml",
         | 
| 64 | 
            +
                        content_type: "text/plain"}]]
         | 
| 65 | 
            +
              diag = ["url/form: ", url, form].inspect
         | 
| 66 | 
            +
              req.set_form(form, 'multipart/form-data')
         | 
| 62 67 | 
             
              res = Net::HTTP::start(url.hostname, url.port,
         | 
| 63 68 | 
             
                                     :use_ssl => url.scheme == 'https' ) {|http|
         | 
| 64 69 | 
             
                http.request(req)
         | 
| @@ -67,17 +72,21 @@ def process_xml_remotely(input, output) | |
| 67 72 | 
             
              when Net::HTTPOK
         | 
| 68 73 | 
             
                case res.content_type
         | 
| 69 74 | 
             
                when 'application/octet-stream'
         | 
| 75 | 
            +
                  if res.body == ''
         | 
| 76 | 
            +
                    warn "*** HTTP response is empty with status #{res.code}, not written"
         | 
| 77 | 
            +
                    exit 1
         | 
| 78 | 
            +
                  end
         | 
| 70 79 | 
             
                  File.open(output, "w") do |fo|
         | 
| 71 80 | 
             
                    fo.print(res.body)
         | 
| 72 81 | 
             
                  end
         | 
| 73 82 | 
             
                  warn "* #{output} written" if $options.verbose
         | 
| 74 83 | 
             
                else
         | 
| 75 | 
            -
                  warn "*** HTTP response has unexpected content_type #{res.content_type} with status #{res.code}"
         | 
| 84 | 
            +
                  warn "*** HTTP response has unexpected content_type #{res.content_type} with status #{res.code}, #{diag}"
         | 
| 76 85 | 
             
                  warn res.body
         | 
| 77 86 | 
             
                  exit 1
         | 
| 78 87 | 
             
                end
         | 
| 79 88 | 
             
              else
         | 
| 80 | 
            -
                warn "*** HTTP response: #{res.code}"
         | 
| 89 | 
            +
                warn "*** HTTP response: #{res.code}, #{diag}"
         | 
| 81 90 | 
             
                exit 1
         | 
| 82 91 | 
             
              end
         | 
| 83 92 | 
             
            end
         | 
    
        data/bin/kramdown-rfc2629
    CHANGED
    
    | @@ -345,8 +345,10 @@ if input =~ /\A<\?xml/          # if this is a whole XML file, protect it | |
| 345 345 | 
             
              input = "{::nomarkdown}\n#{input}\n{:/nomarkdown}\n"
         | 
| 346 346 | 
             
            end
         | 
| 347 347 | 
             
            options = {input: 'RFC2629Kramdown', entity_output: coding_override, link_defs: link_defs}
         | 
| 348 | 
            -
            if  | 
| 349 | 
            -
               | 
| 348 | 
            +
            if smart_quotes.nil?
         | 
| 349 | 
            +
              if (target_coding && target_coding =~ /ascii/) || $options.v3
         | 
| 350 | 
            +
                 smart_quotes = false
         | 
| 351 | 
            +
              end
         | 
| 350 352 | 
             
            end
         | 
| 351 353 | 
             
            if smart_quotes == false
         | 
| 352 354 | 
             
              smart_quotes = ["'".ord, "'".ord, '"'.ord, '"'.ord]
         | 
    
        data/kramdown-rfc2629.gemspec
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            spec = Gem::Specification.new do |s|
         | 
| 2 2 | 
             
              s.name = 'kramdown-rfc2629'
         | 
| 3 | 
            -
              s.version = '1.3. | 
| 3 | 
            +
              s.version = '1.3.14'
         | 
| 4 4 | 
             
              s.summary = "Kramdown extension for generating RFC 7749 XML."
         | 
| 5 5 | 
             
              s.description = %{An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
         | 
| 6 6 | 
             
            "kramdown" markdown parser.  Mostly useful for RFC writers.}
         | 
    
        data/lib/kramdown-rfc2629.rb
    CHANGED
    
    | @@ -37,16 +37,27 @@ module Kramdown | |
| 37 37 | 
             
                    @span_parsers.unshift(:iref)
         | 
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| 40 | 
            -
                  XREF_START = /\{\{(.*?)\}\}/u
         | 
| 40 | 
            +
                  XREF_START = /\{\{(?:(?:\{(.*?)\}(?:\{(.*?)\})?)|(.*?))((?:\}\})|\})/u
         | 
| 41 41 |  | 
| 42 42 | 
             
                  # Introduce new {{target}} syntax for empty xrefs, which would
         | 
| 43 43 | 
             
                  # otherwise be an ugly  or 
         | 
| 44 44 | 
             
                  # (I'd rather use [[target]], but that somehow clashes with links.)
         | 
| 45 45 | 
             
                  def parse_xref
         | 
| 46 46 | 
             
                    @src.pos += @src.matched_size
         | 
| 47 | 
            -
                     | 
| 48 | 
            -
             | 
| 49 | 
            -
                     | 
| 47 | 
            +
                    unless @src[4] == "}}"
         | 
| 48 | 
            +
                      warn "*** #{@src[0]}: unmatched braces #{@src[4].inspect}"
         | 
| 49 | 
            +
                    end
         | 
| 50 | 
            +
                    if contact_name = @src[1]
         | 
| 51 | 
            +
                      attr = {'fullname' => contact_name}
         | 
| 52 | 
            +
                      if ascii_name = @src[2]
         | 
| 53 | 
            +
                        attr["asciiFullname"] = ascii_name
         | 
| 54 | 
            +
                      end
         | 
| 55 | 
            +
                      el = Element.new(:contact, nil, attr)
         | 
| 56 | 
            +
                    else
         | 
| 57 | 
            +
                      href = @src[3]
         | 
| 58 | 
            +
                      href = href.gsub(/\A[0-9]/) { "_#{$&}" } # can't start an IDREF with a number
         | 
| 59 | 
            +
                      el = Element.new(:xref, nil, {'target' => href})
         | 
| 60 | 
            +
                    end
         | 
| 50 61 | 
             
                    @tree.children << el
         | 
| 51 62 | 
             
                  end
         | 
| 52 63 | 
             
                  define_parser(:xref, XREF_START, '{{')
         | 
| @@ -524,6 +535,10 @@ COLORS | |
| 524 535 | 
             
                    end
         | 
| 525 536 | 
             
                  end
         | 
| 526 537 |  | 
| 538 | 
            +
                  def convert_contact(el, indent, opts)
         | 
| 539 | 
            +
                    "<contact#{el_html_attributes(el)}/>"
         | 
| 540 | 
            +
                  end
         | 
| 541 | 
            +
             | 
| 527 542 | 
             
                  REFCACHEDIR = ENV["KRAMDOWN_REFCACHEDIR"] || ".refcache"
         | 
| 528 543 |  | 
| 529 544 | 
             
                  # warn "*** REFCACHEDIR #{REFCACHEDIR}"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: kramdown-rfc2629
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.3. | 
| 4 | 
            +
              version: 1.3.14
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Carsten Bormann
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-10-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: kramdown
         |