source2md 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +200 -36
  3. data/Rakefile +26 -0
  4. data/doc/0100_top.rb +17 -0
  5. data/doc/0110_code_small.rb +23 -0
  6. data/doc/0120_code_long.rb +23 -0
  7. data/doc/0130_title.rb +21 -0
  8. data/doc/0140_md_like_title.rb +21 -0
  9. data/doc/0150_table.rb +35 -0
  10. data/doc/0160_method.rb +37 -0
  11. data/doc/0170_alert.rb +25 -0
  12. data/doc/0180_text.rb +15 -0
  13. data/doc/0190_raw.rb +19 -0
  14. data/doc/setup.rb +4 -0
  15. data/examples/element_alert.rb +22 -0
  16. data/examples/element_deep_comment.rb +12 -2
  17. data/examples/element_include.rb +20 -0
  18. data/examples/element_md_header.rb +18 -2
  19. data/examples/element_md_title.rb +14 -0
  20. data/examples/element_method.rb +27 -3
  21. data/examples/element_partial_code.rb +22 -0
  22. data/examples/element_reject.rb +11 -0
  23. data/examples/element_source_block.rb +28 -0
  24. data/examples/element_table.rb +18 -6
  25. data/examples/element_text.rb +14 -0
  26. data/examples/element_title.rb +24 -0
  27. data/examples/element_warn.rb +22 -0
  28. data/examples/input.rb +11 -7
  29. data/examples/input.yml +3 -0
  30. data/examples/output.md +7 -22
  31. data/examples/scanner.rb +24 -0
  32. data/examples/setup.rb +1 -1
  33. data/lib/source2md/cli.rb +19 -3
  34. data/lib/source2md/code_block.rb +21 -2
  35. data/lib/source2md/element.rb +36 -13
  36. data/lib/source2md/generator.rb +4 -4
  37. data/lib/source2md/logger.rb +3 -0
  38. data/lib/source2md/scanner.rb +34 -0
  39. data/lib/source2md/{file_block.rb → section.rb} +4 -5
  40. data/lib/source2md/tasks/about.rake +1 -1
  41. data/lib/source2md/text_helper.rb +1 -1
  42. data/lib/source2md/type/base.rb +4 -2
  43. data/lib/source2md/type/element_alert.rb +17 -0
  44. data/lib/source2md/type/element_else.rb +18 -0
  45. data/lib/source2md/type/element_include.rb +45 -0
  46. data/lib/source2md/type/element_md_title.rb +13 -0
  47. data/lib/source2md/type/element_method.rb +1 -1
  48. data/lib/source2md/type/{element_pre.rb → element_partial_code.rb} +2 -2
  49. data/lib/source2md/type/element_source_block.rb +25 -0
  50. data/lib/source2md/type/element_table.rb +4 -4
  51. data/lib/source2md/type/element_title.rb +35 -0
  52. data/lib/source2md/type/element_uncomment.rb +24 -0
  53. data/lib/source2md/type/element_warn.rb +19 -0
  54. data/lib/source2md/version.rb +1 -1
  55. data/lib/source2md.rb +12 -5
  56. data/source2md.gemspec +8 -8
  57. data/spec/code_block_spec.rb +1 -1
  58. data/spec/scanner_spec.rb +26 -0
  59. data/spec/spec_helper.rb +2 -1
  60. data/spec/text_helper_spec.rb +15 -0
  61. data/spec/type/element_alert_spec.rb +16 -0
  62. data/spec/type/element_include_spec.rb +40 -0
  63. data/spec/type/element_md_header_spec.rb +1 -17
  64. data/spec/type/{element_title2_spec.rb → element_md_title_spec.rb} +3 -3
  65. data/spec/type/element_method_spec.rb +5 -5
  66. data/spec/type/{element_pre_spec.rb → element_partial_code_spec.rb} +3 -3
  67. data/spec/type/element_reject_spec.rb +1 -1
  68. data/spec/type/element_source_block_spec.rb +31 -0
  69. data/spec/type/element_table_spec.rb +14 -1
  70. data/spec/type/element_text_spec.rb +1 -1
  71. data/spec/type/{element_deep_comment_spec.rb → element_title_spec.rb} +3 -5
  72. data/spec/type/element_warn_spec.rb +16 -0
  73. data/spec/type/sample.yml +1 -0
  74. metadata +70 -32
  75. data/.rspec +0 -1
  76. data/examples/element_pre.rb +0 -8
  77. data/examples/element_title2.rb +0 -6
  78. data/lib/source2md/type/__element_header_comment.rb +0 -40
  79. data/lib/source2md/type/element_text.rb +0 -26
  80. data/lib/source2md/type/element_title2.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9d5d290b79e8ad279ee4bda3e6266211431849d716d50a5af30619c86bb4dd5
