kramdown-rfc2629 1.7.13 → 1.7.15

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: 37a6e52b1686d310bf22c8c2530ce893e3ea30b74675b6cdd17143c141a51321
4
- data.tar.gz: f9cedeb1b71146d4be4affd7ba343c1a2a497b607e82565b772445d7fc686c06
3
+ metadata.gz: 5ece90445d0767338a8196d8168974776adeaa8823c9030c7138e0f3ce96b39b
4
+ data.tar.gz: 29ed6223102eb578ce7b156d7e625e4195f08deb6c86275a8f2cac84a54f588e
5
5
  SHA512:
6
- metadata.gz: 92fc3fc628cbcc21b0368f692f078206caa01fa8d5eb8f712777f369632f1d472efa20c0af96cd71a0e0e2752449d1efbeb2c354973fca4f740722545811b213
7
- data.tar.gz: 924dc4cd075193b1cc9310ddee259290e5bd0026a5ccbb7ff2da65ea897ec3a6560e2fccbaee5122cacaa262ac9d4b692bfb14417359b6f39dfbdb8aaea7b340
6
+ metadata.gz: 3991c909c6d0d4cb3960a6102102fd729507343f172b4f8d5fe1db366dbd993d6758eeba0c0c8c0136728f78050f8a1ae9a6d92cb0f2f3063454af962b6b8576
7
+ data.tar.gz: 7195608a123184256d77af053e1a8c69631c555e6fb4bf1a0eb6c04cb62b6569d6aa17fd6e23b310f29a1e5eee01677d09154b176a82df7d4d0db7100e73864b
data/bin/kramdown-rfc-lsr CHANGED
@@ -152,34 +152,46 @@ def num_expand(s)
152
152
  s.gsub(/\d+/) {|n| "%09d" % n.to_i}
153
153
  end
154
154
 
155
+ def want_one(secs, what)
156
+ case secs.size
157
+ when 0
158
+ error_out "*** cannot match #{what}"
159
+ "*** DOESN'T EXIST ***"
160
+ when 1
161
+ yield secs.first
162
+ else
163
+ error_out "*** multiple matches for #{what}"
164
+ "*** MULTIPLE MATCHES ***"
165
+ end
166
+ end
155
167
  require 'open3'
156
168
 
157
169
  module OpenURI
158
170
  class << self
159
- def prepped(uri, *rest)
160
- newuri = uri.to_s.sub(/\.xml$/, ".prepped.xml")
171
+ def processed(uri, old, camo, *rest)
172
+ newuri = uri.to_s.sub(old, camo) # camo name for processed data
161
173
  response = Cache.get(newuri) || (
162
- unprepped = open_uri(uri, *rest).read
174
+ unprocessed = open_uri(uri, *rest).read
163
175
  fn = [OpenURI::Cache.cache_path, uri.sub(/.*\//, '')].join('/')
164
- File.open(fn, 'wb'){|f| f.write unprepped }
165
- _prep_out, s = Open3.capture2("xml2rfc", "--prep", fn)
166
- fail s.inspect unless s.success?
167
- new_fn = fn.sub(/\.xml$/, ".prepped.xml")
176
+ File.open(fn, 'wb'){|f| f.write unprocessed }
177
+ new_fn = yield newuri, fn
168
178
  Cache.set(newuri, File.open(new_fn))
169
179
  )
170
180
  response
171
181
  end
172
- def tidied(uri, *rest)
173
- newuri = uri.to_s.sub(/\.html$/, ".tidied.html")
174
- response = Cache.get(newuri) || (
175
- unprepped = open_uri(uri, *rest).read
176
- fn = [OpenURI::Cache.cache_path, uri.sub(/.*\//, '')].join('/')
177
- File.open(fn, 'wb'){|f| f.write unprepped }
182
+ def prepped(uri)
183
+ processed(uri, /\.xml$/, ".prepped.xml") do |newuri, fn|
184
+ _prep_out, s = Open3.capture2("xml2rfc", "--prep", fn)
185
+ fail s.inspect unless s.success?
186
+ fn.sub(/\.xml$/, ".prepped.xml") # xml2rfc creates new file
187
+ end
188
+ end
189
+ def tidied(uri)
190
+ processed(uri, /\.html$/, ".tidied.html") do |newuri, fn|
178
191
  _prep_out, s = Open3.capture2("tidy", "-mq", "-asxml", "-f", "/dev/null", fn)
179
- fail s.inspect unless s.exited?
180
- Cache.set(newuri, File.open(fn))
181
- )
182
- response
192
+ fail s.inspect unless s.exited? # can't check success
193
+ fn # -m makes in-place change
194
+ end
183
195
  end
184
196
  end
185
197
  end
@@ -233,16 +245,8 @@ per_reference.keys.sort_by {|x| num_expand(x)}.each do |trg|
233
245
  REXML::XPath.match(refdoc.root, "//section[@pn=$pn]",
234
246
  {}, {"pn" => c})}
235
247
  what = "#{secpn.join(" or ")} in #{trg}"
236
- add << " (#{case secs.size
237
- when 0
238
- error_out "*** cannot match #{what}"
239
- "*** DOESN'T EXIST ***"
240
- when 1
241
- sec = secs.first
248
+ add << " (#{want_one(secs, what) do |sec|
242
249
  sec[:title] || sec.elements["name"].all_text
243
- else
244
- error_out "*** multiple matches for #{what}"
245
- "*** MULTIPLE MATCHES ***"
246
250
  end})"
247
251
  elsif refhtmldoc # find section name in HTML from anchor s
248
252
  secpn = section_number_to_htmlid(s)
@@ -251,15 +255,8 @@ per_reference.keys.sort_by {|x| num_expand(x)}.each do |trg|
251
255
  {"xmlns" => "http://www.w3.org/1999/xhtml"},
252
256
  {"pn" => secpn})
