kramdown-asciidoc 1.0.0.alpha.4 → 1.0.0.alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +15 -0
- data/README.adoc +1 -1
- data/lib/kramdown-asciidoc.rb +1 -0
- data/lib/kramdown-asciidoc/converter.rb +297 -266
- data/lib/kramdown-asciidoc/version.rb +1 -1
- data/lib/kramdown-asciidoc/writer.rb +114 -0
- data/spec/scenarios/blockquote/deep-nested.adoc +3 -0
- data/spec/scenarios/codespan/constrained-triple.adoc +1 -0
- data/spec/scenarios/codespan/constrained-triple.md +1 -0
- data/spec/scenarios/dl/compound.adoc +11 -0
- data/spec/scenarios/{dlist → dl}/compound.md +0 -0
- data/spec/scenarios/dl/nested-mixed.adoc +11 -0
- data/spec/scenarios/{dlist → dl}/nested-mixed.md +0 -0
- data/spec/scenarios/dl/nested.adoc +15 -0
- data/spec/scenarios/{dlist → dl}/nested.md +0 -0
- data/spec/scenarios/dl/simple.adoc +9 -0
- data/spec/scenarios/dl/simple.md +10 -0
- data/spec/scenarios/entity/reverse.adoc +2 -0
- data/spec/scenarios/entity/reverse.md +2 -0
- data/spec/scenarios/p/admonition/in-blockquote.adoc +1 -0
- data/spec/scenarios/p/admonition/in-blockquote.md +1 -0
- data/spec/scenarios/p/admonition/in-compound-blockquote.adoc +5 -0
- data/spec/scenarios/p/admonition/in-compound-blockquote.md +3 -0
- data/spec/scenarios/p/admonition/plain.adoc +2 -0
- data/spec/scenarios/p/admonition/plain.md +2 -0
- data/spec/scenarios/strong/menu.adoc +1 -1
- data/spec/scenarios/table/alignment.adoc +7 -0
- data/spec/scenarios/table/alignment.md +4 -0
- data/spec/scenarios/text/nbsp.adoc +1 -0
- data/spec/scenarios/text/nbsp.md +1 -0
- data/spec/scenarios/xml_comment/line-adjacent-to-text.adoc +2 -0
- data/spec/scenarios/xml_comment/line-adjacent-to-text.md +1 -0
- metadata +39 -18
- data/spec/scenarios/dlist/compound.adoc +0 -13
- data/spec/scenarios/dlist/nested-mixed.adoc +0 -11
- data/spec/scenarios/dlist/nested.adoc +0 -23
- data/spec/scenarios/dlist/simple.adoc +0 -5
- data/spec/scenarios/dlist/simple.md +0 -5
@@ -0,0 +1,114 @@
|
|
1
|
+
module Kramdown; module AsciiDoc
|
2
|
+
class Writer
|
3
|
+
LF = ?\n
|
4
|
+
|
5
|
+
attr_reader :header
|
6
|
+
attr_reader :body
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@header = []
|
10
|
+
@body = []
|
11
|
+
@nesting_stack = []
|
12
|
+
@block_delimiter = nil
|
13
|
+
@block_separator = ''
|
14
|
+
end
|
15
|
+
|
16
|
+
def doctitle
|
17
|
+
if (doctitle_line = @header.find {|l| l.start_with? '= ' })
|
18
|
+
doctitle_line.slice 2, doctitle_line.length
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def doctitle= new_doctitle
|
23
|
+
if (doctitle_idx = @header.index {|l| l.start_with? '= ' })
|
24
|
+
@header[doctitle_idx] = %(= #{new_doctitle})
|
25
|
+
else
|
26
|
+
@header.unshift %(= #{new_doctitle})
|
27
|
+
end
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def add_attributes attributes
|
32
|
+
attributes.each {|k, v| add_attribute k, v }
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_attribute name, value
|
37
|
+
@header << %(:#{name}:#{value.empty? ? '' : ' ' + value.to_s})
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def start_block
|
42
|
+
@body << @block_separator unless empty?
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
# Q: perhaps in_list that takes a block?
|
47
|
+
# Q: should we keep stack of list depth?
|
48
|
+
def start_list compound_nested = false
|
49
|
+
@body << '' unless compound_nested || empty?
|
50
|
+
@block_separator = '+'
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def end_list nested = false
|
55
|
+
@block_separator = '' unless nested
|
56
|
+
nil
|
57
|
+
end
|
58
|
+
|
59
|
+
def start_delimited_block delimiter
|
60
|
+
@body << (@block_delimiter = delimiter.length == 1 ? delimiter * 4 : delimiter)
|
61
|
+
@nesting_stack << [(@body.pop @body.length), @block_delimiter, @block_separator]
|
62
|
+
@block_separator = ''
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
|
66
|
+
def end_delimited_block
|
67
|
+
parent_body, @block_delimiter, @block_separator = @nesting_stack.pop
|
68
|
+
@body = (parent_body + @body) << @block_delimiter
|
69
|
+
@block_delimiter = nil
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def clear_line
|
74
|
+
@body[-1] = '' unless empty?
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_blank_line
|
79
|
+
@body << ''
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_line line
|
84
|
+
@body << line
|
85
|
+
nil
|
86
|
+
end
|
87
|
+
|
88
|
+
def add_lines lines
|
89
|
+
@body += lines
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
|
93
|
+
def append str
|
94
|
+
if empty?
|
95
|
+
@body << str
|
96
|
+
else
|
97
|
+
@body[-1] += str
|
98
|
+
end
|
99
|
+
nil
|
100
|
+
end
|
101
|
+
|
102
|
+
def current_line
|
103
|
+
@body[-1]
|
104
|
+
end
|
105
|
+
|
106
|
+
def empty?
|
107
|
+
@body.empty?
|
108
|
+
end
|
109
|
+
|
110
|
+
def to_s
|
111
|
+
((@header.empty? ? @body : (@header + (@body.empty? ? [] : ['']) + @body)).join LF) + LF
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end; end
|
@@ -0,0 +1 @@
|
|
1
|
+
A standard login form contains a `username` and a `password` field.
|
@@ -0,0 +1 @@
|
|
1
|
+
A standard login form contains a ```username``` and a ```password``` field.
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
kramdown
|
2
|
+
: A Markdown-superset converter (aren't they all?)
|
3
|
+
|
4
|
+
kramdown-asciidoc
|
5
|
+
: A Markdown to AsciiDoc converter;
|
6
|
+
based on kramdown
|
7
|
+
|
8
|
+
asciidoctor
|
9
|
+
: The modern AsciiDoc converter.
|
10
|
+
This tool will come in handy once you've made the switch to AsciiDoc.
|
@@ -0,0 +1 @@
|
|
1
|
+
NOTE: The `npm install <package>` command uses the `latest` tag by default.
|
@@ -0,0 +1 @@
|
|
1
|
+
> Note: The `npm install <package>` command uses the `latest` tag by default.
|
@@ -0,0 +1 @@
|
|
1
|
+
deceptive{nbsp}spaces{nbsp}live{nbsp}here
|
@@ -0,0 +1 @@
|
|
1
|
+
deceptive spaces live here
|
@@ -0,0 +1 @@
|
|
1
|
+
$5,000 off<!-- price after rebate -->
|
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.
|
4
|
+
version: 1.0.0.alpha.5
|
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-
|
11
|
+
date: 2018-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/kramdown-asciidoc.rb
|
85
85
|
- lib/kramdown-asciidoc/converter.rb
|
86
86
|
- lib/kramdown-asciidoc/version.rb
|
87
|
+
- lib/kramdown-asciidoc/writer.rb
|
87
88
|
- spec/converter_spec.rb
|
88
89
|
- spec/integration_spec.rb
|
89
90
|
- spec/scenarios/a/bare-url.adoc
|
@@ -144,18 +145,20 @@ files:
|
|
144
145
|
- spec/scenarios/codeblock/with-command-prompt.md
|
145
146
|
- spec/scenarios/codeblock/with-non-contiguous-command-prompts.adoc
|
146
147
|
- spec/scenarios/codeblock/with-non-contiguous-command-prompts.md
|
148
|
+
- spec/scenarios/codespan/constrained-triple.adoc
|
149
|
+
- spec/scenarios/codespan/constrained-triple.md
|
147
150
|
- spec/scenarios/codespan/constrained.adoc
|
148
151
|
- spec/scenarios/codespan/constrained.md
|
149
152
|
- spec/scenarios/codespan/literal.adoc
|
150
153
|
- spec/scenarios/codespan/literal.md
|
151
|
-
- spec/scenarios/
|
152
|
-
- spec/scenarios/
|
153
|
-
- spec/scenarios/
|
154
|
-
- spec/scenarios/
|
155
|
-
- spec/scenarios/
|
156
|
-
- spec/scenarios/
|
157
|
-
- spec/scenarios/
|
158
|
-
- spec/scenarios/
|
154
|
+
- spec/scenarios/dl/compound.adoc
|
155
|
+
- spec/scenarios/dl/compound.md
|
156
|
+
- spec/scenarios/dl/nested-mixed.adoc
|
157
|
+
- spec/scenarios/dl/nested-mixed.md
|
158
|
+
- spec/scenarios/dl/nested.adoc
|
159
|
+
- spec/scenarios/dl/nested.md
|
160
|
+
- spec/scenarios/dl/simple.adoc
|
161
|
+
- spec/scenarios/dl/simple.md
|
159
162
|
- spec/scenarios/em/asterisks.adoc
|
160
163
|
- spec/scenarios/em/asterisks.md
|
161
164
|
- spec/scenarios/em/constrained.adoc
|
@@ -262,6 +265,10 @@ files:
|
|
262
265
|
- spec/scenarios/ol/simple.md
|
263
266
|
- spec/scenarios/p/admonition/emphasis.adoc
|
264
267
|
- spec/scenarios/p/admonition/emphasis.md
|
268
|
+
- spec/scenarios/p/admonition/in-blockquote.adoc
|
269
|
+
- spec/scenarios/p/admonition/in-blockquote.md
|
270
|
+
- spec/scenarios/p/admonition/in-compound-blockquote.adoc
|
271
|
+
- spec/scenarios/p/admonition/in-compound-blockquote.md
|
265
272
|
- spec/scenarios/p/admonition/in-list-item.adoc
|
266
273
|
- spec/scenarios/p/admonition/in-list-item.md
|
267
274
|
- spec/scenarios/p/admonition/plain.adoc
|
@@ -312,6 +319,8 @@ files:
|
|
312
319
|
- spec/scenarios/text/caret.md
|
313
320
|
- spec/scenarios/text/lte.adoc
|
314
321
|
- spec/scenarios/text/lte.md
|
322
|
+
- spec/scenarios/text/nbsp.adoc
|
323
|
+
- spec/scenarios/text/nbsp.md
|
315
324
|
- spec/scenarios/text/plus-plus.adoc
|
316
325
|
- spec/scenarios/text/plus-plus.md
|
317
326
|
- spec/scenarios/text/typographic_sym/apostrophe.adoc
|
@@ -358,6 +367,8 @@ files:
|
|
358
367
|
- spec/scenarios/xml_comment/at-start-of-line.md
|
359
368
|
- spec/scenarios/xml_comment/block.adoc
|
360
369
|
- spec/scenarios/xml_comment/block.md
|
370
|
+
- spec/scenarios/xml_comment/line-adjacent-to-text.adoc
|
371
|
+
- spec/scenarios/xml_comment/line-adjacent-to-text.md
|
361
372
|
- spec/scenarios/xml_comment/line-offset-by-space.adoc
|
362
373
|
- spec/scenarios/xml_comment/line-offset-by-space.md
|
363
374
|
- spec/scenarios/xml_comment/line.adoc
|
@@ -460,18 +471,20 @@ test_files:
|
|
460
471
|
- spec/scenarios/codeblock/with-command-prompt.md
|
461
472
|
- spec/scenarios/codeblock/with-non-contiguous-command-prompts.adoc
|
462
473
|
- spec/scenarios/codeblock/with-non-contiguous-command-prompts.md
|
474
|
+
- spec/scenarios/codespan/constrained-triple.adoc
|
475
|
+
- spec/scenarios/codespan/constrained-triple.md
|
463
476
|
- spec/scenarios/codespan/constrained.adoc
|
464
477
|
- spec/scenarios/codespan/constrained.md
|
465
478
|
- spec/scenarios/codespan/literal.adoc
|
466
479
|
- spec/scenarios/codespan/literal.md
|
467
|
-
- spec/scenarios/
|
468
|
-
- spec/scenarios/
|
469
|
-
- spec/scenarios/
|
470
|
-
- spec/scenarios/
|
471
|
-
- spec/scenarios/
|
472
|
-
- spec/scenarios/
|
473
|
-
- spec/scenarios/
|
474
|
-
- spec/scenarios/
|
480
|
+
- spec/scenarios/dl/compound.adoc
|
481
|
+
- spec/scenarios/dl/compound.md
|
482
|
+
- spec/scenarios/dl/nested-mixed.adoc
|
483
|
+
- spec/scenarios/dl/nested-mixed.md
|
484
|
+
- spec/scenarios/dl/nested.adoc
|
485
|
+
- spec/scenarios/dl/nested.md
|
486
|
+
- spec/scenarios/dl/simple.adoc
|
487
|
+
- spec/scenarios/dl/simple.md
|
475
488
|
- spec/scenarios/em/asterisks.adoc
|
476
489
|
- spec/scenarios/em/asterisks.md
|
477
490
|
- spec/scenarios/em/constrained.adoc
|
@@ -578,6 +591,10 @@ test_files:
|
|
578
591
|
- spec/scenarios/ol/simple.md
|
579
592
|
- spec/scenarios/p/admonition/emphasis.adoc
|
580
593
|
- spec/scenarios/p/admonition/emphasis.md
|
594
|
+
- spec/scenarios/p/admonition/in-blockquote.adoc
|
595
|
+
- spec/scenarios/p/admonition/in-blockquote.md
|
596
|
+
- spec/scenarios/p/admonition/in-compound-blockquote.adoc
|
597
|
+
- spec/scenarios/p/admonition/in-compound-blockquote.md
|
581
598
|
- spec/scenarios/p/admonition/in-list-item.adoc
|
582
599
|
- spec/scenarios/p/admonition/in-list-item.md
|
583
600
|
- spec/scenarios/p/admonition/plain.adoc
|
@@ -628,6 +645,8 @@ test_files:
|
|
628
645
|
- spec/scenarios/text/caret.md
|
629
646
|
- spec/scenarios/text/lte.adoc
|
630
647
|
- spec/scenarios/text/lte.md
|
648
|
+
- spec/scenarios/text/nbsp.adoc
|
649
|
+
- spec/scenarios/text/nbsp.md
|
631
650
|
- spec/scenarios/text/plus-plus.adoc
|
632
651
|
- spec/scenarios/text/plus-plus.md
|
633
652
|
- spec/scenarios/text/typographic_sym/apostrophe.adoc
|
@@ -674,6 +693,8 @@ test_files:
|
|
674
693
|
- spec/scenarios/xml_comment/at-start-of-line.md
|
675
694
|
- spec/scenarios/xml_comment/block.adoc
|
676
695
|
- spec/scenarios/xml_comment/block.md
|
696
|
+
- spec/scenarios/xml_comment/line-adjacent-to-text.adoc
|
697
|
+
- spec/scenarios/xml_comment/line-adjacent-to-text.md
|
677
698
|
- spec/scenarios/xml_comment/line-offset-by-space.adoc
|
678
699
|
- spec/scenarios/xml_comment/line-offset-by-space.md
|
679
700
|
- spec/scenarios/xml_comment/line.adoc
|