markdown_helper 1.9.9 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -4
- data/lib/markdown_helper/version.rb +1 -1
- data/markdown/readme/README.template.md +5 -4
- data/markdown/use_cases/Rakefile +2 -1
- data/markdown/use_cases/include_files/include_text_as_comment/hello.rb +8 -0
- data/markdown/use_cases/include_files/include_text_as_comment/include_text_as_comment.rb +72 -0
- data/markdown/use_cases/include_files/include_text_as_comment/included.md +12 -0
- data/markdown/use_cases/include_files/include_text_as_comment/includer.md +4 -0
- data/markdown/use_cases/include_files/include_text_as_comment/use_case.md +87 -0
- data/markdown/use_cases/include_files/include_text_as_comment/use_case_template.md +26 -0
- data/markdown/use_cases/include_files/include_text_as_pre/include_text_as_pre.rb +69 -0
- data/markdown/use_cases/include_files/include_text_as_pre/included.md +6 -0
- data/markdown/use_cases/include_files/include_text_as_pre/includer.md +4 -0
- data/markdown/use_cases/include_files/include_text_as_pre/triple_backtick.md +1 -0
- data/markdown/use_cases/include_files/include_text_as_pre/use_case.md +76 -0
- data/markdown/use_cases/include_files/include_text_as_pre/use_case_template.md +28 -0
- data/markdown/use_cases/use_cases.md +2 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd8b799693304f32aad8780f7d4ce734ae46614d
|
4
|
+
data.tar.gz: 703df7ba48954272c6bfe0e794b9150564f4d3cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc921a959dd8f3c0cd39d0da08e13dcb6c51f7b82ab405d37e1faf6f4ff81218ae6264e8963e8aa8de67ebad4521145e9bd044c5b7eb4ced8e9003a6461919a
|
7
|
+
data.tar.gz: a91f66a74094c2bab6e87bbf98403ed168df5d817a4155f7440b9c7cca8c181171c02bea25d6fc6b882794bc617519f127e3a0da15b576ea3cb6e411bada3194
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,11 +10,12 @@
|
|
10
10
|
|
11
11
|
## What's New?
|
12
12
|
|
13
|
-
|
13
|
+
Treatments for included file:
|
14
14
|
|
15
|
-
- Support is added for
|
16
|
-
-
|
17
|
-
|
15
|
+
- Support is added for including a file as a comment. See the [use case](markdown/use_cases/include_files/include_text_as_comment/use_case.md#include-text-as-comment).
|
16
|
+
- Support is added for including a file as pre-formatted. See the [use case](markdown/use_cases/include_files/include_text_as_pre/use_case.md#include-text-as-pre).
|
17
|
+
|
18
|
+
(The new version, 2.0.0, is not a major increment over version 1.9.9. Numbers just ran out.)
|
18
19
|
|
19
20
|
## What's a Markdown Helper?
|
20
21
|
|
@@ -9,11 +9,12 @@
|
|
9
9
|
|
10
10
|
## What's New?
|
11
11
|
|
12
|
-
|
12
|
+
Treatments for included file:
|
13
13
|
|
14
|
-
- Support is added for
|
15
|
-
-
|
16
|
-
|
14
|
+
- Support is added for including a file as a comment. See the [use case](markdown/use_cases/include_files/include_text_as_comment/use_case.md#include-text-as-comment).
|
15
|
+
- Support is added for including a file as pre-formatted. See the [use case](markdown/use_cases/include_files/include_text_as_pre/use_case.md#include-text-as-pre).
|
16
|
+
|
17
|
+
(The new version, 2.0.0, is not a major increment over version 1.9.9. Numbers just ran out.)
|
17
18
|
|
18
19
|
## What's a Markdown Helper?
|
19
20
|
|
data/markdown/use_cases/Rakefile
CHANGED
@@ -27,6 +27,8 @@ EOT
|
|
27
27
|
include_markdown
|
28
28
|
include_code_block
|
29
29
|
include_highlighted_code
|
30
|
+
include_text_as_comment
|
31
|
+
include_text_as_pre
|
30
32
|
include_generated_text
|
31
33
|
diagnose_missing_includee
|
32
34
|
diagnose_circular_includes
|
@@ -70,7 +72,6 @@ EOT
|
|
70
72
|
ensure
|
71
73
|
end
|
72
74
|
else
|
73
|
-
p command
|
74
75
|
system(command)
|
75
76
|
end
|
76
77
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require_relative '../include_use_case'
|
2
|
+
|
3
|
+
class IncludeTextAsComment < IncludeUseCase
|
4
|
+
|
5
|
+
def self.build
|
6
|
+
|
7
|
+
use_case_name = File.basename(__FILE__, '.rb')
|
8
|
+
use_case = self.new(use_case_name)
|
9
|
+
|
10
|
+
includee_file_name = 'hello.rb'
|
11
|
+
|
12
|
+
use_case.files_to_write.store(
|
13
|
+
includee_file_name,
|
14
|
+
<<EOT
|
15
|
+
class HelloWorld
|
16
|
+
def initialize(name)
|
17
|
+
@name = name.capitalize
|
18
|
+
end
|
19
|
+
def sayHi
|
20
|
+
puts "Hello #{@name}!"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
EOT
|
24
|
+
)
|
25
|
+
|
26
|
+
use_case.files_to_write.store(
|
27
|
+
INCLUDER_FILE_NAME,
|
28
|
+
<<EOT
|
29
|
+
This file includes the code as a comment.
|
30
|
+
|
31
|
+
@[:comment](#{includee_file_name})
|
32
|
+
|
33
|
+
EOT
|
34
|
+
)
|
35
|
+
|
36
|
+
use_case.files_to_write.store(
|
37
|
+
TEMPLATE_FILE_NAME,
|
38
|
+
<<EOT
|
39
|
+
### Include Text As Comment
|
40
|
+
|
41
|
+
Use file inclusion to include text (or even code) as a comment.
|
42
|
+
|
43
|
+
#### File to Be Included
|
44
|
+
|
45
|
+
Here's a file containing code to be included:
|
46
|
+
|
47
|
+
@[markdown](#{includee_file_name})
|
48
|
+
|
49
|
+
#### Includer File
|
50
|
+
|
51
|
+
Here's a template file that includes it:
|
52
|
+
|
53
|
+
@[markdown](#{INCLUDER_FILE_NAME})
|
54
|
+
|
55
|
+
The treatment token ```:comment``` specifies that the included text is to be treated as a comment.
|
56
|
+
|
57
|
+
@[:markdown](../interface.md)
|
58
|
+
|
59
|
+
#### File with Inclusion
|
60
|
+
|
61
|
+
Here's the finished file with the included comment:
|
62
|
+
|
63
|
+
@[markdown](#{INCLUDED_FILE_NAME})
|
64
|
+
|
65
|
+
EOT
|
66
|
+
)
|
67
|
+
|
68
|
+
use_case.build
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
### Include Text As Comment
|
2
|
+
|
3
|
+
Use file inclusion to include text (or even code) as a comment.
|
4
|
+
|
5
|
+
#### File to Be Included
|
6
|
+
|
7
|
+
Here's a file containing code to be included:
|
8
|
+
|
9
|
+
```hello.rb```:
|
10
|
+
```markdown
|
11
|
+
class HelloWorld
|
12
|
+
def initialize(name)
|
13
|
+
@name = name.capitalize
|
14
|
+
end
|
15
|
+
def sayHi
|
16
|
+
puts "Hello !"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
#### Includer File
|
22
|
+
|
23
|
+
Here's a template file that includes it:
|
24
|
+
|
25
|
+
```includer.md```:
|
26
|
+
```markdown
|
27
|
+
This file includes the code as a comment.
|
28
|
+
|
29
|
+
@[:comment](hello.rb)
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
The treatment token ```:comment``` specifies that the included text is to be treated as a comment.
|
34
|
+
|
35
|
+
#### CLI
|
36
|
+
|
37
|
+
You can use the command-line interface to perform the inclusion.
|
38
|
+
|
39
|
+
##### Command
|
40
|
+
|
41
|
+
```sh
|
42
|
+
markdown_helper include --pristine includer.md included.md
|
43
|
+
```
|
44
|
+
|
45
|
+
(Option ```--pristine``` suppresses comment insertion.)
|
46
|
+
|
47
|
+
#### API
|
48
|
+
|
49
|
+
You can use the API to perform the inclusion.
|
50
|
+
|
51
|
+
##### Ruby Code
|
52
|
+
|
53
|
+
```include.rb```:
|
54
|
+
```ruby
|
55
|
+
require 'markdown_helper'
|
56
|
+
|
57
|
+
# Option :pristine suppresses comment insertion.
|
58
|
+
markdown_helper = MarkdownHelper.new(:pristine => true)
|
59
|
+
markdown_helper.include('includer.md', 'included.md')
|
60
|
+
```
|
61
|
+
|
62
|
+
##### Command
|
63
|
+
|
64
|
+
```sh
|
65
|
+
ruby include.rb
|
66
|
+
```
|
67
|
+
|
68
|
+
#### File with Inclusion
|
69
|
+
|
70
|
+
Here's the finished file with the included comment:
|
71
|
+
|
72
|
+
```included.md```:
|
73
|
+
```markdown
|
74
|
+
This file includes the code as a comment.
|
75
|
+
|
76
|
+
<!--class HelloWorld
|
77
|
+
def initialize(name)
|
78
|
+
@name = name.capitalize
|
79
|
+
end
|
80
|
+
def sayHi
|
81
|
+
puts "Hello !"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
-->
|
85
|
+
|
86
|
+
```
|
87
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
### Include Text As Comment
|
2
|
+
|
3
|
+
Use file inclusion to include text (or even code) as a comment.
|
4
|
+
|
5
|
+
#### File to Be Included
|
6
|
+
|
7
|
+
Here's a file containing code to be included:
|
8
|
+
|
9
|
+
@[markdown](hello.rb)
|
10
|
+
|
11
|
+
#### Includer File
|
12
|
+
|
13
|
+
Here's a template file that includes it:
|
14
|
+
|
15
|
+
@[markdown](includer.md)
|
16
|
+
|
17
|
+
The treatment token ```:comment``` specifies that the included text is to be treated as a comment.
|
18
|
+
|
19
|
+
@[:markdown](../interface.md)
|
20
|
+
|
21
|
+
#### File with Inclusion
|
22
|
+
|
23
|
+
Here's the finished file with the included comment:
|
24
|
+
|
25
|
+
@[markdown](included.md)
|
26
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative '../include_use_case'
|
2
|
+
|
3
|
+
class IncludeTextAsPre < IncludeUseCase
|
4
|
+
|
5
|
+
def self.build
|
6
|
+
|
7
|
+
use_case_name = File.basename(__FILE__, '.rb')
|
8
|
+
use_case = self.new(use_case_name)
|
9
|
+
|
10
|
+
includee_file_name = 'triple_backtick.md'
|
11
|
+
|
12
|
+
use_case.files_to_write.store(
|
13
|
+
includee_file_name,
|
14
|
+
<<EOT
|
15
|
+
This file uses triple-backtick to format a ```symbol```, which means that it cannot be included as a code block.
|
16
|
+
EOT
|
17
|
+
)
|
18
|
+
|
19
|
+
use_case.files_to_write.store(
|
20
|
+
INCLUDER_FILE_NAME,
|
21
|
+
<<EOT
|
22
|
+
This file includes the backticked content as pre(formatted).
|
23
|
+
|
24
|
+
@[:pre](#{includee_file_name})
|
25
|
+
|
26
|
+
EOT
|
27
|
+
)
|
28
|
+
|
29
|
+
use_case.files_to_write.store(
|
30
|
+
TEMPLATE_FILE_NAME,
|
31
|
+
<<EOT
|
32
|
+
### Include Text As Pre
|
33
|
+
|
34
|
+
Use file inclusion to include text as pre-formatted (rather than as a code block).
|
35
|
+
|
36
|
+
You might need to do this if you have text to include that has triple-backticks.
|
37
|
+
|
38
|
+
#### File to Be Included
|
39
|
+
|
40
|
+
Here's a file containing text to be included; the text has triple-backticks.:
|
41
|
+
|
42
|
+
@[markdown](#{includee_file_name})
|
43
|
+
|
44
|
+
#### Includer File
|
45
|
+
|
46
|
+
Here's a template file that includes it:
|
47
|
+
|
48
|
+
@[markdown](#{INCLUDER_FILE_NAME})
|
49
|
+
|
50
|
+
The treatment token ```:pre``` specifies that the included text is to be treated as pre-formatted.
|
51
|
+
|
52
|
+
@[:markdown](../interface.md)
|
53
|
+
|
54
|
+
#### File with Inclusion
|
55
|
+
|
56
|
+
Here's the finished file with the included preformatted text:
|
57
|
+
|
58
|
+
@[markdown](#{INCLUDED_FILE_NAME})
|
59
|
+
|
60
|
+
EOT
|
61
|
+
)
|
62
|
+
|
63
|
+
system(INCLUDE_COMMAND)
|
64
|
+
|
65
|
+
use_case.build
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This file uses triple-backtick to format a ```symbol```, which means that it cannot be included as a code block.
|
@@ -0,0 +1,76 @@
|
|
1
|
+
### Include Text As Pre
|
2
|
+
|
3
|
+
Use file inclusion to include text as pre-formatted (rather than as a code block).
|
4
|
+
|
5
|
+
You might need to do this if you have text to include that has triple-backticks.
|
6
|
+
|
7
|
+
#### File to Be Included
|
8
|
+
|
9
|
+
Here's a file containing text to be included; the text has triple-backticks.:
|
10
|
+
|
11
|
+
```triple_backtick.md```:
|
12
|
+
```markdown
|
13
|
+
This file uses triple-backtick to format a ```symbol```, which means that it cannot be included as a code block.
|
14
|
+
```
|
15
|
+
|
16
|
+
#### Includer File
|
17
|
+
|
18
|
+
Here's a template file that includes it:
|
19
|
+
|
20
|
+
```includer.md```:
|
21
|
+
```markdown
|
22
|
+
This file includes the backticked content as pre(formatted).
|
23
|
+
|
24
|
+
@[:pre](triple_backtick.md)
|
25
|
+
|
26
|
+
```
|
27
|
+
|
28
|
+
The treatment token ```:pre``` specifies that the included text is to be treated as pre-formatted.
|
29
|
+
|
30
|
+
#### CLI
|
31
|
+
|
32
|
+
You can use the command-line interface to perform the inclusion.
|
33
|
+
|
34
|
+
##### Command
|
35
|
+
|
36
|
+
```sh
|
37
|
+
markdown_helper include --pristine includer.md included.md
|
38
|
+
```
|
39
|
+
|
40
|
+
(Option ```--pristine``` suppresses comment insertion.)
|
41
|
+
|
42
|
+
#### API
|
43
|
+
|
44
|
+
You can use the API to perform the inclusion.
|
45
|
+
|
46
|
+
##### Ruby Code
|
47
|
+
|
48
|
+
```include.rb```:
|
49
|
+
```ruby
|
50
|
+
require 'markdown_helper'
|
51
|
+
|
52
|
+
# Option :pristine suppresses comment insertion.
|
53
|
+
markdown_helper = MarkdownHelper.new(:pristine => true)
|
54
|
+
markdown_helper.include('includer.md', 'included.md')
|
55
|
+
```
|
56
|
+
|
57
|
+
##### Command
|
58
|
+
|
59
|
+
```sh
|
60
|
+
ruby include.rb
|
61
|
+
```
|
62
|
+
|
63
|
+
#### File with Inclusion
|
64
|
+
|
65
|
+
Here's the finished file with the included preformatted text:
|
66
|
+
|
67
|
+
```included.md```:
|
68
|
+
```markdown
|
69
|
+
This file includes the backticked content as pre(formatted).
|
70
|
+
|
71
|
+
<pre>
|
72
|
+
This file uses triple-backtick to format a ```symbol```, which means that it cannot be included as a code block.
|
73
|
+
</pre>
|
74
|
+
|
75
|
+
```
|
76
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
### Include Text As Pre
|
2
|
+
|
3
|
+
Use file inclusion to include text as pre-formatted (rather than as a code block).
|
4
|
+
|
5
|
+
You might need to do this if you have text to include that has triple-backticks.
|
6
|
+
|
7
|
+
#### File to Be Included
|
8
|
+
|
9
|
+
Here's a file containing text to be included; the text has triple-backticks.:
|
10
|
+
|
11
|
+
@[markdown](triple_backtick.md)
|
12
|
+
|
13
|
+
#### Includer File
|
14
|
+
|
15
|
+
Here's a template file that includes it:
|
16
|
+
|
17
|
+
@[markdown](includer.md)
|
18
|
+
|
19
|
+
The treatment token ```:pre``` specifies that the included text is to be treated as pre-formatted.
|
20
|
+
|
21
|
+
@[:markdown](../interface.md)
|
22
|
+
|
23
|
+
#### File with Inclusion
|
24
|
+
|
25
|
+
Here's the finished file with the included preformatted text:
|
26
|
+
|
27
|
+
@[markdown](included.md)
|
28
|
+
|
@@ -8,6 +8,8 @@
|
|
8
8
|
* [Include Markdown](include_files/include_markdown/use_case.md#include-markdown)
|
9
9
|
* [Include Code Block](include_files/include_code_block/use_case.md#include-code-block)
|
10
10
|
* [Include Highlighted Code](include_files/include_highlighted_code/use_case.md#include-highlighted-code)
|
11
|
+
* [Include Text As Comment](include_files/include_text_as_comment/use_case.md#include-text-as-comment)
|
12
|
+
* [Include Text As Pre](include_files/include_text_as_pre/use_case.md#include-text-as-pre)
|
11
13
|
* [Include Generated Text](include_files/include_generated_text/use_case.md#include-generated-text)
|
12
14
|
* [Diagnose Missing Includee](include_files/diagnose_missing_includee/use_case.md#diagnose-missing-includee)
|
13
15
|
* [Diagnose Circular Includes](include_files/diagnose_circular_includes/use_case.md#diagnose-circular-includes)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- burdettelamar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,18 @@ files:
|
|
159
159
|
- markdown/use_cases/include_files/include_markdown/markdown.md
|
160
160
|
- markdown/use_cases/include_files/include_markdown/use_case.md
|
161
161
|
- markdown/use_cases/include_files/include_markdown/use_case_template.md
|
162
|
+
- markdown/use_cases/include_files/include_text_as_comment/hello.rb
|
163
|
+
- markdown/use_cases/include_files/include_text_as_comment/include_text_as_comment.rb
|
164
|
+
- markdown/use_cases/include_files/include_text_as_comment/included.md
|
165
|
+
- markdown/use_cases/include_files/include_text_as_comment/includer.md
|
166
|
+
- markdown/use_cases/include_files/include_text_as_comment/use_case.md
|
167
|
+
- markdown/use_cases/include_files/include_text_as_comment/use_case_template.md
|
168
|
+
- markdown/use_cases/include_files/include_text_as_pre/include_text_as_pre.rb
|
169
|
+
- markdown/use_cases/include_files/include_text_as_pre/included.md
|
170
|
+
- markdown/use_cases/include_files/include_text_as_pre/includer.md
|
171
|
+
- markdown/use_cases/include_files/include_text_as_pre/triple_backtick.md
|
172
|
+
- markdown/use_cases/include_files/include_text_as_pre/use_case.md
|
173
|
+
- markdown/use_cases/include_files/include_text_as_pre/use_case_template.md
|
162
174
|
- markdown/use_cases/include_files/include_use_case.rb
|
163
175
|
- markdown/use_cases/include_files/include_with_added_comments/include_with_added_comments.rb
|
164
176
|
- markdown/use_cases/include_files/include_with_added_comments/included.md
|