kramdown-rfc2629 1.3.14 → 1.3.15

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
  SHA256:
3
- metadata.gz: be9c46d583cac4dc5a8b951b953e25819c77298d372f710a41f527a1cf18c609
4
- data.tar.gz: 124c338b7a9c7544c7c8d91c959af382a9996b681fac87daaa07ca572facfb08
3
+ metadata.gz: 354d5f23ac1b7c316806141e245839cd8b23a27588163318d1cf320441c64165
4
+ data.tar.gz: 48398c27fc7bd37dd1bfacb4bcb850456d80196b3b2d733df518e1a23e4e439d
5
5
  SHA512:
6
- metadata.gz: 59e5bb9e1236669a85c392b77cc5854d0a3070049fb76add45779b70663dc2b2d185c2ca5f0a0e79148d655272656ce53cbe97498b4e625eed248cb90c744485
7
- data.tar.gz: c2cc8cbc0a52a8bfdd71535b463affca2ab5a2d9f845f295c84d5983c1861b5e7a3a0470eb3c291d31fe03e29907e16e0f55d0fac0a1ece5bcdec17bcbab2875
6
+ metadata.gz: '008b6ccb511c6711eeb4fcc53695cf385da93d5687f29608c914fb967a2749d13816ed61f9dd170a727e7d5fd2b6f5c8f448c35a6c8d07e3bf3ab95aed7db208'
7
+ data.tar.gz: cbb09a56c79df192c8e0ac25ca6e0121b636598b96326e4debe3b60d9c340a5dacc26605f2b0fdbf28586c02fb90c333a0a36bbf17ad52f6ef3ae34676fe781e
data/README.md CHANGED
@@ -351,7 +351,7 @@ generate XML2RFCv2 XML instead of kramdown-rfc YAML.
351
351
  (1.0.31:)
352
352
  The kramdown `smart_quotes` feature can be controlled better.
353
353
  By default, it is on (with default kramdown settings), unless `coding:
354
- us-ascii` is in effect, when it is off by default.
354
+ us-ascii` is in effect (1.3.14: or --v3 is given), in which case it is off by default.
355
355
  It also can be explicitly set on (`true`) or off (`false`) in the YAML
356
356
  header, or to a specific value (an array of four kramdown entity names
357
357
  or character numbers). E.g., for a German text (that is not intended
@@ -87,6 +87,7 @@ def xml_from_sections(input)
87
87
  ps = KramdownRFC::ParameterSet.new(yaml_load(yaml_in, [Date], [], true))
88
88
  coding_override = ps.has(:coding)
89
89
  smart_quotes = ps[:smart_quotes]
90
+ typographic_symbols = ps[:typographic_symbols]
90
91
  kramdown_options = ps[:kramdown_options]
91
92
 
92
93
  # all the other sections are put in a Hash, possibly concatenated from parts there
@@ -237,7 +238,7 @@ def xml_from_sections(input)
237
238
  warn "*** sections left #{sechash.keys.inspect}!"
238
239
  end
239
240
 
240
- [input, coding_override, link_defs, smart_quotes, kramdown_options]
241
+ [input, coding_override, link_defs, smart_quotes, typographic_symbols, kramdown_options]
241
242
  end
242
243
 
243
244
  XML_RESOURCE_ORG_PREFIX = Kramdown::Converter::Rfc2629::XML_RESOURCE_ORG_PREFIX
@@ -339,7 +340,7 @@ end
339
340
  link_defs = {}
340
341
  if input =~ /\A---/ # this is a sectionized file
341
342
  do_the_tls_dance unless ENV["KRAMDOWN_DONT_VERIFY_HTTPS"]
342
- input, target_coding, link_defs, smart_quotes, kramdown_options = xml_from_sections(input)
343
+ input, target_coding, link_defs, smart_quotes, typographic_symbols, kramdown_options = xml_from_sections(input)
343
344
  end
344
345
  if input =~ /\A<\?xml/ # if this is a whole XML file, protect it
345
346
  input = "{::nomarkdown}\n#{input}\n{:/nomarkdown}\n"
@@ -361,6 +362,28 @@ when nil, true
361
362
  else
362
363
  warn "*** Can't deal with smart_quotes value #{smart_quotes.inspect}"
363
364
  end
365
+ if typographic_symbols.nil?
366
+ if (target_coding && target_coding =~ /ascii/) || $options.v3
367
+ typographic_symbols = false
368
+ end
369
+ end
370
+ if typographic_symbols == false
371
+ typographic_symbols = Hash[::Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS.map { |k, v|
372
+ if Symbol === v
373
+ [v.intern, k]
374
+ end
375
+ }.compact]
376
+ end
377
+ # warn [:TYPOGRAPHIC_SYMBOLS, typographic_symbols].to_yaml
378
+ case typographic_symbols
379
+ when Hash
380
+ options[:typographic_symbols] = typographic_symbols
381
+ when nil, true
382
+ # nothin
383
+ else
384
+ warn "*** Can't deal with typographic_symbols value #{typographic_symbols.inspect}"
385
+ end
386
+
364
387
  if kramdown_options
365
388
  options.merge! kramdown_options
366
389
  end
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.3.14'
3
+ s.version = '1.3.15'
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.}
@@ -725,7 +725,11 @@ COLORS
725
725
  :raquo => [::Kramdown::Utils::Entities.entity('raquo')]
726
726
  }
727
727
  def convert_typographic_sym(el, indent, opts)
728
- TYPOGRAPHIC_SYMS[el.value].map {|e| entity_to_str(e)}.join('')
728
+ if (result = @options[:typographic_symbols][el.value])
729
+ escape_html(result, :text)
730
+ else
731
+ TYPOGRAPHIC_SYMS[el.value].map {|e| entity_to_str(e) }.join('')
732
+ end
729
733
  end
730
734
 
731
735
  def convert_smart_quote(el, indent, opts)
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.14
4
+ version: 1.3.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: 2020-10-13 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown