kramdown-rfc2629 1.6.4 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3216df18368295dd7cd569731da214ec39f57132880c8d12d51f9dc02dce30fb
4
- data.tar.gz: e2f0bfaf8d5b96bc2451d93c6c08a636b0b013420201821bff611918a87e7922
3
+ metadata.gz: 452cf1c47c8482b1c9067aae060966a7cd45026dc917e0959895398d97006d66
4
+ data.tar.gz: be26600191bf4b7421c333801117f8be4ac5b5430bd60dc28a83781f551488bc
5
5
  SHA512:
6
- metadata.gz: acfa4b9493d9cd4eb39ea67665a86a249915aa5f537ddbff53e6add625a0576223dc93bc9cb6ffb192f61c1805f892940c667153a9a316b5a7195820135e5365
7
- data.tar.gz: 56de1bff6b8db68224ea994c8604dc75dd1ef99f01705ea04a704be0b1d635bdfa229296f9ad5a9c6a5263812da6dfa4b9d955035dd5f20a64d11b657afd7fca
6
+ metadata.gz: fdd3f6e6fd3fbb4cd659c6470e879423e99a81c1a636a1665d7c92fa997bdcf610bd9fc9dceec43382d8357d993e8668851a290b23b7d658296550d6439caddf
7
+ data.tar.gz: 45079be5f0fc24eccc320fc638d177ebbe68ca5e3ee36ae2639c82256116c194b44e30944bbffe371c44a04b2e7c71ea63d6eee1ab7f84fb29fae74fe9c88cc8
data/bin/de-gfm CHANGED
@@ -5,19 +5,22 @@ Encoding.default_external = "UTF-8" # wake up, smell the coffee
5
5
  require 'kramdown'
6
6
  require 'kramdown-parser-gfm'
7
7
 
8
- if ARGV[0] == '-k' # kramdown
9
- MARKDOWN_BR = "\\\\\n"
8
+ options = ''
9
+ while /\A-([4bck]+)\z/ === ARGV[0]
10
10
  ARGV.shift
11
+ options << $1
12
+ end
13
+
14
+ if /k/ === options # kramdown
15
+ MARKDOWN_BR = "\\\\\n"
11
16
  end
12
17
 
13
- if ARGV[0] == '-c' # commonmark
18
+ if /c/ === options # commonmark
14
19
  MARKDOWN_BR = "\\\n"
15
- ARGV.shift
16
20
  end
17
21
 
18
- if ARGV[0] == '-b' # universal HTML
22
+ if /b/ === options # universal HTML
19
23
  MARKDOWN_BR = "<br/>\n"
20
- ARGV.shift
21
24
  end
22
25
 
23
26
  MARKDOWN_BR ||= " \n" # original Gruber
@@ -37,4 +40,9 @@ module Kramdown
37
40
  end
38
41
  end
39
42
 
40
- puts Kramdown::Document.new(ARGF.read, input: 'GFM', gfm_quirks: 'paragraph_end').to_kramdown
43
+ list_indent = 2
44
+ list_indent = 4 if /4/ === options
45
+
46
+ doc = Kramdown::Document.new(ARGF.read, input: 'GFM', gfm_quirks: 'paragraph_end',
47
+ list_indent: list_indent)
48
+ puts doc.to_kramdown
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ require 'rexml/document'
4
+
5
+ d = REXML::Document.new(ARGF.read)
6
+
7
+ d.root.get_elements("//section[@anchor]").each do |sec|
8
+ anchor = sec['anchor']
9
+ irefs = {}
10
+ sec.get_elements(".//xref[@target='#{anchor}'][@format='none']").each do |xr|
11
+ ne = xr.next_element
12
+ if ne && ne.name == "iref" && (item = ne['item'])
13
+ irefs[item] = ne['subitem'] # XXX one subitem only
14
+ ne.remove
15
+ chi = xr.children
16
+ chi[1..-1].reverse.each do |ch|
17
+ xr.parent.insert_after(xr, ch)
18
+ end
19
+ xr.replace_with(chi[0])
20
+ end
21
+ end
22
+ irefs.each do |k, v|
23
+ sec.insert_after(sec.get_elements("name").first,
24
+ e = REXML::Element.new("iref", sec))
25
+ e.attributes["item"] = k
26
+ e.attributes["subitem"] = v
27
+ e.attributes["primary"] = 'true'
28
+ end
29
+ end
30
+
31
+ puts d.to_s
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="<%=ps[:coding]||"UTF-8"%>"?>
2
2
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
3
- <!-- generated by https://github.com/cabo/kramdown-rfc2629 version <%=
3
+ <!-- generated by https://github.com/cabo/kramdown-rfc version <%=
4
4
  Gem.loaded_specs["kramdown-rfc2629"].version rescue nil
5
5
  %> (Ruby <%= RUBY_VERSION %>) -->
6
6
 
@@ -1,14 +1,14 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.6.4'
3
+ s.version = '1.6.7'
4
4
  s.summary = "Kramdown extension for generating RFCXML (RFC 799x)."
5
5
  s.description = %{An RFCXML (RFC 799x) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
7
- s.add_dependency('kramdown', '~> 2.3.0')
7
+ s.add_dependency('kramdown', '~> 2.4.0')
8
8
  s.add_dependency('kramdown-parser-gfm', '~> 1.1')
9
9
  s.add_dependency('certified', '~> 1.0')
10
10
  s.add_dependency('json_pure', '~> 2.0')
11
- s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc bin/kramdown-rfc2629 bin/doilit bin/kramdown-rfc-extract-markdown data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json bin/kramdown-rfc-cache-subseries-bibxml bin/de-gfm)
11
+ s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc bin/kramdown-rfc2629 bin/doilit bin/kramdown-rfc-extract-markdown data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json bin/kramdown-rfc-cache-subseries-bibxml bin/kramdown-rfc-autolink-iref-cleanup.rb bin/de-gfm)
12
12
  s.require_path = 'lib'
