kramdown-asciidoc 1.0.0.alpha.6 → 1.0.0.alpha.7

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +21 -1
  3. data/README.adoc +50 -1
  4. data/lib/kramdown-asciidoc/cli.rb +4 -0
  5. data/lib/kramdown-asciidoc/converter.rb +129 -36
  6. data/lib/kramdown-asciidoc/version.rb +1 -1
  7. data/lib/kramdown-asciidoc/writer.rb +11 -6
  8. data/spec/cli_spec.rb +63 -19
  9. data/spec/converter_spec.rb +5 -0
  10. data/spec/{integration_spec.rb → scenario_spec.rb} +1 -1
  11. data/spec/scenarios/a/bare-interdoc-xref.adoc +1 -0
  12. data/spec/scenarios/a/bare-interdoc-xref.md +1 -0
  13. data/spec/scenarios/codespan/literal.adoc +7 -1
  14. data/spec/scenarios/codespan/literal.md +7 -1
  15. data/spec/scenarios/codespan/plus-plus.adoc +3 -0
  16. data/spec/scenarios/codespan/plus-plus.md +1 -0
  17. data/spec/scenarios/codespan/star-star.adoc +1 -0
  18. data/spec/scenarios/codespan/star-star.md +1 -0
  19. data/spec/scenarios/codespan/unconstrained.adoc +5 -0
  20. data/spec/scenarios/codespan/unconstrained.md +5 -0
  21. data/spec/scenarios/em/unconstrained.adoc +4 -0
  22. data/spec/scenarios/em/unconstrained.md +4 -0
  23. data/spec/scenarios/strong/unconstrained.adoc +7 -0
  24. data/spec/scenarios/strong/unconstrained.md +7 -0
  25. data/spec/scenarios/text/attribute-reference.adoc +1 -0
  26. data/spec/scenarios/text/attribute-reference.md +1 -0
  27. data/spec/scenarios/text/nbsp.adoc +1 -1
  28. data/spec/scenarios/text/right-arrow.adoc +1 -0
  29. data/spec/scenarios/text/right-arrow.md +1 -0
  30. data/spec/scenarios/wrap/containing-line-comment.adoc +3 -0
  31. data/spec/scenarios/wrap/containing-line-comment.md +3 -0
  32. data/spec/scenarios/wrap/containing-line-comment.opts +1 -0
  33. data/spec/scenarios/wrap/none.adoc +1 -0
  34. data/spec/scenarios/wrap/none.md +4 -0
  35. data/spec/scenarios/wrap/none.opts +1 -0
  36. data/spec/scenarios/wrap/preserve.adoc +5 -0
  37. data/spec/scenarios/wrap/preserve.md +5 -0
  38. data/spec/scenarios/wrap/preserve.opts +1 -0
  39. data/spec/scenarios/wrap/ventilate-table-cell.adoc +6 -0
  40. data/spec/scenarios/wrap/ventilate-table-cell.md +2 -0
  41. data/spec/scenarios/wrap/ventilate-table-cell.opts +1 -0
  42. data/spec/scenarios/wrap/ventilate.adoc +2 -0
  43. data/spec/scenarios/wrap/ventilate.md +6 -0
  44. data/spec/scenarios/wrap/ventilate.opts +1 -0
  45. data/spec/writer_spec.rb +10 -0
  46. metadata +68 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7e7b3ea076bc3a4367cee05e190fd4fb7aa867c941786b122ac5696a0f8869e
4
- data.tar.gz: 8a964360802076fdd8ccd9aa569c810fd90843b84a3394326e7b6b31d8e76f46
3
+ metadata.gz: 0f7bd16c11f904bc9f55ca9ef70d3a925882bd4bdba7f118521a5020676ec4b7
4
+ data.tar.gz: e8e880f21395275db7756e626d77f9f6425d2856b32049174b8074e69717ed30
5
5
  SHA512:
