kramdown-asciidoc 2.0.1 → 2.1.0

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: e2f299ca0d156093eca0b0bf206f13bbedb23604e4f6a237b2b5aa16faa76eb0
4
- data.tar.gz: 7bc8f03b29ecc1986f25c53858a3f4920b3ff3ba8a1d4b3313cee73c4be0dcaa
3
+ metadata.gz: 72f332cee31234bcb8b870e8216bb76062a85a66cbdaf05c8aa3a1829677564a
4
+ data.tar.gz: e80097972c53c804615741fa8e4b7fe7eb185d173dbb14242ff3c9d7ab1ddf9a
5
5
  SHA512:
6
- metadata.gz: 3d67ddef393d8155a0362ca7c8f0a997cf16f232f1293c13c8cb49ffa08009353224fa9703a25a4f1ab3b3b3dc4b048b56721b15d344695ec025ab3c8223efbe
7
- data.tar.gz: 3ad990caafd8c8dd4eb0854e1af5095be820b735feff16d28aeac09b98967aabbefc43d6ecae35bda318d8cfdf65a691ea1e34e6b8a060337b17086b4a58e61e
6
+ metadata.gz: b48abf36246bf94d96f6c5f8ff75962f90ae0ec216c947fd9052d865d0e30a3d2b1cbe50a5d84592c95f2dc830c5c3bd82a56f82410bac3c5c082546d3030407
7
+ data.tar.gz: 6654bbe89a6e3dea310df6df79cad09ab0cd911ca0c562d057827dc5751ab79a03ad8d1914dfe69b3346b01356c4e0fc46611beb19705573918fee7d77bc6006
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,27 @@
5
5
  This document provides a high-level view of the changes to {project-name} by release.
6
6
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
7
 
