source2md 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +196 -40
  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 -16
  17. data/examples/element_include.rb +20 -0
  18. data/examples/element_md_header.rb +4 -4
  19. data/examples/element_md_title.rb +14 -0
  20. data/examples/element_method.rb +3 -3
  21. data/examples/{element_pre.rb → element_partial_code.rb} +5 -5
  22. data/examples/element_source_block.rb +28 -0
  23. data/examples/element_table.rb +17 -25
  24. data/examples/element_text.rb +1 -1
  25. data/examples/{element_title2.rb → element_title.rb} +12 -8
  26. data/examples/element_warn.rb +22 -0
  27. data/examples/input.rb +11 -7
  28. data/examples/input.yml +3 -0
  29. data/examples/output.md +7 -22
  30. data/examples/scanner.rb +24 -0
  31. data/examples/setup.rb +1 -1
  32. data/lib/source2md/cli.rb +8 -1
  33. data/lib/source2md/code_block.rb +21 -2
  34. data/lib/source2md/element.rb +36 -13
  35. data/lib/source2md/generator.rb +4 -4
  36. data/lib/source2md/scanner.rb +34 -0
  37. data/lib/source2md/{file_block.rb → section.rb} +4 -5
  38. data/lib/source2md/text_helper.rb +1 -1
  39. data/lib/source2md/type/base.rb +4 -19
  40. data/lib/source2md/type/element_alert.rb +17 -0
  41. data/lib/source2md/type/element_else.rb +18 -0
  42. data/lib/source2md/type/element_include.rb +45 -0
  43. data/lib/source2md/type/element_md_title.rb +13 -0
  44. data/lib/source2md/type/element_method.rb +1 -1
  45. data/lib/source2md/type/{element_pre.rb → element_partial_code.rb} +2 -2
  46. data/lib/source2md/type/element_source_block.rb +25 -0
  47. data/lib/source2md/type/element_table.rb +4 -4
  48. data/lib/source2md/type/element_title.rb +35 -0
  49. data/lib/source2md/type/element_uncomment.rb +24 -0
  50. data/lib/source2md/type/element_warn.rb +19 -0
  51. data/lib/source2md/version.rb +1 -1
  52. data/lib/source2md.rb +2 -0
  53. data/source2md.gemspec +4 -3
  54. data/spec/code_block_spec.rb +1 -1
  55. data/spec/scanner_spec.rb +26 -0
  56. data/spec/spec_helper.rb +1 -0
  57. data/spec/text_helper_spec.rb +15 -0
  58. data/spec/type/element_alert_spec.rb +16 -0
  59. data/spec/type/element_include_spec.rb +40 -0
  60. data/spec/type/element_md_header_spec.rb +1 -17
  61. data/spec/type/{element_title2_spec.rb → element_md_title_spec.rb} +3 -3
  62. data/spec/type/element_method_spec.rb +5 -5
  63. data/spec/type/{element_pre_spec.rb → element_partial_code_spec.rb} +3 -3
  64. data/spec/type/element_reject_spec.rb +1 -1
  65. data/spec/type/element_source_block_spec.rb +31 -0
  66. data/spec/type/element_table_spec.rb +14 -1
  67. data/spec/type/element_text_spec.rb +1 -1
  68. data/spec/type/{element_deep_comment_spec.rb → element_title_spec.rb} +3 -5
  69. data/spec/type/element_warn_spec.rb +16 -0
  70. data/spec/type/sample.yml +1 -0
  71. metadata +70 -17
  72. data/lib/source2md/type/element_text.rb +0 -26
  73. data/lib/source2md/type/element_title2.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 804f40a21fe77faa747a631bd93fa6592d7bf035858fd4a8ba795f776dcb512b
4
- data.tar.gz: 5f6d342b20388915027fa33c6d1d1a644ac5c28c56febd4e612ba318c14df375
3
+ metadata.gz: e673a10ff2f099c40a723633a4b0f08a4b14e3ada5be2c68ea36172116eabb22
4
+ data.tar.gz: e1c0805eae0c7ff7ee57ad9af917536c163adaa3e09cc02271d20e4f8e9ad457
5
5
  SHA512:
6
- metadata.gz: 7dabbca4c2adf8136803fa1c1184975e1e41484620ac1350507fa196254202fcc3b5dde0f59fe31206472782274b4785048fad1b92e6ebee0873839b12b68a46
7
- data.tar.gz: e46f3cf966becc687447b2394e9a02ba26ecd8d6ea2463049cfaf3a596f99bf5de3d5de2fbfede43db2ca2ca2c5fb206025731415ac78f5eeb93532193d03132
6
+ metadata.gz: 663438864223b70114d4d4f1ef244dfe54684682c545d2f19fb6d2857e9542683c437d2d08d5b4f3a78b9bdafc0e2c6b211ad47108452b4669fc51d1046964a2
7
+ data.tar.gz: 13283d111e1b965495c3b0a7bd088a7b88136f97749bd396985f0276b199280f9b175ebe10a926f9ca7dbd2def92fd3a2776e4401ad21df7f4f6b0ec837c6a94
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Source2MD: Markdown generator from source code
1
+ # Source2MD: Markdown generator from source code #
2
2
 
