kramdown-rfc2629 1.0.19 → 1.0.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d68b8928a16df28ada77fdb50e2450845c458c0
4
- data.tar.gz: 747a779389488dd339319a4b6004ab0f2fa9f562
3
+ metadata.gz: 78a9c4fff6a70700bc14d403bdf3e20830c07324
4
+ data.tar.gz: ddabb5f47e304c78faef3a7ba8f348a9b967cb2d
5
5
  SHA512:
6
- metadata.gz: c3f7937f66db0c675f0c246493d0f31934f7edcf5606472b085e7dca6e385bdad8e1278c4673f06ddda430ee4159d8877a1b96696b81950aa52061b4a2f59975
7
- data.tar.gz: 1b0c052acb904b08ad997d2951a5f4e0fc06b7f3404dfffd5ba235348918160da44ca0f9050e5d9fb01d92514817b165f90e4750bfc22ffd81a45a860d167b76
6
+ metadata.gz: 732a37a44e072a4fc308b338d6827e7c17cd1db191d45a52400737f1f0e2deac1b0b2e291aed21ddc417479093dcb1db3cc013c76ca1350f5aa54ecccb6ce408
7
+ data.tar.gz: 59e254c66570a77df8f3f290cf6ae519bf3a50a33717d1bfcaa6136339cd422e782389f3930c143ca0018fdb7160fe0db169c4c3a167d4c130b861c7dcfa9f17
@@ -103,10 +103,13 @@ def xml_from_sections(input)
103
103
  end
104
104
 
105
105
  stand_alone = ps[:stand_alone]
106
+ link_defs = {}
106
107
 
107
108
  [:normative, :informative].each do |sn|
108
109
  if refs = ps[sn]
109
110
  refs.each do |k, v|
111
+ href = k.gsub(/\A[0-9]/) { "_#{$&}" } # can't start an IDREF with a number
112
+ link_defs[k] = ["##{href}", nil] # allow [RFC2119] in addition to {{RFC2119}}
110
113
  if bts = bibtagsys(k)
111
114
  if v
112
115
  warn "*** redundant in #{k}: #{v.inspect}" unless v.respond_to? :to_str
@@ -165,7 +168,7 @@ def xml_from_sections(input)
165
168
  warn "*** sections left #{sechash.keys.inspect}!"
166
169
  end
167
170
 
168
- [input, coding_override]
171
+ [input, coding_override, link_defs]
169
172
  end
170
173
 
171
174
  class ParameterSet
@@ -266,13 +269,14 @@ coding_override = :as_char
266
269
  input = ARGF.read.gsub(/\{::include\s+(.*?)\}/) {
267
270
  File.read($1).chomp
268
271
  }
272
+ link_defs = {}
269
273
  if input =~ /\A---/ # this is a sectionized file
270
- input, coding_override = xml_from_sections(input)
274
+ input, coding_override, link_defs = xml_from_sections(input)
271
275
  end
272
276
  if input =~ /\A<\?xml/ # if this is a whole XML file, protect it
273
277
  input = "{::nomarkdown}\n#{input}\n{:/nomarkdown}\n"
274
278
  end
275
- options = {input: 'RFC2629Kramdown', entity_output: coding_override}
279
+ options = {input: 'RFC2629Kramdown', entity_output: coding_override, link_defs: link_defs}
276
280
  # warn "options: #{options.inspect}"
277
281
  doc = Kramdown::Document.new(input, options)
278
282
  $stderr.puts doc.warnings.to_yaml unless doc.warnings.empty?
@@ -1,5 +1,7 @@
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 <%=
4
+ Gem.loaded_specs["kramdown-rfc2629"].version rescue nil %> -->
3
5
 
4
6
  <!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
5
7
  <% ps.arr("bibxml") do |bib|
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.0.19'
3
+ s.version = '1.0.20'
4
4
  s.summary = "Kramdown extension for generating RFC 2629 XML."
5
5
  s.description = %{An RFC2629 (XML2RFC) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
@@ -338,7 +338,10 @@ module Kramdown
338
338
  res = inner(el, indent, opts)
339
339
  target = el.attr['target']
340
340
  if target[0] == "#" # handle [](#foo) as xref as in RFC 7328
341
- el.attr['target'] = target[1..-1]
341
+ el.attr['target'] = target = target[1..-1]
342
+ if target.downcase == res.downcase
343
+ res = '' # get rid of raw anchors leaking through
344
+ end
342
345
  "<xref#{el_html_attributes(el)}>#{res}</xref>"
343
346
  else
344
347
  "<eref#{el_html_attributes(el)}>#{res}</eref>"
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.0.19
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown