source2md 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/type_partial_code.rb +22 -0
- data/lib/source2md/cli.rb +11 -9
- data/lib/source2md/formatter/type_partial_code.rb +11 -1
- data/lib/source2md/generator.rb +2 -0
- data/lib/source2md/version.rb +1 -1
- data/lib/source2md.rb +1 -0
- data/spec/formatter/type_partial_code_spec.rb +3 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 563959d92fa1520a3e09544319ff3eb9a50ac0136cc68edb290b98dc6d005e4e
|
4
|
+
data.tar.gz: 895fe538bd66ae956f5892b8278a4f7936140e78e07231d2cab7e6d926834b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fc8fd71c70f95f3ccdb05b3119ea21dd6a09df913b58b254783189fefd2a370bdffd4d9becf77285ab2c7594a95b8529271f6b1587e94977ee023e4ebffbfb
|
7
|
+
data.tar.gz: 02d4b91d972ce7aeffb30dcd9af76001bbf2d2385e2082cc0db4e0e71d1e6e043930e404651dcff5e63606955b97c28b04d8d2f7b8b34963dd1426ca407528fe
|
@@ -1,17 +1,38 @@
|
|
1
1
|
#+hidden: true
|
2
2
|
require "./setup"
|
3
3
|
|
4
|
+
Source2MD.data_block_exclude = true
|
5
|
+
|
4
6
|
puts Source2MD::Element.new(<<~EOS).to_md
|
5
7
|
a
|
6
8
|
b
|
7
9
|
c
|
10
|
+
__END__
|
11
|
+
foo
|
8
12
|
EOS
|
13
|
+
# >> head: {}
|
14
|
+
# >> body: "a\n b\nc\n__END__\nfoo\n"
|
15
|
+
# >> Source2MD::Formatter::TypeHidden => false
|
16
|
+
# >> Source2MD::Formatter::TypeCodeInclude =>
|
17
|
+
# >> Source2MD::Formatter::TypeRawInclude =>
|
18
|
+
# >> Source2MD::Formatter::TypeParseInclude =>
|
19
|
+
# >> Source2MD::Formatter::TypeTitle => false
|
20
|
+
# >> Source2MD::Formatter::TypeWarn =>
|
21
|
+
# >> Source2MD::Formatter::TypeAlert =>
|
22
|
+
# >> Source2MD::Formatter::TypeMethod =>
|
23
|
+
# >> Source2MD::Formatter::TypeTable => false
|
24
|
+
# >> Source2MD::Formatter::TypeSourceBlock => false
|
25
|
+
# >> Source2MD::Formatter::TypeText => false
|
26
|
+
# >> Source2MD::Formatter::TypePartialCode => true
|
9
27
|
# >> > -------------------------------------------------------------------------------- Source2MD::Formatter::TypePartialCode
|
10
28
|
# >> > {}
|
11
29
|
# >> > ------------------------------------------------------------ in
|
12
30
|
# >> > a
|
13
31
|
# >> > b
|
14
32
|
# >> > c
|
33
|
+
# >> > __END__
|
34
|
+
# >> > foo
|
35
|
+
# >> >
|
15
36
|
# >> >
|
16
37
|
# >> > ------------------------------------------------------------ out
|
17
38
|
# >> > ```ruby
|
@@ -19,6 +40,7 @@ EOS
|
|
19
40
|
# >> > b
|
20
41
|
# >> > c
|
21
42
|
# >> > ```
|
43
|
+
# >> >
|
22
44
|
# >> > ------------------------------------------------------------
|
23
45
|
# >> ```ruby
|
24
46
|
# >> a
|
data/lib/source2md/cli.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Source2MD
|
2
2
|
class Cli < Thor
|
3
|
-
class_option :debug,
|
4
|
-
class_option :xmp_out_exclude,
|
5
|
-
class_option :
|
6
|
-
class_option :
|
7
|
-
class_option :
|
8
|
-
class_option :
|
3
|
+
class_option :debug, type: :boolean, aliases: "-d", default: false
|
4
|
+
class_option :xmp_out_exclude, type: :boolean, aliases: "-x", default: false
|
5
|
+
class_option :data_block_exclude, type: :boolean, default: false
|
6
|
+
class_option :readonly, type: :boolean, aliases: "-r", default: true
|
7
|
+
class_option :default_lang, type: :string, aliases: "-l", default: "ruby"
|
8
|
+
class_option :prefix_re, type: :string
|
9
|
+
class_option :comment_re, type: :string
|
9
10
|
|
10
11
|
def initialize(...)
|
11
12
|
super
|
@@ -15,9 +16,10 @@ module Source2MD
|
|
15
16
|
Source2MD.debug = true
|
16
17
|
end
|
17
18
|
|
18
|
-
Source2MD.xmp_out_exclude
|
19
|
-
Source2MD.
|
20
|
-
Source2MD.
|
19
|
+
Source2MD.xmp_out_exclude = options[:xmp_out_exclude]
|
20
|
+
Source2MD.data_block_exclude = options[:data_block_exclude]
|
21
|
+
Source2MD.readonly = options[:readonly]
|
22
|
+
Source2MD.default_lang = options[:default_lang]
|
21
23
|
|
22
24
|
Source2MD::RE.update do |e|
|
23
25
|
if v = options[:prefix_re]
|
@@ -6,7 +6,17 @@ module Source2MD
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def to_md
|
9
|
-
CodeBlock.new(
|
9
|
+
CodeBlock.new(body).to_md
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def body
|
15
|
+
if Source2MD.data_block_exclude
|
16
|
+
element.body.sub(/^__END__\R.*/m, "")
|
17
|
+
else
|
18
|
+
element.body
|
19
|
+
end
|
10
20
|
end
|
11
21
|
end
|
12
22
|
end
|
data/lib/source2md/generator.rb
CHANGED
data/lib/source2md/version.rb
CHANGED
data/lib/source2md.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Ikeda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|