source2md 0.0.4 → 0.0.5

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +112 -29
  3. data/Rakefile +1 -0
  4. data/doc/0100_top.rb +7 -0
  5. data/doc/0110_code_small.rb +4 -1
  6. data/doc/0120_code_long.rb +2 -1
  7. data/doc/0130_hidden.rb +17 -0
  8. data/doc/0140_code_include.rb +26 -0
  9. data/doc/0150_raw_include.rb +16 -0
  10. data/doc/{0130_title.rb → 0160_title.rb} +8 -5
  11. data/doc/{0140_md_like_title.rb → 0170_md_like_title.rb} +9 -6
  12. data/doc/{0150_table.rb → 0180_table.rb} +2 -1
  13. data/doc/{0160_method.rb → 0190_method.rb} +2 -1
  14. data/doc/{0170_alert.rb → 0200_alert.rb} +2 -1
  15. data/doc/0210_text.rb +18 -0
  16. data/doc/0220_text_oneline.rb +18 -0
  17. data/doc/0230_parse_include.rb +18 -0
  18. data/examples/cli.rb +1 -0
  19. data/examples/element_text.rb +2 -1
  20. data/examples/scanner.rb +1 -0
  21. data/examples/{element_alert.rb → type_alert.rb} +6 -5
  22. data/examples/type_code_include.rb +21 -0
  23. data/examples/{element_md_header.rb → type_hidden.rb} +2 -1
  24. data/examples/{element_md_title.rb → type_md_title.rb} +2 -1
  25. data/examples/{element_method.rb → type_method.rb} +2 -1
  26. data/examples/{element_partial_code.rb → type_partial_code.rb} +2 -1
  27. data/examples/{element_source_block.rb → type_source_block.rb} +2 -1
  28. data/examples/{element_table.rb → type_table.rb} +1 -0
  29. data/examples/{element_deep_comment.rb → type_text.rb} +16 -10
  30. data/examples/{element_title.rb → type_title.rb} +2 -1
  31. data/examples/{element_warn.rb → type_warn.rb} +2 -1
  32. data/lib/source2md/code_block.rb +12 -6
  33. data/lib/source2md/element.rb +17 -16
  34. data/lib/source2md/{type → formatter}/base.rb +4 -5
  35. data/lib/source2md/{type/element_alert.rb → formatter/type_alert.rb} +4 -4
  36. data/lib/source2md/{type/element_include.rb → formatter/type_code_include.rb} +5 -5
  37. data/lib/source2md/{type/element_else.rb → formatter/type_else.rb} +2 -2
  38. data/lib/source2md/{type/element_reject.rb → formatter/type_hidden.rb} +4 -3
  39. data/lib/source2md/{type/element_md_title.rb → formatter/type_md_title.rb} +2 -2
  40. data/lib/source2md/formatter/type_method.rb +24 -0
  41. data/lib/source2md/formatter/type_parse_include.rb +13 -0
  42. data/lib/source2md/{type/element_partial_code.rb → formatter/type_partial_code.rb} +2 -2
  43. data/lib/source2md/formatter/type_raw_include.rb +13 -0
  44. data/lib/source2md/{type/element_source_block.rb → formatter/type_source_block.rb} +2 -2
  45. data/lib/source2md/{type/element_table.rb → formatter/type_table.rb} +2 -2
  46. data/lib/source2md/formatter/type_text.rb +31 -0
  47. data/lib/source2md/{type/element_title.rb → formatter/type_title.rb} +2 -2
  48. data/lib/source2md/{type/element_warn.rb → formatter/type_warn.rb} +4 -4
  49. data/lib/source2md/generator.rb +3 -3
  50. data/lib/source2md/scanner.rb +2 -2
  51. data/lib/source2md/text_helper.rb +5 -1
  52. data/lib/source2md/version.rb +1 -1
  53. data/spec/code_block_spec.rb +1 -1
  54. data/spec/formatter/sample.yml +1 -0
  55. data/spec/{type/element_include_spec.rb → formatter/type_code_include_spec.rb} +6 -6
  56. data/spec/{type/element_reject_spec.rb → formatter/type_hidden_spec.rb} +3 -2
  57. data/spec/formatter/type_parse_include_spec.rb +16 -0
  58. data/spec/{type/element_md_header_spec.rb → formatter/type_raw_include_spec.rb} +2 -6
  59. data/spec/{type/element_text_spec.rb → formatter/type_text_spec.rb} +14 -2
  60. metadata +67 -62
  61. data/doc/0180_text.rb +0 -15
  62. data/doc/0190_raw.rb +0 -19
  63. data/examples/element_include.rb +0 -20
  64. data/examples/element_reject.rb +0 -17
  65. data/lib/source2md/type/element_deep_comment.rb +0 -19
  66. data/lib/source2md/type/element_md_header.rb +0 -13
  67. data/lib/source2md/type/element_method.rb +0 -24
  68. data/lib/source2md/type/element_uncomment.rb +0 -24
  69. data/spec/type/sample.yml +0 -1
  70. /data/spec/{type/element_alert_spec.rb → formatter/type_alert_spec.rb} +0 -0
  71. /data/spec/{type/element_md_title_spec.rb → formatter/type_md_title_spec.rb} +0 -0
  72. /data/spec/{type/element_method_spec.rb → formatter/type_method_spec.rb} +0 -0
  73. /data/spec/{type/element_partial_code_spec.rb → formatter/type_partial_code_spec.rb} +0 -0
  74. /data/spec/{type/element_source_block_spec.rb → formatter/type_source_block_spec.rb} +0 -0
  75. /data/spec/{type/element_table_spec.rb → formatter/type_table_spec.rb} +0 -0
  76. /data/spec/{type/element_title_spec.rb → formatter/type_title_spec.rb} +0 -0
  77. /data/spec/{type/element_warn_spec.rb → formatter/type_warn_spec.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f611630d43ae94215b726f34b9eb21058b116fc5cd680ba1349888183b0568d
4
- data.tar.gz: b77b99e4e0fed12a8ecc1d2b8fec203b9caa88866a25d3649f8c89d0c09bcc28
3
+ metadata.gz: f98d5b2f1f4a15eb936a3fa1fabbc4e38316b01f65bf317253cbdf6b3e8d79f5
4
+ data.tar.gz: 9383810a16af7443690a4de9e2528f30d916319129f3bde75da1905325924048
5
5
  SHA512:
6
- metadata.gz: e8fa08c336da0fb2873eddc88d114219cd2bde1d1857c637cf9d3fa42ea93a17fa3e724748bdd00e82c9bb8ca97964a6872040f04d99f6a876d71d2f3af9a0c6
7
- data.tar.gz: 250194de04ec0531337df28e83d5f7931ddee724fdf375d617a38e9c51e7217a53715f0cfbc2e05a88b220a48841ee86fb412f2e57d8c3f47aa0697077f85202
6
+ metadata.gz: db0be63ef5b74fc60841e4f3db52c928ece933c170580f28d5e8892c41f1bad662e68519d80ddf20fe325d840a7f93ffc59bb2a522532485afb581b6d1af637b
7
+ data.tar.gz: 4c3f17eff3f140510e33061340fbecec8e909c9ac869324446f5c737d1d457f42c59477b278446e482d99f9e320e441ffa00318b3b543afac184f32557845bae
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Source2MD: Markdown generator from source code #
2
2
 
3
+ ## Logic ##
4
+
5
+ 1. Divide the source code into paragraphs using blank lines as separations.
6
+ 1. Remove comments from the comment blocks.
7
+ 1. Include the code within the code block.
8
+
3
9
  ## Install ##
4
10
 
5
11
  ```
@@ -14,7 +20,9 @@ $ source2md generate -o README.md README.rb
14
20
 
15
21
  ## Rules ##
16
22
 
17
- ### Embedding Of Small Code ###
23
+ ### Code snippet ###
24
+
25
+ Separated by blank lines.
18
26
 
19
27
  ```ruby
20
28
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -36,7 +44,7 @@ EOS
36
44
  > hello.call
37
45
  > ```
38
46
 
39
- ### Source Block ###
47
+ ### Source block with many lines ###
40
48
 
41
49
  ```ruby
42
50
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -58,6 +66,61 @@ EOS
58
66
  > hello.call
59
67
  > ```
60
68
 
69
+ ### Hide paragraph ###
70
+
71
+ ```ruby
72
+ puts Source2MD::Section.new(<<~EOS).to_md
73
+ #+hidden: true
74
+ p "This paragraph is not displayed"
75
+
76
+ p "This paragraph is displayed"
77
+ EOS
78
+ ```
79
+
80
+ > ```ruby
81
+ > p "This paragraph is displayed"
82
+ > ```
83
+
84
+ ### Code include ###
85
+
86
+ ```ruby
87
+ Insert inside the code block.
88
+ ```
89
+
90
+ ```ruby
91
+ File.write("/tmp/hello.html", "<p>Hello</p>")
92
+
93
+ puts Source2MD::Section.new(<<~EOS).to_md
94
+ #+code_include: /tmp/hello.html
95
+
96
+ #+code_include: /tmp/hello.html xml:OUTPUT
97
+ EOS
98
+ ```
99
+
100
+ > ````
101
+ > ```html:hello.html
102
+ > <p>Hello</p>
103
+ > ```
104
+ >
105
+ > ```xml:OUTPUT
106
+ > <p>Hello</p>
107
+ > ```
108
+ > ````
109
+
110
+ ### Raw include ###
111
+
112
+ ```ruby
113
+ File.write("/tmp/hello.html", "<p>Hello</p>")
114
+
115
+ puts Source2MD::Section.new(<<~EOS).to_md
116
+ #+raw_include: /tmp/hello.html
117
+ EOS
118
+ ```
119
+
120
+ > ```
121
+ > <p>Hello</p>
122
+ > ```
123
+
61
124
  ### Title ###
62
125
 
63
126
  No number limit.
@@ -72,13 +135,15 @@ puts Source2MD::Section.new(<<~EOS).to_md
72
135
  EOS
73
136
  ```
74
137
 
75
- > # Title Level 1 # #
76
- >
77
- > ## Title Level 2 # ##
78
- >
79
- > ### Title Level 3 # ###
138
+ ```
139
+ # Title Level 1 #
80
140
 
81
- ### Markdown Style Title ###
141
+ ## Title Level 2 ##
142
+
143
+ ### Title Level 3 ###
144
+ ```
145
+
146
+ ### Markdown style title ###
82
147
 
83
148
  The condition is that there are the same number of sharps on the back.
84
149
 
@@ -92,13 +157,15 @@ puts Source2MD::Section.new(<<~EOS).to_md
92
157
  EOS
93
158
  ```
94
159
 
95
- > # Title Level 1 #
96
- >
97
- > ## Title Level 2 ##
98
- >
99
- > ### Title Level 3 ###
160
+ ```
161
+ # Title Level 1 #
162
+
163
+ ## Title Level 2 ##
164
+
165
+ ### Title Level 3 ###
166
+ ```
100
167
 
101
- ### Org-mode Table Style ###
168
+ ### Org-mode table style ###
102
169
 
103
170
  ```ruby
104
171
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -132,7 +199,7 @@ EOS
132
199
  > | C++ | 1983 | Bjarne Stroustrup |
133
200
  > | Python | 1989 | Guido van Rossum |
134
201
 
135
- ### Explain the method simply ###
202
+ ### Explain method simply ###
136
203
 
137
204
  ```ruby
138
205
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -168,7 +235,7 @@ EOS
168
235
  >
169
236
  > Comments about reverse
170
237
 
171
- ### Warning, Alert Message ###
238
+ ### Warning and Alert message ###
172
239
 
173
240
  Exclusive to Zenn
174
241
 
@@ -192,34 +259,50 @@ EOS
192
259
  > :::
193
260
  > ```
194
261
 
195
- ### Text ###
262
+ ### Raw Text ###
196
263
 
197
264
  If no rule applies and the text begins with `#`, remove the `#`.
198
265
 
199
266
  ```ruby
200
267
  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.
268
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit,
269
+ # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
203
270
  EOS
204
271
  ```
205
272
 
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.
273
+ > ```
274
+ > Lorem ipsum dolor sit amet, consectetur adipisicing elit,
275
+ > sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
276
+ > ```
208
277
 
209
- ### Raw Text ###
278
+ ### Oneline Text ###
210
279
 
211
- Same rule as when writing text, simply remove the leading `#`.
280
+ Using this option allows you to split a line regardless of the markdown library.
212
281
 
213
282
  ```ruby
214
283
  puts Source2MD::Section.new(<<~EOS).to_md
215
- # <hr>
216
- #
217
- # <hr>
284
+ #+oneline: true
285
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit,
286
+ # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
218
287
  EOS
219
288
  ```
220
289
 
221
290
  > ```
222
- > <hr>
223
- >
224
- > <hr>
291
+ > Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
225
292
  > ```
293
+
294
+ ### Parse include ###
295
+
296
+ Paste the results of processing other files with the same rules.
297
+
298
+ ```ruby
299
+ File.write("/tmp/hello.rb", <<~EOS)
300
+ # foo
301
+ EOS
302
+
303
+ puts Source2MD::Section.new(<<~EOS).to_md
304
+ #+parse_include: /tmp/hello.rb
305
+ EOS
306
+ ```
307
+
308
+ > foo
data/Rakefile CHANGED
@@ -9,6 +9,7 @@ task :o => "open"
9
9
  namespace :doc do
10
10
  desc "[g] generate README.md"
11
11
  task "generate" do
12
+ Rake::Task["doc:renum"].execute
12
13
  system "sh", "-vec", <<~EOT, exception: true
13
14
  .bin/source2md generate --no-debug --no-xmp-out-exclude -o README.md doc/0*
14
15
  EOT
data/doc/0100_top.rb CHANGED
@@ -1,7 +1,14 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  # Source2MD: Markdown generator from source code #
4
5
 
6
+ ## Logic ##
7
+
8
+ # 1. Divide the source code into paragraphs using blank lines as separations.
9
+ # 1. Remove comments from the comment blocks.
10
+ # 1. Include the code within the code block.
11
+
5
12
  ## Install ##
6
13
 
7
14
  # ```
@@ -1,6 +1,9 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Embedding Of Small Code ###
4
+ ### Code snippet ###
5
+
6
+ # Separated by blank lines.
4
7
 
5
8
  #+BEGIN_SRC
6
9
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -1,6 +1,7 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Source Block ###
4
+ ### Source block with many lines ###
4
5
 
5
6
  #+BEGIN_SRC
6
7
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -0,0 +1,17 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Hide paragraph ###
5
+
6
+ #+BEGIN_SRC
7
+ puts Source2MD::Section.new(<<~EOS).to_md
8
+ #+hidden: true
9
+ p "This paragraph is not displayed"
10
+
11
+ p "This paragraph is displayed"
12
+ EOS
13
+ #+END_SRC
14
+
15
+ # > ```ruby
16
+ # > p "This paragraph is displayed"
17
+ # > ```
@@ -0,0 +1,26 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Code include ###
5
+
6
+ Insert inside the code block.
7
+
8
+ #+BEGIN_SRC
9
+ File.write("/tmp/hello.html", "<p>Hello</p>")
10
+
11
+ puts Source2MD::Section.new(<<~EOS).to_md
12
+ #+code_include: /tmp/hello.html
13
+
14
+ #+code_include: /tmp/hello.html xml:OUTPUT
15
+ EOS
16
+ #+END_SRC
17
+
18
+ # > ````
19
+ # > ```html:hello.html
20
+ # > <p>Hello</p>
21
+ # > ```
22
+ # >
23
+ # > ```xml:OUTPUT
24
+ # > <p>Hello</p>
25
+ # > ```
26
+ # > ````
@@ -0,0 +1,16 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Raw include ###
5
+
6
+ #+BEGIN_SRC
7
+ File.write("/tmp/hello.html", "<p>Hello</p>")
8
+
9
+ puts Source2MD::Section.new(<<~EOS).to_md
10
+ #+raw_include: /tmp/hello.html
11
+ EOS
12
+ #+END_SRC
13
+
14
+ # > ```
15
+ # > <p>Hello</p>
16
+ # > ```
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  ### Title ###
@@ -14,8 +15,10 @@ puts Source2MD::Section.new(<<~EOS).to_md
14
15
  EOS
15
16
  #+END_SRC
16
17
 
17
- # > # Title Level 1 # #
18
- # >
19
- # > ## Title Level 2 # ##
20
- # >
21
- # > ### Title Level 3 # ###
18
+ # ```
19
+ # # Title Level 1 #
20
+ #
21
+ # ## Title Level 2 ##
22
+ #
23
+ # ### Title Level 3 ###
24
+ # ```
@@ -1,6 +1,7 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Markdown Style Title ###
4
+ ### Markdown style title ###
4
5
 
5
6
  # The condition is that there are the same number of sharps on the back.
6
7
 
@@ -14,8 +15,10 @@ puts Source2MD::Section.new(<<~EOS).to_md
14
15
  EOS
15
16
  #+END_SRC
16
17
 
17
- # > # Title Level 1 #
18
- # >
19
- # > ## Title Level 2 ##
20
- # >
21
- # > ### Title Level 3 ###
18
+ # ```
19
+ # # Title Level 1 #
20
+ #
21
+ # ## Title Level 2 ##
22
+ #
23
+ # ### Title Level 3 ###
24
+ # ```
@@ -1,6 +1,7 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Org-mode Table Style ###
4
+ ### Org-mode table style ###
4
5
 
5
6
  #+BEGIN_SRC
6
7
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -1,6 +1,7 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Explain the method simply ###
4
+ ### Explain method simply ###
4
5
 
5
6
  #+BEGIN_SRC
6
7
  puts Source2MD::Section.new(<<~EOS).to_md
@@ -1,6 +1,7 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
- ### Warning, Alert Message ###
4
+ ### Warning and Alert message ###
4
5
 
5
6
  # Exclusive to Zenn
6
7
 
data/doc/0210_text.rb ADDED
@@ -0,0 +1,18 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Raw Text ###
5
+
6
+ # If no rule applies and the text begins with `#`, remove the `#`.
7
+
8
+ #+BEGIN_SRC
9
+ puts Source2MD::Section.new(<<~EOS).to_md
10
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit,
11
+ # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
12
+ EOS
13
+ #+END_SRC
14
+
15
+ # > ```
16
+ # > Lorem ipsum dolor sit amet, consectetur adipisicing elit,
17
+ # > sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
18
+ # > ```
@@ -0,0 +1,18 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Oneline Text ###
5
+
6
+ # Using this option allows you to split a line regardless of the markdown library.
7
+
8
+ #+BEGIN_SRC
9
+ puts Source2MD::Section.new(<<~EOS).to_md
10
+ #+oneline: true
11
+ # Lorem ipsum dolor sit amet, consectetur adipisicing elit,
12
+ # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
13
+ EOS
14
+ #+END_SRC
15
+
16
+ # > ```
17
+ # > Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
18
+ # > ```
@@ -0,0 +1,18 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ ### Parse include ###
5
+
6
+ # Paste the results of processing other files with the same rules.
7
+
8
+ #+BEGIN_SRC
9
+ File.write("/tmp/hello.rb", <<~EOS)
10
+ # foo
11
+ EOS
12
+
13
+ puts Source2MD::Section.new(<<~EOS).to_md
14
+ #+parse_include: /tmp/hello.rb
15
+ EOS
16
+ #+END_SRC
17
+
18
+ # > foo
data/examples/cli.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  Source2MD::Generator.new(files: ["input.rb"], output_file: "output.md").call
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -5,7 +6,7 @@ puts Source2MD::Element.new(<<~EOS).to_md
5
6
  # https://example.com/
6
7
  EOS
7
8
  # >> --------------------------------------------------------------------------------
8
- # >> Source2MD::Type::ElementUncomment
9
+ # >> Source2MD::Part::TypeText
9
10
  # >>
10
11
  # >> head:
11
12
  # >> {}
data/examples/scanner.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  Source2MD::Scanner.new(<<~EOS).to_a # => ["foo", "#+BEGIN_SRC\n\nfoo\n\n#+END_SRC", "foo"]
@@ -1,17 +1,18 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
4
5
  #+alert: (foo)
5
6
  EOS
6
7
  # >> --------------------------------------------------------------------------------
7
- # >> Source2MD::Type::ElementAlert
8
- # >>
8
+ # >> Source2MD::Part::TypeAlert
9
+ # >>
9
10
  # >> head:
10
11
  # >> {:alert=>"(foo)"}
11
- # >>
12
+ # >>
12
13
  # >> in:
13
- # >>
14
- # >>
14
+ # >>
15
+ # >>
15
16
  # >> out:
16
17
  # >> :::message alert
17
18
  # >> (foo)
@@ -0,0 +1,21 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ puts Source2MD::Element.new(<<~EOS).to_md
5
+
6
+ #+code_include: input.yml
7
+ #+name:
8
+
9
+ EOS
10
+ # ~> /Users/ikeda/src/source2md/lib/source2md/part/type_include.rb:27:in `read': No such file or directory @ rb_sysopen - /Users/ikeda/src/source2md/examples/input.yml diff xxx:yyy (Errno::ENOENT)
11
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/type_include.rb:27:in `read'
12
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/type_include.rb:27:in `body'
13
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/type_include.rb:17:in `to_md'
14
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/base.rb:25:in `block in initialize'
15
+ # ~> 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'
16
+ # ~> from /opt/rbenv/versions/3.2.2/lib/ruby/3.2.0/logger.rb:689:in `debug'
17
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/base.rb:13:in `initialize'
18
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/part/type_include.rb:9:in `initialize'
19
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/element.rb:27:in `new'
20
+ # ~> from /Users/ikeda/src/source2md/lib/source2md/element.rb:27:in `to_md'
21
+ # ~> from -:3:in `<main>'
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -6,7 +7,7 @@ puts Source2MD::Element.new(<<~EOS).to_md
6
7
  ---
7
8
  EOS
8
9
  # >> --------------------------------------------------------------------------------
9
- # >> Source2MD::Type::ElementMdHeader
10
+ # >> Source2MD::Part::TypeHidden
10
11
  # >>
11
12
  # >> head:
12
13
  # >> {}
@@ -1,9 +1,10 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
4
5
  ## foo ##
5
6
  EOS
6
- # >> > -------------------------------------------------------------------------------- Source2MD::Type::ElementMdTitle
7
+ # >> > -------------------------------------------------------------------------------- Source2MD::Part::TypeMdTitle
7
8
  # >> > {}
8
9
  # >> > ------------------------------------------------------------ in
9
10
  # >> > ## foo ##
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -9,7 +10,7 @@ code1
9
10
  code2
10
11
  EOS
11
12
  # >> --------------------------------------------------------------------------------
12
- # >> Source2MD::Type::ElementMethod
13
+ # >> Source2MD::Part::TypeMethod
13
14
  # >>
14
15
  # >> head:
15
16
  # >> {:name=>"(name)", :desc=>"(desc)", :comment=>"(comment)"}
@@ -1,10 +1,11 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
4
5
  (foo)
5
6
  EOS
6
7
  # >> --------------------------------------------------------------------------------
7
- # >> Source2MD::Type::ElementPartialCode
8
+ # >> Source2MD::Part::TypePartialCode
8
9
  # >>
9
10
  # >> head:
10
11
  # >> {}
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -6,7 +7,7 @@ puts Source2MD::Element.new(<<~EOS).to_md
6
7
  #+END_SRC
7
8
  EOS
8
9
  # >> --------------------------------------------------------------------------------
9
- # >> Source2MD::Type::ElementSourceBlock
10
+ # >> Source2MD::Part::TypeSourceBlock
10
11
  # >>
11
12
  # >> head:
12
13
  # >> {}
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -1,18 +1,24 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
4
- ## (foo)
5
+ #+oneline: true
6
+ # a
7
+ # b
8
+ #
9
+ # c
10
+ # d
5
11
  EOS
6
- # >> > -------------------------------------------------------------------------------- Source2MD::Type::ElementPartialCode
7
- # >> > {}
12
+ # >> > -------------------------------------------------------------------------------- Source2MD::Formatter::TypeText
13
+ # >> > {"oneline"=>"true"}
8
14
  # >> > ------------------------------------------------------------ in
9
- # >> > ## (foo)
15
+ # >> > # a
16
+ # >> > # b
17
+ # >> > #
18
+ # >> > # c
19
+ # >> > # d
10
20
  # >> >
11
21
  # >> > ------------------------------------------------------------ out
12
- # >> > ```ruby
13
- # >> > ## (foo)
14
- # >> > ```
22
+ # >> > abcd
15
23
  # >> > ------------------------------------------------------------
16
- # >> ```ruby
17
- # >> ## (foo)
18
- # >> ```
24
+ # >> abcd
@@ -1,3 +1,4 @@
1
+ #+hidden: true
1
2
  require "./setup"
2
3
 
3
4
  puts Source2MD::Element.new(<<~EOS).to_md
@@ -5,7 +6,7 @@ puts Source2MD::Element.new(<<~EOS).to_md
5
6
  EOS
6
7
  # >> title2: (foo)
7
8
  # >> --------------------------------------------------------------------------------
8
- # >> Source2MD::Type::ElementTitle
9
+ # >> Source2MD::Part::TypeTitle
9
10
  # >>
10
11
  # >> head:
11
12
  # >> {:title2=>"(foo)"}