4
- data.tar.gz: 90a98c2ce160304af7782b82bc48869a57fb6962ba77ade63d0f5a107dac19fd
3
+ metadata.gz: e673a10ff2f099c40a723633a4b0f08a4b14e3ada5be2c68ea36172116eabb22
4
+ data.tar.gz: e1c0805eae0c7ff7ee57ad9af917536c163adaa3e09cc02271d20e4f8e9ad457
5
5
  SHA512:
6
- metadata.gz: 5719beeb1cbc4cfd30bf5e2620dc7f23a538f283011a3c801a1a9ce50ba5d9f8c1cd34c544528743192cfbf506ed500c95f416ac9703dcabb0251f0e0763ef39
7
- data.tar.gz: 564b9a9582860c1fee3d7c6b8aac8a44a6bfffc5f898c2d4a1f634b2f23edf86523924a86df15a0d9e35e64f5f379cb27759ba2f98a90c1088cdf4a81899eab3
6
+ metadata.gz: 663438864223b70114d4d4f1ef244dfe54684682c545d2f19fb6d2857e9542683c437d2d08d5b4f3a78b9bdafc0e2c6b211ad47108452b4669fc51d1046964a2
7
+ data.tar.gz: 13283d111e1b965495c3b0a7bd088a7b88136f97749bd396985f0276b199280f9b175ebe10a926f9ca7dbd2def92fd3a2776e4401ad21df7f4f6b0ec837c6a94
data/README.md CHANGED
@@ -1,61 +1,225 @@
1
- # Source2MD: Markdown generator from source code
1
+ # Source2MD: Markdown generator from source code #
2
2
 
3
- input.rb:
3
+ ## Install ##
4
+
5
+ ```
6
+ $ gem i source2md
7
+ ```
8
+
9
+ ## CLI ##
10
+
11
+ ```
12
+ $ source2md generate -o README.md README.rb
13
+ ```
14
+
15
+ ## Rules ##
16
+
17
+ ### Embedding Of Small Code ###
4
18
 
5
19
  ```ruby
6
- # title2: (title)
20
+ puts Source2MD::Section.new(<<~EOS).to_md
21
+ hello = -> {
22
+ "Hello, world!"
23
+ }
24
+
25
+ hello.call
26
+ EOS
27
+ ```
28
+
29
+ > ```ruby
30
+ > hello = -> {
31
+ > "Hello, world!"
32
+ > }
33
+ > ```
34
+
35
+ > ```ruby
36
+ > hello.call
37
+ > ```
38
+
39
+ ### Source Block ###
40
+
41
+ ```ruby
42
+ puts Source2MD::Section.new(<<~EOS).to_md
43
+ #+BEGIN_SRC
44
+ hello = -> {
45
+ "Hello, world!"
46
+ }
47
+
48
+ hello.call
49
+ #+END_SRC
50
+ EOS
51
+ ```
52
+
53
+ > ```ruby
54
+ > hello = -> {
55
+ > "Hello, world!"
56
+ > }
57
+ >
58
+ > hello.call
59
+ > ```
60
+
61
+ ### Title ###
7
62
 