3
3
  ## Install ##
4
4
 
@@ -6,64 +6,220 @@
6
6
  $ gem i source2md
7
7
  ```
8
8
 
9
- ## Example ##
9
+ ## CLI ##
10
10
 
11
- input.rb:
11
+ ```
12
+ $ source2md generate -o README.md README.rb
13
+ ```
14
+
15
+ ## Rules ##
16
+
17
+ ### Embedding Of Small Code ###
18
+
19
+ ```ruby
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 ###
12
40
 
13
41
  ```ruby
14
- # title2: (title)
15
-
16
- # name: (name1)
17
- # desc: (desc1)
18
- # comment: (comment1)
19
- "foo1".size # => 4
20
-
21
- # name: (name2)
22
- # desc: (desc2)
23
- # comment: (comment2)
24
- "foo2".size # => 4
25
-
26
- # |---+---+---|
27
- # | x | x | x |
28
- # |---+---+---|
29
- # | x | x | x |
30
- # | x | x | x |
31
- # |---+---+---|
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 ###
62
+
63
+ No number limit.
64
+
65
+ ```ruby
66
+ puts Source2MD::Section.new(<<~EOS).to_md
67
+ #+title1: Title Level 1
68
+
69
+ #+title2: Title Level 2
70
+
71
+ #+title3: Title Level 3
72
+ EOS
32
73
  ```
33
74
 
34
-
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 #
35
88
 
36
- ```shell
37
- $ source2md generate -o output.md input.rb
38
- read: input.rb
39
- write: output.md
89
+ ## Title Level 2 ##
90
+
91
+ ### Title Level 3 ###
92
+ EOS
40
93
  ```
41
94
 
42
-
95
+ > # Title Level 1 #
96
+ >
97
+ > ## Title Level 2 ##
98
+ >
99
+ > ### Title Level 3 ###
100
+
101
+ ### Org-mode Table Style ###
102
+
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
+ ```
43
121
 
44
- ## (title)
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 ###
45
136
 
46
- ### (name1)
137
+ ```ruby
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
149
+ ```
47
150
 
48
- (desc1)
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
49
174
 
50
175
  ```ruby
51
- "foo1".size # => 4
176
+ puts Source2MD::Section.new(<<~EOS).to_md
177
+ #+warn: this is warning message
178
+
179
+ #+alert: this is alert message
180
+ EOS
52
181
  ```
53
182
 
54
- (comment1)
183
+ > ```
184
+ > :::message
185
+ > this is warning message
186
+ > :::
187
+ > ```
188
+ >
189
+ > ```
190
+ > :::message alert
191
+ > this is alert message
192
+ > :::
193
+ > ```
55
194
 
56
- ### (name2)
195
+ ### Text ###
57
196
 
58
- (desc2)
197
+ If no rule applies and the text begins with `#`, remove the `#`.
59
198
 
60
199
  ```ruby
61
- "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
62
204
  ```
63
205
 
64
- (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
+ ```
65
220
 
66
- | x | x | x |
67
- |---|---|---|
68
- | x | x | x |
69
- | 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,22 +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
- # >> --------------------------------------------------------------------------------
7
- # >> Source2MD::Type::ElementDeepComment
8
- # >>
9
- # >> head:
10
- # >> {}
11
- # >>
12
- # >> in:
13
- # >> ## foo
14
- # >>
15
- # >> out:
6
+ # >> > -------------------------------------------------------------------------------- Source2MD::Type::ElementPartialCode
7
+ # >> > {}
8
+ # >> > ------------------------------------------------------------ in
9
+ # >> > ## (foo)
10
+ # >> >
11
+ # >> > ------------------------------------------------------------ out
12
+ # >> > ```ruby
13
+ # >> > ## (foo)
14
+ # >> > ```
15
+ # >> > ------------------------------------------------------------
16
16
  # >> ```ruby
17
- # >> # foo
18
- # >> ```
19
- # >> --------------------------------------------------------------------------------
20
- # >> ```ruby
21
- # >> # foo
17
+ # >> ## (foo)
22
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,7 +2,7 @@ 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
8
  # >> --------------------------------------------------------------------------------
@@ -13,14 +13,14 @@ EOS
13
13
  # >>
14
14
  # >> in:
15
15
  # >> ---
16
- # >> foo
16
+ # >> (foo)
17
17
  # >> ---
18
18
  # >>
19
19
  # >> out:
20
20
  # >> ---
21
- # >> foo
21
+ # >> (foo)
22
22
  # >> ---
23
23
  # >> --------------------------------------------------------------------------------
24
24
  # >> ---
25
- # >> foo
25
+ # >> (foo)
26
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 ##