8
+ == 2.1.0 (2022-07-04) - @mojavelinux
9
+
10
+ === Added
11
+
12
+ * Add support for multi-paragraph admonitions (#72)
13
+ * Add support for GFM-style admonitions (#103)
14
+ * Convert checkbox at start of items in a checklist (#94)
15
+ * Allow diagram languages to be specified and convert matching fenced code blocks to diagram literal blocks (#76)
16
+
17
+ === Fixed
18
+
19
+ * Separate adjacent delimited literal blocks
20
+
21
+ === Changed
22
+
23
+ * Upgrade kramdown to 2.4.x
24
+
25
+ === Details
26
+
27
+ {url-repo}/releases/tag/v2.1.0[git tag] | {url-repo}/compare/v2.0.1\...v2.1.0[full diff]
28
+
8
29
  == 2.0.1 (2022-06-29) - @mojavelinux
9
30
 
10
31
  === Fixed
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = {project-name} (Markdown to AsciiDoc)
2
2
  Dan Allen <https://github.com/mojavelinux>
3
- v2.0.1, 2022-06-29
3
+ v2.1.0, 2022-07-04
4
4
  // Aliases:
5
5
  :project-name: Kramdown AsciiDoc
6
6
  :project-handle: kramdown-asciidoc
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
 
32
32
  s.require_paths = ['lib']
33
33
 
34
- s.add_runtime_dependency 'kramdown', '~> 2.3.0'
34
+ s.add_runtime_dependency 'kramdown', '~> 2.4.0'
35
35
  s.add_runtime_dependency 'rexml', '~> 3.2.0'
36
36
  s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1.0'
37
37
 
@@ -35,6 +35,10 @@ module AsciiDoc
35
35
  options[:attributes][key] = val
36
36
  end
37
37
 
38
+ opts.on '--diagram-languages=VALUES', 'Specify source languages to treat as diagrams (default: plantuml,mermaid)' do |names|
39
+ options[:diagram_languages] = names.split ','
40
+ end
41
+
38
42
  opts.on '--wrap=preserve|none|ventilate', [:none, :preserve, :ventilate], 'Set how lines are wrapped in the AsciiDoc document (default: preserve)' do |wrap|
39
43
  options[:wrap] = wrap
40
44
  end
@@ -92,6 +92,7 @@ module AsciiDoc
92
92
  @ids_seen = {}
93
93
  @footnote_ids = ::Set.new
94
94
  @auto_links = opts.fetch :auto_links, true
95
+ @diagram_languages = opts[:diagram_languages] || %w(plantuml mermaid)
95
96
  @heading_offset = opts[:heading_offset] || 0
96
97
  @imagesdir = opts[:imagesdir] || @attributes['imagesdir']
97
98
  @wrap = opts[:wrap] || :preserve
@@ -185,7 +186,8 @@ module AsciiDoc
185
186
  elsif (child_i.type == :strong || child_i.type == :em) &&
186
187
  (marker_el = child_i.children[0]) && ((marker = ADMON_FORMATTED_MARKERS[marker_el.value]) ||
187
188
  ((marker = ADMON_LABELS[marker_el.value]) && (child_ii = to_element children[1]).type == :text &&
188
- ((child_ii_text = child_ii.value).start_with? ': ')))
189
+ (((child_ii_text = child_ii.value).start_with? ': ') ||
190
+ (opts[:parent].type == :blockquote && (child_ii_text.start_with? ?\n)))))
189
191
  children = children.drop 1
190
192
  children[0] = clone child_ii, value: (child_ii_text.slice 1, child_ii_text.length) if child_ii
191
193
  # Q: should we only rstrip?
@@ -203,8 +205,16 @@ module AsciiDoc
203
205
  (writer = opts[:writer]).start_block
204
206
  traverse el, (opts.merge writer: (block_writer = Writer.new), blockquote_depth: (depth = opts[:blockquote_depth] || 0) + 1)
205
207
  contents = block_writer.body
206
- if contents[0].start_with?(*ADMON_MARKERS_ASCIIDOC) && !(contents.include? '')
207
- writer.add_lines contents
208
+ if contents[0].start_with?(*ADMON_MARKERS_ASCIIDOC)
209
+ if contents.include? ''
210
+ style, _, contents[0] = contents[0].partition ': '
211
+ writer.add_line %([#{style}])
212
+ writer.start_delimited_block '='
213
+ writer.add_lines contents
214
+ writer.end_delimited_block
215
+ else
216
+ writer.add_lines contents
217
+ end
208
218
  else
209
219
  if contents.size > 1 && ::String === (last_line = contents[-1]) && (last_line.start_with? '-- ')
210
220
  attribution = (attribution_line = contents.pop).slice 3, attribution_line.length
@@ -224,7 +234,8 @@ module AsciiDoc
224
234
  def convert_codeblock el, opts
225
235
  writer = opts[:writer]
226
236
  # NOTE hack to down-convert level-5 heading to block title
227
- if (current_line = writer.current_line) && (!(current_line.start_with? '.') || (current_line.start_with? '. '))
237
+ if (current_line = writer.current_line) &&
238
+ ((current_line.start_with? '.') ? (current_line == '....' || (current_line.start_with? '. ')) : true)
228
239
  writer.start_block
229
240
  end
230
241
  lines = el.value.rstrip.split LF
@@ -232,14 +243,21 @@ module AsciiDoc
232
243
  if (lang = el.attr['class'])
233
244
  # NOTE Kramdown always prefixes class with language-
234
245
  # TODO remap lang if requested
235
- writer.add_line %([,#{lang = lang.slice 9, lang.length}])
246
+ lang = lang.slice 9, lang.length
247
+ if @diagram_languages.include? lang
248
+ diagram = true
249
+ writer.add_line %([#{lang}])
250
+ else
251
+ writer.add_line %([,#{lang}])
252
+ end
236
253
  elsif (prompt = first_line && (first_line.start_with? '$ '))
237
254
  writer.add_line %([,#{lang = 'console'}]) if lines.include? ''
238
255
  end
239
256
  if lang || (el.options[:fenced] && !prompt)
240
- writer.add_line '----'
257
+ delimiter = diagram ? '....' : '----'
258
+ writer.add_line delimiter
241
259
  writer.add_lines lines
242
- writer.add_line '----'
260
+ writer.add_line delimiter
243
261
  elsif !prompt && ((lines.include? '') || (first_line && (ListMarkerRx.match? first_line)))
244
262
  writer.add_line '....'
245
263
  writer.add_lines lines
@@ -585,8 +603,12 @@ module AsciiDoc
585
603
  when 'sub'
586
604
  opts[:writer].append %(~#{contents}~)
587
605
  else
588
- attrs = (attrs = el.attr).empty? ? '' : attrs.map {|k, v| %( #{k}="#{v}") }.join
589
- opts[:writer].append %(+++<#{tag}#{attrs}>+++#{contents}+++</#{tag}>+++)
606
+ if tag == 'input' && el.attr['type'] == 'checkbox' && el.attr['class'] == 'task-list-item-checkbox'
607
+ opts[:writer].append %([#{el.attr['checked'] ? 'x' : ' '}] )
608
+ else
609
+ attrs = (attrs = el.attr).empty? ? '' : attrs.map {|k, v| %( #{k}="#{v}") }.join
610
+ opts[:writer].append %(+++<#{tag}#{attrs}>+++#{contents}+++</#{tag}>+++)
611
+ end
590
612
  end
591
613
  end
592
614
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kramdown
4
4
  module AsciiDoc
5
- VERSION = '2.0.1'
5
+ VERSION = '2.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-asciidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-07-04 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: rexml
29
29
  requirement: !ruby/object:Gem::Requirement