8
- # name: (name1)
9
- # desc: (desc1)
10
- # comment: (comment1)
11
- "foo1".size # => 4
63
+ No number limit.
12
64
 
13
- # name: (name2)
14
- # desc: (desc2)
15
- # comment: (comment2)
16
- "foo2".size # => 4
65
+ ```ruby
66
+ puts Source2MD::Section.new(<<~EOS).to_md
67
+ #+title1: Title Level 1
68
+
69
+ #+title2: Title Level 2
17
70
 
18
- # |---+---+---|
19
- # | x | x | x |
20
- # |---+---+---|
21
- # | x | x | x |
22
- # | x | x | x |
23
- # |---+---+---|
71
+ #+title3: Title Level 3
72
+ EOS
24
73
  ```
25
74
 
26
-
75
+ > # Title Level 1 # #
76
+ >
77
+ > ## Title Level 2 # ##
78
+ >
79
+ > ### Title Level 3 # ###
80
+
81
+ ### Markdown Style Title ###
82
+
83
+ The condition is that there are the same number of sharps on the back.
84
+
85
+ ```ruby
86
+ puts Source2MD::Section.new(<<~EOS).to_md
87
+ # Title Level 1 #
88
+
89
+ ## Title Level 2 ##
27
90
 
28
- ```shell
29
- $ source2md generate -o output.md input.rb
30
- read: input.rb
31
- write: output.md
91
+ ### Title Level 3 ###
92
+ EOS
32
93
  ```
33
94
 
34
-
95
+ > # Title Level 1 #
96
+ >
97
+ > ## Title Level 2 ##
98
+ >
99
+ > ### Title Level 3 ###
35
100
 
36
- ## (title)
101
+ ### Org-mode Table Style ###
37
102
 
38
- ### (name1)
103
+ ```ruby
104
+ puts Source2MD::Section.new(<<~EOS).to_md
105
+ # |------------+-------+--------------------------------------------|
106
+ # | Language | Birth | Creator |
107
+ # |------------+-------+--------------------------------------------|
108
+ # | Lisp | 1958 | John McCarthy |
109
+ # | Fortran | 1957 | John Backus |
110
+ # | COBOL | 1959 | Grace Hopper and team |
111
+ # | Algol | 1958 | International group of computer scientists |
112
+ # | BASIC | 1964 | John G. Kemeny and Thomas E. Kurtz |
113
+ # | Pascal | 1970 | Niklaus Wirth |
114
+ # | C | 1972 | Dennis Ritchie |
115
+ # | Prolog | 1972 | Alain Colmerauer, Robert Kowalski |
116
+ # | C++ | 1983 | Bjarne Stroustrup |
117
+ # | Python | 1989 | Guido van Rossum |
118
+ # |------------+-------+--------------------------------------------|
119
+ EOS
120
+ ```
39
121
 
40
- (desc1)
122
+ > | Language | Birth | Creator |
123
+ > |------------|-------|--------------------------------------------|
124
+ > | Lisp | 1958 | John McCarthy |
125
+ > | Fortran | 1957 | John Backus |
126
+ > | COBOL | 1959 | Grace Hopper and team |
127
+ > | Algol | 1958 | International group of computer scientists |
128
+ > | BASIC | 1964 | John G. Kemeny and Thomas E. Kurtz |
129
+ > | Pascal | 1970 | Niklaus Wirth |
130
+ > | C | 1972 | Dennis Ritchie |
131
+ > | Prolog | 1972 | Alain Colmerauer, Robert Kowalski |
132
+ > | C++ | 1983 | Bjarne Stroustrup |
133
+ > | Python | 1989 | Guido van Rossum |
134
+
135
+ ### Explain the method simply ###
41
136
 
42
137
  ```ruby