253
257
  what = "#{secpn} in #{trg}"
254
- add << " (#{case secs.size
255
- when 0
256
- error_out "*** cannot match #{what}"
257
- "*** DOESN'T EXIST ***"
258
- when 1
259
- secs.first.text.sub(/^\.\s+/, '')
260
- else
261
- error_out "*** multiple matches for #{what}"
262
- "*** MULTIPLE MATCHES ***"
258
+ add << " (#{want_one(secs, what) do |sec|
259
+ sec.text.sub(/^\.\s+/, '')
263
260
  end})"
264
261
  end
265
262
  puts "* #{/^[0-9]/ =~ s ? "Section" : "Appendix"} #{s}#{add}"
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.7.13'
3
+ s.version = '1.7.15'
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.}
@@ -12,7 +12,9 @@ spec = Gem::Specification.new do |s|
12
12
  s.add_dependency('unicode-blocks', '~> 1.0')
13
13
  s.add_dependency('unicode-scripts', '~> 1.0')
14
14
  s.add_dependency('net-http-persistent', '~> 4.0')
15
- s.add_dependency('differ', '~>0.1')
15
+ s.add_dependency('differ', '~> 0.1')
16
+ s.add_dependency('base64', '>= 0.1')
17
+ s.add_dependency('rexml', '<= 3.2.6') # emergency fix; newer REXML is no longer pure ruby (requires strscan)
16
18
  s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc bin/kramdown-rfc2629 bin/doilit bin/echars bin/kramdown-rfc-extract-markdown bin/kramdown-rfc-extract-sourcecode bin/kramdown-rfc-lsr data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json bin/kramdown-rfc-cache-subseries-bibxml bin/kramdown-rfc-autolink-iref-cleanup bin/de-gfm bin/kramdown-rfc-clean-svg-ids)
17
19
  s.require_path = 'lib'
18
20
  s.executables = ['kramdown-rfc', 'kramdown-rfc2629', 'doilit', 'echars',
@@ -25,8 +27,6 @@ spec = Gem::Specification.new do |s|
25
27
  'de-gfm',
26
28
  'kramdown-rfc-clean-svg-ids']
27
29
  s.required_ruby_version = '>= 2.3.0'
28
- # s.requirements = 'wget'
29
- # s.has_rdoc = true
30
30
  s.author = "Carsten Bormann"
31
31
  s.email = "cabo@tzi.org"
32
32
  s.homepage = "http://github.com/cabo/kramdown-rfc"
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.7.13
4
+ version: 1.7.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-18 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: base64
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rexml
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "<="
158
+ - !ruby/object:Gem::Version
159
+ version: 3.2.6
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "<="
165
+ - !ruby/object:Gem::Version
166
+ version: 3.2.6
139
167
  description: |-
140
168
  An RFCXML (RFC 799x) generating backend for Thomas Leitner's
141
169
  "kramdown" markdown parser. Mostly useful for RFC writers.
@@ -208,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
236
  - !ruby/object:Gem::Version
209
237
  version: '0'
210
238
  requirements: []
211
- rubygems_version: 3.5.9
239
+ rubygems_version: 3.5.11
212
240
  signing_key:
213
241
  specification_version: 4
214
242
  summary: Kramdown extension for generating RFCXML (RFC 799x).