source2md 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d239ae5a48c121dc61a4fcd811cf6572f32b1ee793bae58a2a6c69f4e815d0f
4
- data.tar.gz: 748a3da2af4129d894031af00b71b0e4553e4a21018b84a2d12e0f646ab1ce12
3
+ metadata.gz: afa045b32f44c8f86747fe720921365b18caa5a510f35dd7b093962ade54aa8e
4
+ data.tar.gz: ebdd255858fb73a60ef6ff8df6a89d3a72d6310c8667a1927ca3a6808c437d91
5
5
  SHA512:
6
- metadata.gz: 4fa15b238f101e8da2f2f2f8a997e98697c032af2b6674b7896ae7ce0b325f695e213c1b321b8989bc58a9a448bc9d030dccd0251b2473f738ac5e0a0e920957
7
- data.tar.gz: a7d8ca07d2bd122437b711b9ce90387783e1d96a560b422c1c83cd745f062656c4ab0cde8239532c611fb898fcb7d98396bd3d447975b558e93713bf85cd2d4d
6
+ metadata.gz: 360f9e298762344eb35bc92622bdba1b434edc3ee487cdf91f3a35f8f7240c0a99fd9c35a6e44daba531520e3b06ad31e87a4558db86c0582016e196eb4e1b7c
7
+ data.tar.gz: cfa3e532bd2297f1493752dff9037c73fbd11e3bcc668ea206b016c550229e2fd0f5096c9c453cb31721c632d7ad0db8d2b4516f8e3540d4045d42c5f064b320
@@ -0,0 +1,40 @@
1
+ #+hidden: true
2
+ require "./setup"
3
+
4
+ puts Source2MD::Element.new(<<~EOS).to_md
5
+ # ![](https://example.com/image.png)
6
+ # **(alt)**
7
+ EOS
8
+
9
+ # >> head: {}
10
+ # >> body: "# ![](https://example.com/image.png)\n# **(alt)**\n"
11
+ # >> Source2MD::Formatter::TypeHidden => false
12
+ # >> Source2MD::Formatter::TypeEval =>
13
+ # >> Source2MD::Formatter::TypeCodeInclude =>
14
+ # >> Source2MD::Formatter::TypeRawInclude =>
15
+ # >> Source2MD::Formatter::TypeParseInclude =>
16
+ # >> Source2MD::Formatter::TypeTitle => false
17
+ # >> Source2MD::Formatter::TypeWarn =>
18
+ # >> Source2MD::Formatter::TypeAlert =>
19
+ # >> Source2MD::Formatter::TypeMethod =>
20
+ # >> Source2MD::Formatter::TypeTable => false
21
+ # >> Source2MD::Formatter::TypeSourceBlock => false
22
+ # >> Source2MD::Formatter::TypeMdHeader =>
23
+ # >> Source2MD::Formatter::TypeCodeBlock => false
24
+ # >> Source2MD::Formatter::TypeQuote =>
25
+ # >> Source2MD::Formatter::TypeList => false
26
+ # >> Source2MD::Formatter::TypeInlineImage => # ![]
27
+ # >> > -------------------------------------------------------------------------------- Source2MD::Formatter::TypeInlineImage
28
+ # >> > {}
29
+ # >> > ------------------------------------------------------------ in
30
+ # >> > # ![](https://example.com/image.png)
31
+ # >> > # **(alt)**
32
+ # >> >
33
+ # >> >
34
+ # >> > ------------------------------------------------------------ out
35
+ # >> > ![](https://example.com/image.png)
36
+ # >> > **(alt)**
37
+ # >> >
38
+ # >> > ------------------------------------------------------------
39
+ # >> ![](https://example.com/image.png)
40
+ # >> **(alt)**
@@ -18,6 +18,7 @@ module Source2MD
18
18
  Formatter::TypeCodeBlock, # # ```
19
19
  Formatter::TypeQuote, # # > xxx
20
20
  Formatter::TypeList, # # - xxx or 1. xxx
21
+ Formatter::TypeInlineImage, # # ![]
21
22
 
22
23
  # Sentence (automatic wrap)
23
24
  Formatter::TypeText, # # foo
@@ -0,0 +1,17 @@
1
+ module Source2MD
2
+ module Formatter
3
+ class TypeInlineImage < Base
4
+ def self.regexp
5
+ /#{RE.meta_re}\s+!\[.*?\]/
6
+ end
7
+
8
+ def self.accept?(element)
9
+ element.body.match(regexp)
10
+ end
11
+
12
+ def to_md
13
+ element.body.remove(TypeText.regexp)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Source2MD
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ module Source2MD
4
+ describe do
5
+ it "works" do
6
+ actual = Element.new(<<~EOS).to_md
7
+ # ![](https://example.com/image.png)
8
+ # **(alt)**
9
+ EOS
10
+ actual.should == <<~EOS
11
+ ![](https://example.com/image.png)
12
+ **(alt)**
13
+ EOS
14
+ end
15
+ end
16
+ end
17
+ # >> .
18
+ # >>
19
+ # >> Finished in 0.00592 seconds (files took 0.33715 seconds to load)
20
+ # >> 1 example, 0 failures
21
+ # >>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: source2md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Ikeda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-02 00:00:00.000000000 Z
11
+ date: 2024-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -179,6 +179,7 @@ files:
179
179
  - examples/type_code_include.rb
180
180
  - examples/type_eval.rb
181
181
  - examples/type_hidden.rb
182
+ - examples/type_inline_image.rb
182
183
  - examples/type_md_header.rb
183
184
  - examples/type_method.rb
184
185
  - examples/type_partial_code.rb
@@ -199,6 +200,7 @@ files:
199
200
  - lib/source2md/formatter/type_else.rb
200
201
  - lib/source2md/formatter/type_eval.rb
201
202
  - lib/source2md/formatter/type_hidden.rb
203
+ - lib/source2md/formatter/type_inline_image.rb
202
204
  - lib/source2md/formatter/type_list.rb
203
205
  - lib/source2md/formatter/type_md_header.rb
204
206
  - lib/source2md/formatter/type_method.rb
@@ -230,6 +232,7 @@ files:
230
232
  - spec/formatter/type_code_include_spec.rb
231
233
  - spec/formatter/type_eval_spec.rb
232
234
  - spec/formatter/type_hidden_spec.rb
235
+ - spec/formatter/type_inline_image_spec.rb
233
236
  - spec/formatter/type_md_header_spec.rb
234
237
  - spec/formatter/type_method_spec.rb
235
238
  - spec/formatter/type_parse_include_spec.rb
@@ -276,6 +279,7 @@ test_files:
276
279
  - spec/formatter/type_code_include_spec.rb
277
280
  - spec/formatter/type_eval_spec.rb
278
281
  - spec/formatter/type_hidden_spec.rb
282
+ - spec/formatter/type_inline_image_spec.rb
279
283
  - spec/formatter/type_md_header_spec.rb
280
284
  - spec/formatter/type_method_spec.rb
281
285
  - spec/formatter/type_parse_include_spec.rb