43
- "foo1".size # => 4
138
+ puts Source2MD::Section.new(<<~EOS).to_md
139
+ #+name: String#size
140
+ #+desc: Return the number of characters
141
+ #+comment: Comments about size
142
+ "abc".size # => 3
143
+
144
+ #+name: String#reverse
145
+ #+desc: reverse the sequence of characters
146
+ #+comment: Comments about reverse
147
+ "abc".reverse # => "cba"
148
+ EOS
44
149
  ```
45
150
 
46
- (comment1)
151
+ > ### String#size ###
152
+ >
153
+ > Return the number of characters
154
+ >
155
+ > ```ruby
156
+ > "abc".size # => 3
157
+ > ```
158
+ >
159
+ > Comments about size
160
+ >
161
+ > ### String#reverse ###
162
+ >
163
+ > reverse the sequence of characters
164
+ >
165
+ > ```ruby
166
+ > "abc".reverse # => "cba"
167
+ > ```
168
+ >
169
+ > Comments about reverse
170
+
171
+ ### Warning, Alert Message ###
172
+
173
+ Exclusive to Zenn
47
174
 
48
- ### (name2)
175
+ ```ruby
176
+ puts Source2MD::Section.new(<<~EOS).to_md
177
+ #+warn: this is warning message
49
178
 
50
- (desc2)
179
+ #+alert: this is alert message
180
+ EOS
181
+ ```
182
+
183
+ > ```
184
+ > :::message
185
+ > this is warning message
186
+ > :::
187
+ > ```
188
+ >
189
+ > ```
190
+ > :::message alert
191
+ > this is alert message
192
+ > :::
193
+ > ```
194
+
195
+ ### Text ###
196
+
197
+ If no rule applies and the text begins with `#`, remove the `#`.
51
198
 
52
199
  ```ruby
53
- "foo2".size # => 4
200
+ puts Source2MD::Section.new(<<~EOS).to_md
201
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
202
+ # Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
203
+ EOS
54
204
  ```
55
205
 
56
- (comment2)
206
+ > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
207
+ > Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
208
+
209
+ ### Raw Text ###
210
+
211
+ Same rule as when writing text, simply remove the leading `#`.
212
+
213
+ ```ruby
214
+ puts Source2MD::Section.new(<<~EOS).to_md
215
+ # <hr>
216
+ #
217
+ # <hr>
218
+ EOS
219
+ ```
57
220
 
58
- | x | x | x |
59
- |---|---|---|
60
- | x | x | x |
61
- | x | x | x |
221
+ > ```
222
+ > <hr>
223
+ >
224
+ > <hr>
225
+ > ```
data/Rakefile CHANGED
@@ -1,3 +1,29 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
3
  Pathname.glob("lib/source2md/tasks/**/*.rake").each { |file| load(file) }
4
+
5
+ task :g => "doc:generate"
6
+ task :r => "doc:renum"
7
+ task :o => "open"
8
+
9
+ namespace :doc do
10
+ desc "[g] generate README.md"
11
+ task "generate" do
12
+ system "sh", "-vec", <<~EOT, exception: true
13
+ .bin/source2md generate --no-debug --no-xmp-out-exclude -o README.md doc/0*
14
+ EOT
15
+ end
16
+
17
+ desc "renumber"
18
+ task :renum do
19
+ system "sh", "-vec", <<~EOT, exception: true
20
+ saferenum -x doc
21
+ EOT
22
+ end
23
+ end
24
+
25
+ task :open do
26
+ system "sh", "-vec", <<~EOT, exception: true
27
+ open https://github.com/akicho8/source2md
28
+ EOT
29
+ end
data/doc/0100_top.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "./setup"
2
+
3
+ # Source2MD: Markdown generator from source code #
4
+
5
+ ## Install ##
6
+
7
+ # ```
8
+ # $ gem i source2md
9
+ # ```
10
+
11
+ ## CLI ##
12
+
13
+ # ```
14
+ # $ source2md generate -o README.md README.rb
15
+ # ```
16
+
17
+ ## Rules ##
@@ -0,0 +1,23 @@
1
+ require "./setup"
2
+
3
+ ### Embedding Of Small Code ###
4
+
5
+ #+BEGIN_SRC
6
+ puts Source2MD::Section.new(<<~EOS).to_md
7
+ hello = -> {
8
+ "Hello, world!"
9
+ }
10
+
11
+ hello.call
12
+ EOS
13
+ #+END_SRC
14
+
15
+ # > ```ruby
16
+ # > hello = -> {
17
+ # > "Hello, world!"
18
+ # > }
19
+ # > ```
20
+
21
+ # > ```ruby
22
+ # > hello.call
23
+ # > ```
@@ -0,0 +1,23 @@
1
+ require "./setup"
2
+
3
+ ### Source Block ###
4
+
5
+ #+BEGIN_SRC
6
+ puts Source2MD::Section.new(<<~EOS).to_md
7
+ #+BEGIN_SRC
8
+ hello = -> {
9
+ "Hello, world!"
10
+ }
11
+
12
+ hello.call
13
+ #+END_SRC
14
+ EOS
15
+ #+END_SRC
16
+
17
+ # > ```ruby
18
+ # > hello = -> {
19
+ # > "Hello, world!"
20
+ # > }
21
+ # >
22
+ # > hello.call
23
+ # > ```
data/doc/0130_title.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "./setup"
2
+
3
+ ### Title ###
4
+
5
+ # No number limit.
6
+
7
+ #+BEGIN_SRC
8
+ puts Source2MD::Section.new(<<~EOS).to_md
9
+ #+title1: Title Level 1
10
+
11
+ #+title2: Title Level 2
12
+
13
+ #+title3: Title Level 3
14
+ EOS
15
+ #+END_SRC
16
+
17
+ # > # Title Level 1 # #
18
+ # >
19
+ # > ## Title Level 2 # ##
20
+ # >
21
+ # > ### Title Level 3 # ###
@@ -0,0 +1,21 @@
1
+ require "./setup"
2
+
3
+ ### Markdown Style Title ###
4
+
5
+ # The condition is that there are the same number of sharps on the back.
6
+
7
+ #+BEGIN_SRC
8
+ puts Source2MD::Section.new(<<~EOS).to_md
9
+ # Title Level 1 #
10
+
11
+ ## Title Level 2 ##
12
+
13
+ ### Title Level 3 ###
14
+ EOS
15
+ #+END_SRC
16
+
17
+ # > # Title Level 1 #
18
+ # >
19
+ # > ## Title Level 2 ##
20
+ # >
21
+ # > ### Title Level 3 ###
data/doc/0150_table.rb ADDED
@@ -0,0 +1,35 @@
1
+ require "./setup"
2
+
3
+ ### Org-mode Table Style ###
4
+
5
+ #+BEGIN_SRC
6
+ puts Source2MD::Section.new(<<~EOS).to_md
7
+ # |------------+-------+--------------------------------------------|
8
+ # | Language | Birth | Creator |
9
+ # |------------+-------+--------------------------------------------|
10
+ # | Lisp | 1958 | John McCarthy |
11
+ # | Fortran | 1957 | John Backus |
12
+ # | COBOL | 1959 | Grace Hopper and team |
13
+ # | Algol | 1958 | International group of computer scientists |
14
+ # | BASIC | 1964 | John G. Kemeny and Thomas E. Kurtz |
15
+ # | Pascal | 1970 | Niklaus Wirth |
16
+ # | C | 1972 | Dennis Ritchie |
17
+ # | Prolog | 1972 | Alain Colmerauer, Robert Kowalski |
18
+ # | C++ | 1983 | Bjarne Stroustrup |
19
+ # | Python | 1989 | Guido van Rossum |
20
+ # |------------+-------+--------------------------------------------|
21
+ EOS
22
+ #+END_SRC
23
+
24
+ # > | Language | Birth | Creator |
25
+ # > |------------|-------|--------------------------------------------|
26
+ # > | Lisp | 1958 | John McCarthy |
27
+ # > | Fortran | 1957 | John Backus |
28
+ # > | COBOL | 1959 | Grace Hopper and team |
29
+ # > | Algol | 1958 | International group of computer scientists |
30
+ # > | BASIC | 1964 | John G. Kemeny and Thomas E. Kurtz |
31
+ # > | Pascal | 1970 | Niklaus Wirth |
32
+ # > | C | 1972 | Dennis Ritchie |
33
+ # > | Prolog | 1972 | Alain Colmerauer, Robert Kowalski |
34
+ # > | C++ | 1983 | Bjarne Stroustrup |
35
+ # > | Python | 1989 | Guido van Rossum |
@@ -0,0 +1,37 @@
1
+ require "./setup"
2
+
3
+ ### Explain the method simply ###
4
+
5
+ #+BEGIN_SRC
6
+ puts Source2MD::Section.new(<<~EOS).to_md
7
+ #+name: String#size
8
+ #+desc: Return the number of characters
9
+ #+comment: Comments about size
10
+ "abc".size # => 3
11
+
12
+ #+name: String#reverse
13
+ #+desc: reverse the sequence of characters
14
+ #+comment: Comments about reverse
15
+ "abc".reverse # => "cba"
16
+ EOS
17
+ #+END_SRC
18
+
19
+ # > ### String#size ###
20
+ # >
21
+ # > Return the number of characters
22
+ # >
23
+ # > ```ruby
24
+ # > "abc".size # => 3
25
+ # > ```
26
+ # >
27
+ # > Comments about size
28
+ # >
29
+ # > ### String#reverse ###
30
+ # >
31
+ # > reverse the sequence of characters
32
+ # >
33
+ # > ```ruby
34
+ # > "abc".reverse # => "cba"
35
+ # > ```
36
+ # >
37
+ # > Comments about reverse
data/doc/0170_alert.rb ADDED
@@ -0,0 +1,25 @@
1
+ require "./setup"
2
+
3
+ ### Warning, Alert Message ###
4
+
5
+ # Exclusive to Zenn
6
+
7
+ #+BEGIN_SRC
8
+ puts Source2MD::Section.new(<<~EOS).to_md
9
+ #+warn: this is warning message
10
+
11
+ #+alert: this is alert message
12
+ EOS
13
+ #+END_SRC
14
+
15
+ # > ```
16
+ # > :::message
17
+ # > this is warning message
18
+ # > :::
19
+ # > ```
20
+ # >
21
+ # > ```
22
+ # > :::message alert
23
+ # > this is alert message
24
+ # > :::
25
+ # > ```
data/doc/0180_text.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "./setup"
2
+
3
+ ### Text ###
4
+
5
+ # If no rule applies and the text begins with `#`, remove the `#`.
6
+
7
+ #+BEGIN_SRC
8
+ puts Source2MD::Section.new(<<~EOS).to_md
9
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
10
+ # Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
11
+ EOS
12
+ #+END_SRC
13
+
14
+ # > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
15
+ # > Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
data/doc/0190_raw.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "./setup"
2
+
3
+ ### Raw Text ###
4
+
5
+ # Same rule as when writing text, simply remove the leading `#`.
6
+
7
+ #+BEGIN_SRC
8
+ puts Source2MD::Section.new(<<~EOS).to_md
9
+ # <hr>
10
+ #
11
+ # <hr>
12
+ EOS
13
+ #+END_SRC
14
+
15
+ # > ```
16
+ # > <hr>
17
+ # >
18
+ # > <hr>
19
+ # > ```
data/doc/setup.rb ADDED
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
2
+ require "source2md"
3
+ Source2MD.logger.level = :debug if false
4
+
@@ -0,0 +1,22 @@
1
+ require "./setup"
2
+
3
+ puts Source2MD::Element.new(<<~EOS).to_md
4
+ #+alert: (foo)
5
+ EOS
6
+ # >> --------------------------------------------------------------------------------
7
+ # >> Source2MD::Type::ElementAlert
8
+ # >>
9
+ # >> head:
10
+ # >> {:alert=>"(foo)"}
11
+ # >>
12
+ # >> in:
13
+ # >>
14
+ # >>
15
+ # >> out:
16
+ # >> :::message alert
17
+ # >> (foo)
18
+ # >> :::
19
+ # >> --------------------------------------------------------------------------------
20
+ # >> :::message alert
21
+ # >> (foo)
22
+ # >> :::
@@ -1,8 +1,18 @@
1
1
  require "./setup"
2
2
 
3
3
  puts Source2MD::Element.new(<<~EOS).to_md
4
- ## foo
4
+ ## (foo)
5
5
  EOS
6
+ # >> > -------------------------------------------------------------------------------- Source2MD::Type::ElementPartialCode
7
+ # >> > {}
8
+ # >> > ------------------------------------------------------------ in
9
+ # >> > ## (foo)
10
+ # >> >
11
+ # >> > ------------------------------------------------------------ out
12
+ # >> > ```ruby
13
+ # >> > ## (foo)
14
+ # >> > ```
15
+ # >> > ------------------------------------------------------------
6
16
  # >> ```ruby
7
- # >> # foo
17
+ # >> ## (foo)
8
18
  # >> ```
@@ -0,0 +1,20 @@
1
+ require "./setup"
2
+
3
+ puts Source2MD::Element.new(<<~EOS).to_md
4
+
5
+ #+include: input.yml
6
+ #+name:
7
+
8
+ EOS
9
+ # ~> /Users/ikeda/src/source2md/lib/source2md/type/element_include.rb:27:in `read': No such file or directory @ rb_sysopen - /Users/ikeda/src/source2md/examples/input.yml diff xxx:yyy (Errno::ENOENT)
10
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/element_include.rb:27:in `read'
11
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/element_include.rb:27:in `body'
12
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/element_include.rb:17:in `to_md'
13
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/base.rb:25:in `block in initialize'
14
+ # ~> from /opt/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.0.6/lib/active_support/logger_thread_safe_level.rb:58:in `add'
15
+ # ~> from /opt/rbenv/versions/3.2.2/lib/ruby/3.2.0/logger.rb:689:in `debug'
16
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/base.rb:13:in `initialize'
17
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/type/element_include.rb:9:in `initialize'
18
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/element.rb:27:in `new'
19
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/element.rb:27:in `to_md'
20
+ # ~> from -:3:in `<main>'
@@ -2,9 +2,25 @@ require "./setup"
2
2
 
3
3
  puts Source2MD::Element.new(<<~EOS).to_md
4
4
  ---
5
- foo
5
+ (foo)
6
6
  ---
7
7
  EOS
8
+ # >> --------------------------------------------------------------------------------
9
+ # >> Source2MD::Type::ElementMdHeader
10
+ # >>
11
+ # >> head:
12
+ # >> {}
13
+ # >>
14
+ # >> in:
8
15
  # >> ---
9
- # >> foo
16
+ # >> (foo)
17
+ # >> ---
18
+ # >>
19
+ # >> out:
20
+ # >> ---
21
+ # >> (foo)
22
+ # >> ---
23
+ # >> --------------------------------------------------------------------------------
24
+ # >> ---
25
+ # >> (foo)
10
26
  # >> ---
@@ -0,0 +1,14 @@
1
+ require "./setup"
2
+
3
+ puts Source2MD::Element.new(<<~EOS).to_md
4
+ ## foo ##
5
+ EOS
6
+ # >> > -------------------------------------------------------------------------------- Source2MD::Type::ElementMdTitle
7
+ # >> > {}
8
+ # >> > ------------------------------------------------------------ in
9
+ # >> > ## foo ##
10
+ # >> >
11
+ # >> > ------------------------------------------------------------ out
12
+ # >> > ## foo ##
13
+ # >> > ------------------------------------------------------------
14
+ # >> ## foo ##