13
13
  s.executables = ['kramdown-rfc', 'kramdown-rfc2629', 'doilit', 'kramdown-rfc-extract-markdown',
14
14
  'kdrfc', 'kramdown-rfc-cache-i-d-bibxml',
@@ -18,6 +18,6 @@ spec = Gem::Specification.new do |s|
18
18
  # s.has_rdoc = true
19
19
  s.author = "Carsten Bormann"
20
20
  s.email = "cabo@tzi.org"
21
- s.homepage = "http://github.com/cabo/kramdown-rfc2629"
21
+ s.homepage = "http://github.com/cabo/kramdown-rfc"
22
22
  s.license = 'MIT'
23
23
  end
@@ -229,7 +229,7 @@ def xml_from_sections(input)
229
229
  unless ENV["KRAMDOWN_NO_SOURCE"]
230
230
  require 'kramdown-rfc/gzip-clone'
231
231
  require 'base64'
232
- compressed_input = Gzip.compress(input)
232
+ compressed_input = Gzip.compress_m0(input)
233
233
  $source = Base64.encode64(compressed_input)
234
234
  end
235
235
 
@@ -485,7 +485,7 @@ Usage: kramdown-rfc2629 [options] file.md|file.mkd > file.xml
485
485
  Version: #{KDRFC_VERSION}
486
486
  BANNER
487
487
  opts.on("-V", "--version", "Show version and exit") do |v|
488
- puts "kramdown-rfc2629 #{KDRFC_VERSION}"
488
+ puts "kramdown-rfc #{KDRFC_VERSION}"
489
489
  exit
490
490
  end
491
491
  opts.on("-H", "--help", "Show option summary and exit") do |v|
@@ -24,10 +24,11 @@ require 'stringio'
24
24
  Zlib::GzipReader.new(StringIO.new(source)).read
25
25
  end
26
26
 
27
- # Compresses a string using gzip.
28
- def self.compress(source, level=Zlib::DEFAULT_COMPRESSION, strategy=Zlib::DEFAULT_STRATEGY)
27
+ # Compresses a string using gzip, setting mtime to 0
28
+ def self.compress_m0(source, level=Zlib::DEFAULT_COMPRESSION, strategy=Zlib::DEFAULT_STRATEGY)
29
29
  output = Stream.new
30
30
  gz = Zlib::GzipWriter.new(output, level, strategy)
31
+ gz.mtime = 0
31
32
  gz.write(source)
32
33
  gz.close
33
34
  output.string
@@ -12,7 +12,7 @@ require 'shellwords'
12
12
 
13
13
  raise "sorry, 1.8 was last decade" unless RUBY_VERSION >= '1.9'
14
14
 
15
- gem 'kramdown', '~> 2.3.0'
15
+ gem 'kramdown', '~> 2.4.0'
16
16
  require 'kramdown'
17
17
  my_span_elements = %w{list figure xref eref iref cref spanx vspace}
18
18
  Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS.concat my_span_elements
@@ -722,7 +722,12 @@ COLORS
722
722
  attrstring = html_attributes({'slugifiedName' => sl})
723
723
  end
724
724
  # noabbrev: true -- Workaround for https://trac.ietf.org/trac/xml2rfc/ticket/683
725
- irefs = "<name#{attrstring}>#{inner(el, indent, opts.merge(noabbrev: true))}</name>" #
725
+ nm = inner(el, indent, opts.merge(noabbrev: true))
726
+ if ttl = el.attr['title']
727
+ warn "*** Section has two titles: >>#{ttl}<< and >>#{nm}<<"
728
+ warn "*** Do you maybe have a loose IAL?"
729
+ end
730
+ irefs = "<name#{attrstring}>#{nm}</name>" #
726
731
  else
727
732
  clean, irefs = clean_pcdata(inner_a(el, indent, opts))
728
733
  el.attr['title'] = clean
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.6.4
4
+ version: 1.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-05 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.0
19
+ version: 2.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.0
26
+ version: 2.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: kramdown-parser-gfm
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,6 +88,7 @@ files:
88
88
  - bin/doilit
89
89
  - bin/kdrfc
90
90
  - bin/kramdown-rfc
91
+ - bin/kramdown-rfc-autolink-iref-cleanup.rb
91
92
  - bin/kramdown-rfc-cache-i-d-bibxml
92
93
  - bin/kramdown-rfc-cache-subseries-bibxml
93
94
  - bin/kramdown-rfc-extract-markdown
@@ -104,7 +105,7 @@ files:
104
105
  - lib/kramdown-rfc/refxml.rb
105
106
  - lib/kramdown-rfc/rfc8792.rb
106
107
  - lib/kramdown-rfc2629.rb
107
- homepage: http://github.com/cabo/kramdown-rfc2629
108
+ homepage: http://github.com/cabo/kramdown-rfc
108
109
  licenses:
109
110
  - MIT
110
111
  metadata: {}
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  requirements: []
126
- rubygems_version: 3.3.7
127
+ rubygems_version: 3.3.11
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: Kramdown extension for generating RFCXML (RFC 799x).