Permalink
Browse files

1.2.9: Add kramdown_options to YAML

close #52
  • Loading branch information...
cabo committed Apr 28, 2018
1 parent 4e2f409 commit 3238d20203dfb3aeb51bd3fa379ffbd36dfce537
Showing with 7 additions and 3 deletions.
  1. +6 −2 bin/kramdown-rfc2629
  2. +1 −1 kramdown-rfc2629.gemspec
@@ -84,6 +84,7 @@ def xml_from_sections(input)
ps = KramdownRFC::ParameterSet.new(yaml_load(yaml_in, [Date], [], true))
coding_override = ps.has(:coding)
smart_quotes = ps[:smart_quotes]
kramdown_options = ps[:kramdown_options]

# all the other sections are put in a Hash, possibly concatenated from parts there
sechash = Hash.new{ |h,k| h[k] = ""}
@@ -233,7 +234,7 @@ def xml_from_sections(input)
warn "*** sections left #{sechash.keys.inspect}!"
end

[input, coding_override, link_defs, smart_quotes]
[input, coding_override, link_defs, smart_quotes, kramdown_options]
end

XML_RESOURCE_ORG_PREFIX = Kramdown::Converter::Rfc2629::XML_RESOURCE_ORG_PREFIX
@@ -304,7 +305,7 @@ end
link_defs = {}
if input =~ /\A---/ # this is a sectionized file
do_the_tls_dance unless ENV["KRAMDOWN_DONT_VERIFY_HTTPS"]
input, target_coding, link_defs, smart_quotes = xml_from_sections(input)
input, target_coding, link_defs, smart_quotes, kramdown_options = xml_from_sections(input)
end
if input =~ /\A<\?xml/ # if this is a whole XML file, protect it
input = "{::nomarkdown}\n#{input}\n{:/nomarkdown}\n"
@@ -324,6 +325,9 @@ when nil, true
else
warn "*** Can't deal with smart_quotes value #{smart_quotes.inspect}"
end
if kramdown_options
options.merge! kramdown_options
end

if target_coding
input = input.encode(Encoding.find(target_coding), fallback: FALLBACK)
@@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = 'kramdown-rfc2629'
s.version = '1.2.8'
s.version = '1.2.9'
s.summary = "Kramdown extension for generating RFC 7749 XML."
s.description = %{An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
"kramdown" markdown parser. Mostly useful for RFC writers.}

0 comments on commit 3238d20

Please sign in to comment.