6
- metadata.gz: 0fd80955421722cfa21688637e06d9d94377ab46679df75958ae8e61b6ba4eb80784beea8a90cf8f1ed415389a95b316a5fc8b349a608edb406704123db92c37
7
- data.tar.gz: 284fb8dfbd153aca87bdf10687c24e80995aee0e135709a2aca6b4b22fc4a562e36472c83cd54a7c2d17e6f53a0c7e0fff8056872a29a8218c844078c28fb6af
6
+ metadata.gz: f2fe378e4963ce01c8119e0512021aef55b3cbb6fe1efc1772d4dc2880d9c1b16cd83edfd20363089e83750447d627a8bec4bed88d3af041ed3a6115124af199
7
+ data.tar.gz: a8d1cbea734f4db2d71930c1e5e0f3cc6bc198c24e66117de316c1d4e35e946ed43c7181b0147acd24d73d6f7501ae7d0b6b5d20e175b5f849948a9c7fdebe18
@@ -5,11 +5,31 @@
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
+ == 1.0.0.alpha.7 (2018-07-02) - @mojavelinux
9
+
10
+ === Added
11
+
12
+ * add :wrap option to control line wrapping behavior (:ventilate, :none, and :preserve) (#11)
13
+ * add --wrap CLI option to control :wrap option (#11)
14
+ * add support for unconstrained formatting (em, strong, and codespan) (#6)
15
+ * escape all replaceable text (arrows and ellipses) when converting regular text
16
+ * replace double plus in codespan with \{pp} attribute reference
17
+ * escape attribute references in regular text
18
+ * use passthrough for codespan if text contains an attribute reference
19
+ * use pass macro to escape literal codespan that contains ++
20
+ * escape codespan that contains replacements (#12)
21
+
22
+ === Changed
23
+
24
+ * add replace_line method to Writer
25
+ * replace .md extension with .adoc in text of interdoc xref
26
+ * replace a non-breaking space with a single space instead of \{nbsp}
27
+
8
28
  == 1.0.0.alpha.6 (2018-06-26) - @mojavelinux
9
29
 
10
30
  === Added
11
31
 
12
- * added options and usage to CLI (#2)
32
+ * add options and usage to CLI (#2)
13
33
  * ensure directory of output file exists
14
34
  * add option to enable automatic generation of IDs for section titles
15
35
 
@@ -1,6 +1,6 @@
1
1
  = {project-name} (Markdown to AsciiDoc)
2
2
  Dan Allen <https://github.com/mojavelinux>
3
- v1.0.0.alpha.6, 2018-06-26
3
+ v1.0.0.alpha.7, 2018-07-02
4
4
  // Aliases:
5
5
  :project-name: Kramdown AsciiDoc
6
6
  :project-handle: kramdown-asciidoc
@@ -133,6 +133,55 @@ Then, use the `bundle` command to install the project dependencies under the pro
133
133
 
134
134
  NOTE: You must invoke `bundle` from the project's root directory so it can locate the [.path]_Gemfile_.
135
135
 
136
+ === Run the Tests
137
+
138
+ The test suite is located in the [.path]_spec_ directory.
139
+ The tests are all based on RSpec.
140
+
141
+ Most specs are scenarios, located under the [.path]_spec/scenarios_ directory.
142
+ Each scenario consists of a Markdown file that ends in .md (the given), an AsciiDoc file that ends in .adoc (the then), and an optional options file that ends in .opts.
143
+ The test converts the Markdown to AsciiDoc (the when) and validates the result against what's expected.
144
+ The specification name of each scenario is derived from the directory name.
145
+
146
+ You can run all of the tests using Rake:
147
+
148
+ $ bundle exec rake
149
+
150
+ For more fine-grained control, you can also run the tests directly using RSpec:
151
+
152
+ $ bundle exec rspec
153
+
154
+ To run all the scenarios, point RSpec at the spec file:
155
+
156
+ $ bundle exec rspec spec/scenario_spec.rb
157
+
158
+ ==== Run Individual Tests
159
+
160
+ If you only want to run a single test, or a group of tests, you can do so by tagging the test cases, then filtering the test run using that tag.
161
+
162
+ Start by adding the `wip` tag to one or more specifications:
163
+
164
+ [source,ruby]
165
+ ----
166
+ it 'should do something new', wip: true do
167
+ expect(true).to be true
168
+ end
169
+ ----
170
+
171
+ Next, run RSpec with the `wip` flag enabled:
172
+
173
+ $ bundle exec rspec -t wip
174
+
175
+ RSpec will only run the specifications that contain this flag.
176
+
177
+ You can also filter tests by keyword.
178
+ Let's assume we want to run all the tests that have `wrap` in the description.
179
+ Run RSpec with the example filter:
180
+
181
+ $ bundle exec rspec -e wrap
182
+
183
+ RSpec will only run the specifications that have a description containing the text `wrap`.
184
+
136
185
  === Usage
137
186
 
138
187
  When running the `kramdoc` command from source, you must prefix the command with `bundle exec`:
@@ -33,6 +33,10 @@ module Kramdown; module AsciiDoc
33
33
  options[:attributes][key] = val
34
34
  end
35
35
 
36
+ opts.on '--wrap=preserve|none|ventilate', %w(none preserve ventilate), 'Set how lines are wrapped in the AsciiDoc document (default: preserve)' do |wrap|
37
+ options[:wrap] = wrap.to_sym
38
+ end
39
+
36
40
  opts.on '--heading-offset=NUMBER', 'Shift the heading level by the specified number', ::Integer do |offset|
37
41
  options[:heading_offset] = offset
38
42
  end
@@ -81,18 +81,23 @@ module Kramdown; module AsciiDoc
81
81
 
82
82
  NON_DEFAULT_TABLE_ALIGNMENTS = [:center, :right]
83
83
 
84
+ AccidentalReplacementsRx = /[-=]>|<[-=]|\.\.\.|\{\p{Word}[\p{Word}-]*\}/
84
85
  CommentPrefixRx = /^ *! ?/m
85
86
  CssPropDelimRx = /\s*;\s*/
87
+ FullStopRx = /(?<=\.)\p{Blank}+(?!\Z)/
86
88
  MenuRefRx = /^([\p{Word}&].*?)\s>\s([\p{Word}&].*(?:\s>\s|$))+/
87
- ReplaceableTextRx = /[-=]>|<[-=]|\.\.\./
89
+ ReplaceableTextRx = /[-=]>|<[-=]|--|\*\*|\.\.\.|&\S+;|\{\p{Word}[\p{Word}-]*\}|\((?:C|R|TM)\)/
88
90
  SmartApostropheRx = /\b’\b/
89
91
  TrailingSpaceRx = / +$/
90
92
  TypographicSymbolRx = /[“”‘’—–…]/
93
+ WordishRx = /[\p{Word};:]/
94
+ WordRx = /\p{Word}/
91
95
  XmlCommentRx = /\A<!--(.*)-->\Z/m
92
96
 
93
97
  VoidElement = Element.new nil
94
98
 
95
99
  LF = ?\n
100
+ NBSP = ?\u00a0
96
101
 
97
102
  def initialize root, opts
98
103
  super
@@ -100,6 +105,7 @@ module Kramdown; module AsciiDoc
100
105
  @imagesdir = (@attributes.delete 'implicit-imagesdir') || @attributes['imagesdir']
101
106
  @heading_offset = opts[:heading_offset] || 0
102
107
  @current_heading_level = nil
108
+ @wrap = opts[:wrap] || :preserve
103
109
  end
104
110
 
105
111
  def convert el, opts = {}
@@ -114,7 +120,10 @@ module Kramdown; module AsciiDoc
114
120
  writer.doctitle ||= fallback_doctitle
115
121
  end
116
122
  writer.add_attributes @attributes unless @attributes.empty?
117
- writer.to_s.gsub TrailingSpaceRx, ''
123
+ result = writer.to_s.gsub TrailingSpaceRx, ''
124
+ # QUESTION should we add a preprocessor step to clean the source?
125
+ result = result.tr NBSP, ' ' if result.include? NBSP
126
+ result
118
127
  end
119
128
 
120
129
  def convert_heading el, opts
@@ -141,6 +150,7 @@ module Kramdown; module AsciiDoc
141
150
  end
142
151
  lines = []
143
152
  lines << %([#{style.join}]) unless style.empty?
153
+ # NOTE kramdown removes newlines from heading
144
154
  lines << %(#{'=' * level} #{compose_text el, strip: true})
145
155
  if level == 1 && writer.empty? && @current_heading_level != 1
146
156
  writer.header.push(*lines)
@@ -168,7 +178,7 @@ module Kramdown; module AsciiDoc
168
178
  elsif (child_i = children[0]).type == :text && (child_i_text = child_i.value).start_with?(*ADMON_MARKERS)
169
179
  marker, child_i_text = child_i_text.split ': ', 2
170
180
  children = [(clone child_i, value: %(#{ADMON_TYPE_MAP[marker]}: #{child_i_text}))] + (children.drop 1)
171
- lines = compose_text children, parent: el, strip: true, split: true
181
+ lines = compose_text children, parent: el, strip: true, split: true, wrap: @wrap
172
182
  # NOTE detect formatted admonition marker (e.g., *Note:* ...)
173
183
  elsif (child_i.type == :strong || child_i.type == :em) &&
174
184
  (marker_el = child_i.children[0]) && ((marker = ADMON_FORMATTED_MARKERS[marker_el.value]) ||
@@ -177,10 +187,10 @@ module Kramdown; module AsciiDoc
177
187
  children = children.drop 1
178
188
  children[0] = clone child_ii, value: (child_ii_text.slice 1, child_ii_text.length) if child_ii
179
189
  # Q: should we only rstrip?
180
- lines = compose_text children, parent: el, strip: true, split: true
190
+ lines = compose_text children, parent: el, strip: true, split: true, wrap: @wrap
181
191
  lines.unshift %(#{ADMON_TYPE_MAP[marker]}: #{lines.shift})
182
192
  else
183
- lines = compose_text el, strip: true, split: true
193
+ lines = compose_text el, strip: true, split: true, wrap: @wrap
184
194
  end
185
195
  writer.add_lines lines
186
196
  end
@@ -200,7 +210,7 @@ module Kramdown; module AsciiDoc
200
210
  contents.pop while contents.size > 0 && contents[-1].empty?
201
211
  end
202
212
  # Q: should writer handle delimited block nesting?
203
- delimiter = '____' + (depth > 0 ? '__' * depth : '')
213
+ delimiter = depth > 0 ? ('____' + '__' * depth) : '_'
204
214
  writer.start_delimited_block delimiter
205
215
  writer.add_lines contents
206
216
  writer.end_delimited_block
@@ -231,7 +241,7 @@ module Kramdown; module AsciiDoc
231
241
  writer.add_lines lines
232
242
  writer.add_line '....'
233
243
  else
234
- # NOTE clear the list continuation (is the condition necessary?)
244
+ # NOTE clear the list continuation
235
245
  writer.clear_line if writer.current_line == '+'
236
246
  writer.add_line lines.map {|l| %( #{l}) }
237
247
  end
@@ -299,7 +309,7 @@ module Kramdown; module AsciiDoc
299
309
  indent = (level = opts[:list_level]) - 1
300
310
  if (children = el.children)[0].type == :p
301
311
  primary, remaining = [(children = children.dup).shift, children]
302
- primary_lines = compose_text [primary], parent: el, strip: true, split: true
312
+ primary_lines = compose_text [primary], parent: el, strip: true, split: true, wrap: @wrap
303
313
  else
304
314
  remaining = children
305
315
  primary_lines = ['{blank}']
@@ -314,6 +324,7 @@ module Kramdown; module AsciiDoc
314
324
  end
315
325
 
316
326
  def convert_dt el, opts
327
+ # NOTE kramdown removes newlines from term
317
328
  term = compose_text el, strip: true
318
329
  marker = DLIST_MARKERS[opts[:dlist_level] - 1]
319
330
  #opts[:writer].add_blank_line if (prev = opts[:prev]) && prev.options[:compound]
@@ -326,7 +337,7 @@ module Kramdown; module AsciiDoc
326
337
  remaining = el.children
327
338
  else
328
339
  remaining = (children = el.children).drop 1
329
- primary_lines = compose_text [children[0]], parent: el, strip: true, split: true
340
+ primary_lines = compose_text [children[0]], parent: el, strip: true, split: true, wrap: @wrap
330
341
  if primary_lines.size == 1
331
342
  opts[:writer].append %( #{primary_lines[0]})
332
343
  else
@@ -349,14 +360,22 @@ module Kramdown; module AsciiDoc
349
360
  colspecs = %("#{colspecs}") if cols > 1
350
361
  end
351
362
  table_buffer = ['|===']
363
+ ventilate = @wrap == :ventilate
352
364
  el.children.each do |container|
353
365
  container.children.each do |row|
354
366
  row_buffer = []
355
367
  row.children.each do |cell|
356
- # TODO if using sentence-per-line, append to row_buffer as separate lines
357
- cell_contents = compose_text cell
358
- cell_contents = cell_contents.gsub '|', '\|' if cell_contents.include? '|'
359
- row_buffer << %(| #{cell_contents})
368
+ if ventilate
369
+ cell_contents = (compose_text cell, split: true, wrap: :ventilate).map do |line|
370
+ (line.include? '|') ? (line.gsub '|', '\|') : line
371
+ end
372
+ cell_contents[0] = %(| #{cell_contents[0]})
373
+ row_buffer += cell_contents
374
+ else
375
+ cell_contents = compose_text cell
376
+ cell_contents = cell_contents.gsub '|', '\|' if cell_contents.include? '|'
377
+ row_buffer << %(| #{cell_contents})
378
+ end
360
379
  end
361
380
  if container.type == :thead
362
381
  head = true
@@ -395,43 +414,87 @@ module Kramdown; module AsciiDoc
395
414
  opts[:writer].append bare ? url : %(#{url}[#{text.gsub ']', '\]'}])
396
415
  end
397
416
  elsif url.end_with? '.md'
398
- opts[:writer].append %(xref:#{url.slice 0, url.length - 3}.adoc[#{(compose_text el, strip: true).gsub ']', '\]'}])
417
+ text = (compose_text el, strip: true).gsub ']', '\]'
418
+ text = %(#{text.slice 0, text.length - 3}.adoc) if text.end_with? '.md'
419
+ opts[:writer].append %(xref:#{url.slice 0, url.length - 3}.adoc[#{text}])
399
420
  else
400
421
  opts[:writer].append %(link:#{url}[#{(compose_text el, strip: true).gsub ']', '\]'}])
401
422
  end
402
423
  end
403
424
 
404
425
  def convert_codespan el, opts
405
- opts[:writer].append (val = el.value) =~ ReplaceableTextRx ? %(`+#{val}+`) : %(`#{val}`)
426
+ mark = (unconstrained? opts[:prev], opts[:next], :codespan) ? '``' : '`'
427
+ text = el.value
428
+ pass = (replaceable? text) ? :shorthand : nil
429
+ if text.include? '++'
430
+ if pass
431
+ pass = :macro
432
+ else
433
+ @attributes['pp'] = '{plus}{plus}'
434
+ text = text.gsub '++', '{pp}'
435
+ end
436
+ end
437
+ if pass == :shorthand
438
+ opts[:writer].append %(#{mark}+#{text}+#{mark})
439
+ elsif pass == :macro
440
+ opts[:writer].append %(#{mark}pass:[#{text}]#{mark})
441
+ else
442
+ opts[:writer].append %(#{mark}#{text}#{mark})
443
+ end
406
444
  end
407
445
 
408
446
  def convert_em el, opts
409
- opts[:writer].append %(_#{compose_text el}_)
447
+ composed_text = compose_text el
448
+ mark = (unconstrained? opts[:prev], opts[:next], :em) ? '__' : '_'
449
+ opts[:writer].append %(#{mark}#{composed_text}#{mark})
410
450
  end
411
451
 
412
452
  def convert_strong el, opts
413
- text = compose_text el
414
- if (text.include? ' > ') && MenuRefRx =~ text
453
+ if ((composed_text = compose_text el).include? ' > ') && MenuRefRx =~ composed_text
415
454
  @attributes['experimental'] = ''
416
455
  opts[:writer].append %(menu:#{$1}[#{$2}])
417
456
  else
418
- opts[:writer].append %(*#{text}*)
457
+ mark = (unconstrained? opts[:prev], opts[:next], :strong) ? '**' : '*'
458
+ opts[:writer].append %(#{mark}#{composed_text}#{mark})
419
459
  end
420
460
  end
421
461
 
462
+ def unconstrained? prev_el, next_el, enclosure
463
+ (next_char_word? next_el, enclosure) || (prev_char_wordish? prev_el)
464
+ end
465
+
466
+ def prev_char_wordish? prev_el
467
+ prev_el && (prev_el.type == :entity || ((prev_ch = prev_el.type == :text && prev_el.value[-1]) && (WordishRx.match? prev_ch)))
468
+ end
469
+
470
+ def next_char_word? next_el, enclosure
471
+ if next_el.type == :text
472
+ (next_ch = next_el.value.chr) && ((WordRx.match? next_ch) || (enclosure == :codespan && next_ch == ?'))
473
+ elsif enclosure == :codespan && next_el.type == :smart_quote
474
+ true
475
+ end if next_el
476
+ end
477
+
422
478
  def convert_text el, opts
423
- if (text = el.value).include? '++'
479
+ text = escape_replacements el.value
480
+ if text.include? '++'
424
481
  @attributes['pp'] = '{plus}{plus}'
425
482
  text = text.gsub '++', '{pp}'
426
483
  end
427
- # Q: should we replace with single space instead?
428
- text = text.gsub ' ', '{nbsp}' if text.include? ' '
484
+ opts[:writer].append text
485
+ end
486
+
487
+ def replaceable? text
488
+ (ReplaceableTextRx.match? text) || (text != '^' && (text.include? '^'))
489
+ end
490
+
491
+ def escape_replacements text
492
+ text = text.gsub AccidentalReplacementsRx, '\\\\\0' if AccidentalReplacementsRx.match? text
429
493
  text = text.gsub '^', '{caret}' if (text.include? '^') && text != '^'
430
- text = text.gsub '<=', '\<=' if text.include? '<='
431
494
  unless text.ascii_only?
432
495
  text = (text.gsub SmartApostropheRx, ?').gsub TypographicSymbolRx, TYPOGRAPHIC_SYMBOL_TO_MARKUP
433
496
  end
434
- opts[:writer].append text
497
+ text
435
498
  end
436
499
 
437
500
  # NOTE this logic assumes the :hard_wrap option is disabled in the parser
@@ -443,10 +506,7 @@ module Kramdown; module AsciiDoc
443
506
  writer.append %(#{(writer.current_line.end_with? ' ') ? '' : ' '}+)
444
507
  end
445
508
  if el.options[:html_tag]
446
- siblings = opts[:parent].children
447
- unless (next_el = siblings[(siblings.index el) + 1] || VoidElement).type == :text && (next_el.value.start_with? LF)
448
- writer.add_blank_line
449
- end
509
+ writer.add_blank_line unless (next_el = opts[:next] || VoidElement).type == :text && (next_el.value.start_with? LF)
450
510
  end
451
511
  end
452
512
 
@@ -470,7 +530,7 @@ module Kramdown; module AsciiDoc
470
530
  return
471
531
  elsif child_i_i.value == 'span' && ((role = el.attr['class'] || '').start_with? 'note') && child_i_i.attr['class'] == 'notetitle'
472
532
  marker = ADMON_FORMATTED_MARKERS[(child_i_i.children[0] || VoidElement).value] || 'Note'
473
- lines = compose_text (child_i.children.drop 1), parent: child_i, strip: true, split: true
533
+ lines = compose_text (child_i.children.drop 1), parent: child_i, strip: true, split: true, wrap: @wrap
474
534
  lines.unshift %(#{ADMON_TYPE_MAP[marker]}: #{lines.shift})
475
535
  opts[:writer].start_block
476
536
  opts[:writer].add_lines lines
@@ -512,8 +572,7 @@ module Kramdown; module AsciiDoc
512
572
  else
513
573
  if (current_line = writer.current_line) && !(current_line.end_with? LF)
514
574
  start_new_line = true
515
- # FIXME cleaner API here (writer#strip_line?)
516
- writer.current_line.rstrip! if current_line.end_with? ' '
575
+ writer.replace_line current_line.rstrip if current_line.end_with? ' '
517
576
  end
518
577
  lines = lines.map {|l| %(// #{l}) }
519
578
  if start_new_line
@@ -544,8 +603,7 @@ module Kramdown; module AsciiDoc
544
603
  el
545
604
  end
546
605
 
547
- def traverse el, opts = {}
548
- prev = nil
606
+ def traverse el, opts
549
607
  if ::Array === el
550
608
  nodes = el
551
609
  parent = opts[:parent]
@@ -553,25 +611,60 @@ module Kramdown; module AsciiDoc
553
611
  nodes = (parent = el).children
554
612
  end
555
613
  nodes.each_with_index do |child, idx|
556
- convert child, (opts.merge parent: parent, index: idx, prev: prev)
557
- prev = child
614
+ convert child, (opts.merge parent: parent, index: idx, prev: (idx == 0 ? nil : nodes[idx - 1]), next: nodes[idx + 1])
558
615
  end
559
616
  nil
560
617
  end
561
618
 
562
619
  # Q: should we support rstrip in addition to strip?
563
620
  # TODO add escaping of closing square bracket
564
- # TODO reflow text
565
621
  def compose_text el, opts = {}
566
622
  strip = opts.delete :strip
567
623
  split = opts.delete :split
624
+ wrap = (opts.delete :wrap) || :preserve
568
625
  # Q: do we want to merge or just start fresh?
569
626
  traverse el, (opts.merge writer: (span_writer = Writer.new))
570
627
  # NOTE there should only ever be one line
571
628
  text = span_writer.body.join LF
572
629
  text = text.strip if strip
630
+ text = reflow text, wrap
573
631
  split ? (text.split LF) : text
574
632
  end
633
+
634
+ def reflow str, wrap
635
+ #return str if str.empty?
636
+ case wrap
637
+ when :ventilate
638
+ unwrap str, true
639
+ when :none
640
+ unwrap str
641
+ else # :preserve
642
+ str
643
+ end
644
+ end
645
+
646
+ # NOTE this method requires contiguous non-blank lines
647
+ def unwrap str, ventilate = false
648
+ result = []
649
+ start_new_line = true
650
+ lines = str.split LF
651
+ while (line = lines.shift)
652
+ if line.start_with? '//'
653
+ result << line
654
+ start_new_line = true
655
+ elsif start_new_line
656
+ result << line
657
+ start_new_line = false
658
+ else
659
+ result << %(#{result.pop} #{line})
660
+ end
661
+ end
662
+ if ventilate
663
+ result.map {|line| (line.start_with? '//') ? line : ((line.include? '.') ? (line.gsub FullStopRx, LF) : line) }.join LF
664
+ else
665
+ result.join LF
666
+ end
667
+ end
575
668
  end
576
669
  end; end
577
670
 
@@ -1,3 +1,3 @@
1
1
  module Kramdown; module AsciiDoc
2
- VERSION = '1.0.0.alpha.6'
2
+ VERSION = '1.0.0.alpha.7'
3
3
  end; end
@@ -45,7 +45,7 @@ module Kramdown; module AsciiDoc
45
45
 
46
46
  # Q: perhaps in_list that takes a block?
47
47
  # Q: should we keep stack of list depth?
48
- def start_list compound = false
48
+ def start_list compound
49
49
  @body << '' unless (compound && @block_separator.last == '+') || empty?
50
50
  @block_separator << '+'
51
51
  nil
@@ -70,11 +70,6 @@ module Kramdown; module AsciiDoc
70
70
  nil
71
71
  end
72
72
 
73
- def clear_line
74
- @body[-1] = '' unless empty?
75
- nil
76
- end
77
-
78
73
  def add_blank_line
79
74
  @body << ''
80
75
  nil
@@ -99,6 +94,16 @@ module Kramdown; module AsciiDoc
99
94
  nil
100
95
  end
101
96
 
97
+ def clear_line
98
+ replace_line ''
99
+ end
100
+
101
+ def replace_line line
102
+ @body.pop
103
+ @body << line
104
+ nil
105
+ end
106
+
102
107
  def current_line
103
108
  @body[-1]
104
109
  end
@@ -3,6 +3,8 @@ require 'kramdown-asciidoc/cli'
3
3
  require 'stringio'
4
4
 
5
5
  describe Kramdown::AsciiDoc::Cli do
6
+ subject { Kramdown::AsciiDoc::Cli }
7
+
6
8
  before :each do
7
9
  @old_stdout, $stdout = $stdout, StringIO.new
8
10
  @old_stderr, $stderr = $stderr, StringIO.new
@@ -15,31 +17,31 @@ describe Kramdown::AsciiDoc::Cli do
15
17
  context 'option flags' do
16
18
  it 'returns non-zero exit status and displays usage when no arguments are given' do
17
19
  expected = 'kramdoc: Please specify a Markdown file to convert.'
18
- (expect Kramdown::AsciiDoc::Cli.run []).to eql 1
20
+ (expect subject.run []).to eql 1
19
21
  (expect $stderr.string.chomp).to eql expected
20
22
  (expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
21
23
  end
22
24
 
23
25
  it 'returns non-zero exit status and displays usage when more than one argument is given' do
24
26
  expected = 'kramdoc: extra arguments detected (unparsed arguments: bar.md)'
25
- (expect Kramdown::AsciiDoc::Cli.run %w(foo.md bar.md)).to eql 1
27
+ (expect subject.run %w(foo.md bar.md)).to eql 1
26
28
  (expect $stderr.string.chomp).to eql expected
27
29
  (expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
28
30
  end
29
31
 
30
32
  it 'returns non-zero exit status when invalid argument is given' do
31
- (expect Kramdown::AsciiDoc::Cli.run %w(--invalid-option)).to eql 1
33
+ (expect subject.run %w(--invalid-option)).to eql 1
32
34
  (expect $stderr.string.chomp).to eql 'kramdoc: invalid option: --invalid-option'
33
35
  (expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
34
36
  end
35
37
 
36
38
  it 'displays version when -v flag is used' do
37
- (expect Kramdown::AsciiDoc::Cli.run %w(-v)).to eql 0
39
+ (expect subject.run %w(-v)).to eql 0
38
40
  (expect $stdout.string.chomp).to eql %(kramdoc #{Kramdown::AsciiDoc::VERSION})
39
41
  end
40
42
 
41
43
  it 'displays help when -h flag is used' do
42
- (expect Kramdown::AsciiDoc::Cli.run %w(-h)).to eql 0
44
+ (expect subject.run %w(-h)).to eql 0
43
45
  (expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
44
46
  end
45
47
 
@@ -47,7 +49,7 @@ describe Kramdown::AsciiDoc::Cli do
47
49
  the_source_file = output_file 'implicit-output.md'
48
50
  the_output_file = output_file 'implicit-output.adoc'
49
51
  IO.write the_source_file, 'This is just a test.'
50
- (expect Kramdown::AsciiDoc::Cli.run %W(#{the_source_file})).to eql 0
52
+ (expect subject.run %W(#{the_source_file})).to eql 0
51
53
  (expect (IO.read the_output_file).chomp).to eql 'This is just a test.'
52
54
  end
53
55
 
@@ -55,7 +57,7 @@ describe Kramdown::AsciiDoc::Cli do
55
57
  the_source_file = output_file 'explicit-output.md'
56
58
  the_output_file = output_file 'my-explicit-output.adoc'
57
59
  IO.write the_source_file, 'This is only a test.'
58
- (expect Kramdown::AsciiDoc::Cli.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
60
+ (expect subject.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
59
61
  (expect (IO.read the_output_file).chomp).to eql 'This is only a test.'
60
62
  end
61
63
 
@@ -63,13 +65,13 @@ describe Kramdown::AsciiDoc::Cli do
63
65
  the_source_file = output_file 'ensure-output-dir.md'
64
66
  the_output_file = output_file 'path/to/output/file.adoc'
65
67
  IO.write the_source_file, 'Everything is going to be fine.'
66
- (expect Kramdown::AsciiDoc::Cli.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
68
+ (expect subject.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
67
69
  (expect (IO.read the_output_file).chomp).to eql 'Everything is going to be fine.'
68
70
  end
69
71
 
70
72
  it 'writes output to stdout when -o option equals -' do
71
73
  the_source_file = scenario_file 'p/single-line.md'
72
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - #{the_source_file})).to eql 0
74
+ (expect subject.run %W(-o - #{the_source_file})).to eql 0
73
75
  (expect $stdout.string.chomp).to eql 'A paragraph that consists of a single line.'
74
76
  end
75
77
 
@@ -78,7 +80,7 @@ describe Kramdown::AsciiDoc::Cli do
78
80
  begin
79
81
  $stdin.puts '- list item'
80
82
  $stdin.rewind
81
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - -)).to eql 0
83
+ (expect subject.run %W(-o - -)).to eql 0
82
84
  (expect $stdout.string.chomp).to eql '* list item'
83
85
  ensure
84
86
  $stdin = old_stdin
@@ -87,35 +89,77 @@ describe Kramdown::AsciiDoc::Cli do
87
89
 
88
90
  it 'removes leading blank lines and trailing whitespace from source' do
89
91
  the_source_file = output_file 'leading-trailing-space.md'
90
- IO.write the_source_file, %(\n\n\n\n# Heading\n\ncontent. \n\n)
91
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - #{the_source_file})).to eql 0
92
- (expect $stdout.string.chomp).to eql %(= Heading\n\ncontent.)
92
+ IO.write the_source_file, <<~EOS
93
+ \n\n\n\n
94
+ # Heading
95
+
96
+ Body content.#{' '}
97
+ \n\n\n\n
98
+ EOS
99
+ (expect subject.run %W(-o - #{the_source_file})).to eql 0
100
+ (expect $stdout.string.chomp).to eql %(= Heading\n\nBody content.)
101
+ end
102
+
103
+ it 'processes front matter in source' do
104
+ the_source_file = output_file 'front-matter.md'
105
+ IO.write the_source_file, <<~EOS
106
+ ---
107
+ title: Document Title
108
+ ---
109
+ Body content.
110
+ EOS
111
+ (expect subject.run %W(-o - #{the_source_file})).to eql 0
112
+ (expect $stdout.string.chomp).to eql %(= Document Title\n\nBody content.)
113
+ end
114
+
115
+ it 'replaces explicit toc in source' do
116
+ the_source_file = output_file 'toc.md'
117
+ IO.write the_source_file, <<~EOS
118
+ # Guide
119
+
120
+ <!-- TOC depthFrom:2 depthTo:6 -->
121
+ - [Prerequisites](#prerequisites)
122
+ - [Installation](#installation)
123
+ - [Deployment](#deployment)
124
+ <!-- /TOC -->
125
+
126
+ ...
127
+ EOS
128
+ (expect subject.run %W(-o - #{the_source_file})).to eql 0
129
+ (expect $stdout.string.chomp).to eql %(= Guide\n:toc: macro\n\ntoc::[]\n\n...)
93
130
  end
94
131
 
95
132
  it 'reads Markdown source using specified format' do
96
133
  the_source_file = output_file 'format-markdown.md'
97
134
  IO.write the_source_file, '#Heading'
98
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - --format=markdown #{the_source_file})).to eql 0
135
+ (expect subject.run %W(-o - --format=markdown #{the_source_file})).to eql 0
99
136
  (expect $stdout.string.chomp).to eql '= Heading'
100
137
  end
101
138
 
139
+ it 'wraps output as specified by the --wrap option' do
140
+ the_source_file = scenario_file 'wrap/ventilate.md'
141
+ expected = IO.read scenario_file 'wrap/ventilate.adoc'
142
+ (expect subject.run %W(-o - --wrap=ventilate #{the_source_file})).to eql 0
143
+ (expect $stdout.string).to eql expected
144
+ end
145
+
102
146
  it 'shifts headings by offset when --heading-offset is used' do
103
147
  the_source_file = scenario_file 'heading/offset.md'
104
148
  expected = IO.read scenario_file 'heading/offset.adoc'
105
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - --heading-offset=-1 #{the_source_file})).to eql 0
149
+ (expect subject.run %W(-o - --heading-offset=-1 #{the_source_file})).to eql 0
106
150
  (expect $stdout.string).to eql expected
107
151
  end
108
152
 
109
153
  it 'automatically generates IDs for section titles when --auto-ids is used' do
110
154
  the_source_file = scenario_file 'heading/auto-ids.md'
111
155
  expected = IO.read scenario_file 'heading/auto-ids.adoc'
112
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - --auto-ids #{the_source_file})).to eql 0
156
+ (expect subject.run %W(-o - --auto-ids #{the_source_file})).to eql 0
113
157
  (expect $stdout.string).to eql expected
114
158
  end
115
159
 
116
160
  it 'adds specified attributes to document header' do
117
161
  the_source_file = scenario_file 'root/header-and-body.md'
118
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - -a idprefix -a idseparator=- #{the_source_file})).to eql 0
162
+ (expect subject.run %W(-o - -a idprefix -a idseparator=- #{the_source_file})).to eql 0
119
163
  expected = <<~EOS
120
164
  = Document Title
121
165
  :idprefix:
@@ -128,7 +172,7 @@ describe Kramdown::AsciiDoc::Cli do
128
172
 
129
173
  it 'passes through HTML when --no-html-to-native flag is used' do
130
174
  the_source_file = scenario_file 'html_element/native.md'
131
- (expect Kramdown::AsciiDoc::Cli.run %W(-o - --no-html-to-native #{the_source_file})).to eql 0
175
+ (expect subject.run %W(-o - --no-html-to-native #{the_source_file})).to eql 0
132
176
  expected = <<~EOS
133
177
  +++<p>++++++<strong>+++strong emphasis (aka bold)+++</strong>+++ +++<em>+++emphasis (aka italic)+++</em>+++ +++<code>+++monospace+++</code>++++++</p>+++
134
178
  EOS
@@ -139,7 +183,7 @@ describe Kramdown::AsciiDoc::Cli do
139
183
  old_ARGV = ARGV.dup
140
184
  ARGV.replace %w(-v)
141
185
  begin
142
- (expect Kramdown::AsciiDoc::Cli.run).to eql 0
186
+ (expect subject.run).to eql 0
143
187
  (expect $stdout.string.chomp).to eql %(kramdoc #{Kramdown::AsciiDoc::VERSION})
144
188
  ensure
145
189
  ARGV.replace old_ARGV
@@ -13,6 +13,11 @@ describe Kramdown::AsciiDoc::Converter do
13
13
  (expect converter.convert root).to end_with %(\n)
14
14
  (expect doc.to_asciidoc).to end_with %(\n)
15
15
  end
16
+
17
+ # Q: can we find a scenario that covers this?
18
+ it 'does not crash if element is nil' do
19
+ (expect converter.convert nil).to be_nil
20
+ end
16
21
  end
17
22
 
18
23
  context '#clone' do
@@ -1,7 +1,7 @@
1
1
  require_relative 'spec_helper'
2
2
  require 'yaml'
3
3
 
4
- describe 'integration scenario' do
4
+ describe 'scenario' do
5
5
  let(:doc) { Kramdown::Document.new input, (Kramdown::AsciiDoc::DEFAULT_PARSER_OPTS.merge extra_options) }
6
6
 
7
7
  Dir.chdir scenarios_dir do
@@ -0,0 +1 @@
1
+ See the xref:operations-guide.adoc[operations-guide.adoc].
@@ -0,0 +1 @@
1
+ See the [operations-guide.md](operations-guide.md).
@@ -1,5 +1,11 @@
1
1
  Use the `+<=+` operator to define a version that is less than or equal to a specific version.
2
2
 
3
- Use `+(start...end)+` to create a range from start to end that excludes the last element.
3
+ Use `+(start...end)+` to create a sequence that ranges from `+start--end+`, but excludes the last element.
4
4
 
5
5
  Use an `+<!-- XML comment -->+` to disable or hide markup.
6
+
7
+ In AsciiDoc, `+{name}+` is the syntax for an attribute reference.
8
+
9
+ `pass:[{lang}++]` is simply better than `+{lang}+`.
10
+
11
+ Type `+&copy;+` or `+(C)+` to enter a copyright symbol.
@@ -1,5 +1,11 @@
1
1
  Use the `<=` operator to define a version that is less than or equal to a specific version.
2
2
 
3
- Use `(start...end)` to create a range from start to end that excludes the last element.
3
+ Use `(start...end)` to create a sequence that ranges from `start--end`, but excludes the last element.
4
4
 
5
5
  Use an `<!-- XML comment -->` to disable or hide markup.
6
+
7
+ In AsciiDoc, `{name}` is the syntax for an attribute reference.
8
+
9
+ `{lang}++` is simply better than `{lang}`.
10
+
11
+ Type `&copy;` or `(C)` to enter a copyright symbol.
@@ -0,0 +1,3 @@
1
+ :pp: {plus}{plus}
2
+
3
+ `C{pp}` is hard. `C{pp}` is fast.
@@ -0,0 +1 @@
1
+ `C++` is hard. `C++` is fast.
@@ -0,0 +1 @@
1
+ `+**+` is the exponent operator in Ruby. For example `+4 ** 2+` is 4 to the power of 2 (i.e., 16).
@@ -0,0 +1 @@
1
+ `**` is the exponent operator in Ruby. For example `4 ** 2` is 4 to the power of 2 (i.e., 16).
@@ -0,0 +1,5 @@
1
+ It will be ``npm install``ed (or ``yarn``ed) into `node_modules`.
2
+ Then just run `lerna`--the base command.
3
+ You can re``link`` all related packages using ``lerna``'s `link` command.
4
+ &quot;``foo`` `bar`&quot;
5
+ so `mono` man
@@ -0,0 +1,5 @@
1
+ It will be `npm install`ed (or `yarn`ed) into `node_modules`.
2
+ Then just run `lerna`--the base command.
3
+ You can re`link` all related packages using `lerna`'s `link` command.
4
+ &quot;`foo` `bar`&quot;
5
+ so ``` mono ``` man
@@ -0,0 +1,4 @@
1
+ I want you to __re__read the article.
2
+ You will find that she is _right_.
3
+ Ba__boom__.
4
+ &copy;__the authors__
@@ -0,0 +1,4 @@
1
+ I want you to *re*read the article.
2
+ You will find that she is *right*.
3
+ Ba*boom*.
4
+ &copy;*the authors*
@@ -0,0 +1,7 @@
1
+ **C**reate.
2
+ **R**ead.
3
+ **U**pdate.
4
+ **D**elete.
5
+ Also known as *CRUD*.
6
+ Not to be confused with E**CRU**, which is a color.
7
+ &reg;**CRUD** it is not.
@@ -0,0 +1,7 @@
1
+ **C**reate.
2
+ **R**ead.
3
+ **U**pdate.
4
+ **D**elete.
5
+ Also known as **CRUD**.
6
+ Not to be confused with E**CRU**, which is a color.
7
+ &reg;**CRUD** it is not.
@@ -0,0 +1 @@
1
+ The processor will interpolate #\{variables} in the text.
@@ -0,0 +1 @@
1
+ The processor will interpolate #{variables} in the text.
@@ -1 +1 @@
1
- deceptive{nbsp}spaces{nbsp}live{nbsp}here
1
+ deceptive spaces live here
@@ -0,0 +1 @@
1
+ a \-> b is the most direct route.
@@ -0,0 +1 @@
1
+ a -> b is the most direct route.
@@ -0,0 +1,3 @@
1
+ This is
2
+ // only
3
+ a test.
@@ -0,0 +1,3 @@
1
+ This
2
+ is<!-- only -->a
3
+ test.
@@ -0,0 +1 @@
1
+ This is a test. This is only a test.
@@ -0,0 +1,4 @@
1
+ This
2
+ is
3
+ a
4
+ test. This is only a test.
@@ -0,0 +1 @@
1
+ :wrap: :none
@@ -0,0 +1,5 @@
1
+ This
2
+ is
3
+ a test. This
4
+ is only a
5
+ test.
@@ -0,0 +1,5 @@
1
+ This
2
+ is
3
+ a test. This
4
+ is only a
5
+ test.
@@ -0,0 +1 @@
1
+ :wrap: :preserve
@@ -0,0 +1,6 @@
1
+ [cols=2*]
2
+ |===
3
+ | Turn left.
4
+ Then turn right.
5
+ | left \| right
6
+ |===
@@ -0,0 +1,2 @@
1
+ | --------------------------- | ------------- |
2
+ | Turn left. Then turn right. | left \| right |
@@ -0,0 +1 @@
1
+ :wrap: :ventilate
@@ -0,0 +1,2 @@
1
+ This is a test.
2
+ This is only a test.
@@ -0,0 +1,6 @@
1
+ This
2
+ is
3
+ a
4
+ test. This
5
+ is
6
+ only a test.
@@ -0,0 +1 @@
1
+ :wrap: :ventilate
@@ -0,0 +1,10 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Kramdown::AsciiDoc::Writer do
4
+ it 'replaces existing doctitle if present when assigning doctitle' do
5
+ header_lines = ['[#docid]', '= Document Title', ':experimental:']
6
+ subject.header.push(*header_lines)
7
+ subject.doctitle = 'New Document Title'
8
+ (expect subject.doctitle).to eql 'New Document Title'
9
+ end
10
+ 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: 1.0.0.alpha.6
4
+ version: 1.0.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -88,7 +88,9 @@ files:
88
88
  - lib/kramdown-asciidoc/writer.rb
89
89
  - spec/cli_spec.rb
90
90
  - spec/converter_spec.rb
91
- - spec/integration_spec.rb
91
+ - spec/scenario_spec.rb
92
+ - spec/scenarios/a/bare-interdoc-xref.adoc
93
+ - spec/scenarios/a/bare-interdoc-xref.md
92
94
  - spec/scenarios/a/bare-url.adoc
93
95
  - spec/scenarios/a/bare-url.md
94
96
  - spec/scenarios/a/containing-inline-image.adoc
@@ -153,6 +155,12 @@ files:
153
155
  - spec/scenarios/codespan/constrained.md
154
156
  - spec/scenarios/codespan/literal.adoc
155
157
  - spec/scenarios/codespan/literal.md
158
+ - spec/scenarios/codespan/plus-plus.adoc
159
+ - spec/scenarios/codespan/plus-plus.md
160
+ - spec/scenarios/codespan/star-star.adoc
161
+ - spec/scenarios/codespan/star-star.md
162
+ - spec/scenarios/codespan/unconstrained.adoc
163
+ - spec/scenarios/codespan/unconstrained.md
156
164
  - spec/scenarios/dl/compound-only.adoc
157
165
  - spec/scenarios/dl/compound-only.md
158
166
  - spec/scenarios/dl/compound.adoc
@@ -171,6 +179,8 @@ files:
171
179
  - spec/scenarios/em/constrained.md
172
180
  - spec/scenarios/em/strong.adoc
173
181
  - spec/scenarios/em/strong.md
182
+ - spec/scenarios/em/unconstrained.adoc
183
+ - spec/scenarios/em/unconstrained.md
174
184
  - spec/scenarios/entity/numeric.adoc
175
185
  - spec/scenarios/entity/numeric.md
176
186
  - spec/scenarios/entity/reverse.adoc
@@ -313,6 +323,8 @@ files:
313
323
  - spec/scenarios/strong/menu.md
314
324
  - spec/scenarios/strong/nested-emphasis.adoc
315
325
  - spec/scenarios/strong/nested-emphasis.md
326
+ - spec/scenarios/strong/unconstrained.adoc
327
+ - spec/scenarios/strong/unconstrained.md
316
328
  - spec/scenarios/table/alignment.adoc
317
329
  - spec/scenarios/table/alignment.md
318
330
  - spec/scenarios/table/cell-with-image.adoc
@@ -327,6 +339,8 @@ files:
327
339
  - spec/scenarios/table/with-header.md
328
340
  - spec/scenarios/table/without-header.adoc
329
341
  - spec/scenarios/table/without-header.md
342
+ - spec/scenarios/text/attribute-reference.adoc
343
+ - spec/scenarios/text/attribute-reference.md
330
344
  - spec/scenarios/text/caret.adoc
331
345
  - spec/scenarios/text/caret.md
332
346
  - spec/scenarios/text/lte.adoc
@@ -335,6 +349,8 @@ files:
335
349
  - spec/scenarios/text/nbsp.md
336
350
  - spec/scenarios/text/plus-plus.adoc
337
351
  - spec/scenarios/text/plus-plus.md
352
+ - spec/scenarios/text/right-arrow.adoc
353
+ - spec/scenarios/text/right-arrow.md
338
354
  - spec/scenarios/text/typographic_sym/apostrophe.adoc
339
355
  - spec/scenarios/text/typographic_sym/apostrophe.md
340
356
  - spec/scenarios/text/typographic_sym/double-quotes.adoc
@@ -375,6 +391,21 @@ files:
375
391
  - spec/scenarios/ul/simple-separated.md
376
392
  - spec/scenarios/ul/simple.adoc
377
393
  - spec/scenarios/ul/simple.md
394
+ - spec/scenarios/wrap/containing-line-comment.adoc
395
+ - spec/scenarios/wrap/containing-line-comment.md
396
+ - spec/scenarios/wrap/containing-line-comment.opts
397
+ - spec/scenarios/wrap/none.adoc
398
+ - spec/scenarios/wrap/none.md
399
+ - spec/scenarios/wrap/none.opts
400
+ - spec/scenarios/wrap/preserve.adoc
401
+ - spec/scenarios/wrap/preserve.md
402
+ - spec/scenarios/wrap/preserve.opts
403
+ - spec/scenarios/wrap/ventilate-table-cell.adoc
404
+ - spec/scenarios/wrap/ventilate-table-cell.md
405
+ - spec/scenarios/wrap/ventilate-table-cell.opts
406
+ - spec/scenarios/wrap/ventilate.adoc
407
+ - spec/scenarios/wrap/ventilate.md
408
+ - spec/scenarios/wrap/ventilate.opts
378
409
  - spec/scenarios/xml_comment/above-header.adoc
379
410
  - spec/scenarios/xml_comment/above-header.md
380
411
  - spec/scenarios/xml_comment/at-start-of-line.adoc
@@ -396,6 +427,7 @@ files:
396
427
  - spec/scenarios/xml_comment/styled.adoc
397
428
  - spec/scenarios/xml_comment/styled.md
398
429
  - spec/spec_helper.rb
430
+ - spec/writer_spec.rb
399
431
  homepage: https://github.com/asciidoctor/kramdown-asciidoc
400
432
  licenses:
401
433
  - MIT
@@ -427,7 +459,9 @@ summary: A Markdown to AsciiDoc converter based on kramdown
427
459
  test_files:
428
460
  - spec/cli_spec.rb
429
461
  - spec/converter_spec.rb
430
- - spec/integration_spec.rb
462
+ - spec/scenario_spec.rb
463
+ - spec/scenarios/a/bare-interdoc-xref.adoc
464
+ - spec/scenarios/a/bare-interdoc-xref.md
431
465
  - spec/scenarios/a/bare-url.adoc
432
466
  - spec/scenarios/a/bare-url.md
433
467
  - spec/scenarios/a/containing-inline-image.adoc
@@ -492,6 +526,12 @@ test_files:
492
526
  - spec/scenarios/codespan/constrained.md
493
527
  - spec/scenarios/codespan/literal.adoc
494
528
  - spec/scenarios/codespan/literal.md
529
+ - spec/scenarios/codespan/plus-plus.adoc
530
+ - spec/scenarios/codespan/plus-plus.md
531
+ - spec/scenarios/codespan/star-star.adoc
532
+ - spec/scenarios/codespan/star-star.md
533
+ - spec/scenarios/codespan/unconstrained.adoc
534
+ - spec/scenarios/codespan/unconstrained.md
495
535
  - spec/scenarios/dl/compound-only.adoc
496
536
  - spec/scenarios/dl/compound-only.md
497
537
  - spec/scenarios/dl/compound.adoc
@@ -510,6 +550,8 @@ test_files:
510
550
  - spec/scenarios/em/constrained.md
511
551
  - spec/scenarios/em/strong.adoc
512
552
  - spec/scenarios/em/strong.md
553
+ - spec/scenarios/em/unconstrained.adoc
554
+ - spec/scenarios/em/unconstrained.md
513
555
  - spec/scenarios/entity/numeric.adoc
514
556
  - spec/scenarios/entity/numeric.md
515
557
  - spec/scenarios/entity/reverse.adoc
@@ -652,6 +694,8 @@ test_files:
652
694
  - spec/scenarios/strong/menu.md
653
695
  - spec/scenarios/strong/nested-emphasis.adoc
654
696
  - spec/scenarios/strong/nested-emphasis.md
697
+ - spec/scenarios/strong/unconstrained.adoc
698
+ - spec/scenarios/strong/unconstrained.md
655
699
  - spec/scenarios/table/alignment.adoc
656
700
  - spec/scenarios/table/alignment.md
657
701
  - spec/scenarios/table/cell-with-image.adoc
@@ -666,6 +710,8 @@ test_files:
666
710
  - spec/scenarios/table/with-header.md
667
711
  - spec/scenarios/table/without-header.adoc
668
712
  - spec/scenarios/table/without-header.md
713
+ - spec/scenarios/text/attribute-reference.adoc
714
+ - spec/scenarios/text/attribute-reference.md
669
715
  - spec/scenarios/text/caret.adoc
670
716
  - spec/scenarios/text/caret.md
671
717
  - spec/scenarios/text/lte.adoc
@@ -674,6 +720,8 @@ test_files:
674
720
  - spec/scenarios/text/nbsp.md
675
721
  - spec/scenarios/text/plus-plus.adoc
676
722
  - spec/scenarios/text/plus-plus.md
723
+ - spec/scenarios/text/right-arrow.adoc
724
+ - spec/scenarios/text/right-arrow.md
677
725
  - spec/scenarios/text/typographic_sym/apostrophe.adoc
678
726
  - spec/scenarios/text/typographic_sym/apostrophe.md
679
727
  - spec/scenarios/text/typographic_sym/double-quotes.adoc
@@ -714,6 +762,21 @@ test_files:
714
762
  - spec/scenarios/ul/simple-separated.md
715
763
  - spec/scenarios/ul/simple.adoc
716
764
  - spec/scenarios/ul/simple.md
765
+ - spec/scenarios/wrap/containing-line-comment.adoc
766
+ - spec/scenarios/wrap/containing-line-comment.md
767
+ - spec/scenarios/wrap/containing-line-comment.opts
768
+ - spec/scenarios/wrap/none.adoc
769
+ - spec/scenarios/wrap/none.md
770
+ - spec/scenarios/wrap/none.opts
771
+ - spec/scenarios/wrap/preserve.adoc
772
+ - spec/scenarios/wrap/preserve.md
773
+ - spec/scenarios/wrap/preserve.opts
774
+ - spec/scenarios/wrap/ventilate-table-cell.adoc
775
+ - spec/scenarios/wrap/ventilate-table-cell.md
776
+ - spec/scenarios/wrap/ventilate-table-cell.opts
777
+ - spec/scenarios/wrap/ventilate.adoc
778
+ - spec/scenarios/wrap/ventilate.md
779
+ - spec/scenarios/wrap/ventilate.opts
717
780
  - spec/scenarios/xml_comment/above-header.adoc
718
781
  - spec/scenarios/xml_comment/above-header.md
719
782
  - spec/scenarios/xml_comment/at-start-of-line.adoc
@@ -735,3 +798,4 @@ test_files:
735
798
  - spec/scenarios/xml_comment/styled.adoc
736
799
  - spec/scenarios/xml_comment/styled.md
737
800
  - spec/spec_helper.rb
801
+ - spec/writer_spec.rb