markdown_helper 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -5
  3. data/CODE_OF_CONDUCT.md +74 -74
  4. data/Gemfile.lock +2 -1
  5. data/LICENSE.txt +21 -21
  6. data/README.md +60 -47
  7. data/Rakefile +16 -13
  8. data/bin/_include +0 -1
  9. data/bin/_resolve +0 -1
  10. data/bin/markdown_helper +3 -0
  11. data/bin/setup +8 -8
  12. data/lib/markdown_helper.rb +329 -97
  13. data/lib/markdown_helper/version.rb +1 -1
  14. data/markdown/{README.template.md → readme/README.template.md} +25 -12
  15. data/markdown/{code_block_ruby_template.md → readme/code_block_ruby_template.md} +0 -0
  16. data/markdown/{highlight_ruby_template.md → readme/highlight_ruby_template.md} +0 -0
  17. data/markdown/readme/highlighted_ruby.md +12 -0
  18. data/markdown/{include.md → readme/include.md} +0 -0
  19. data/markdown/{include.rb → readme/include.rb} +0 -0
  20. data/markdown/{include_usage.rb → readme/include_usage.rb} +0 -0
  21. data/markdown/{resolve.md → readme/resolve.md} +0 -0
  22. data/markdown/{resolve_usage.rb → readme/resolve_usage.rb} +0 -0
  23. data/markdown/{verbatim_ruby_template.md → readme/verbatim_ruby_template.md} +0 -0
  24. data/markdown/use_cases/Rakefile +53 -23
  25. data/markdown/use_cases/include/diagnose_circular_includes/diagnose_circular_includes.err +26 -0
  26. data/markdown/use_cases/include/diagnose_circular_includes/diagnose_circular_includes.rb +65 -0
  27. data/markdown/use_cases/include/diagnose_circular_includes/include.rb +5 -0
  28. data/markdown/use_cases/include/diagnose_circular_includes/includer.md +1 -0
  29. data/markdown/use_cases/include/diagnose_circular_includes/includer_0.md +1 -0
  30. data/markdown/use_cases/include/diagnose_circular_includes/includer_1.md +1 -0
  31. data/markdown/use_cases/include/diagnose_circular_includes/includer_2.md +1 -0
  32. data/markdown/use_cases/include/diagnose_circular_includes/use_case.md +98 -0
  33. data/markdown/use_cases/include/diagnose_circular_includes/use_case_template.md +27 -0
  34. data/markdown/use_cases/include/diagnose_missing_includee/diagnose_missing_includee.err +26 -0
  35. data/markdown/use_cases/include/diagnose_missing_includee/diagnose_missing_includee.rb +67 -0
  36. data/markdown/use_cases/include/diagnose_missing_includee/include.rb +5 -0
  37. data/markdown/use_cases/include/diagnose_missing_includee/included.md +1 -0
  38. data/markdown/use_cases/include/diagnose_missing_includee/includer.md +1 -0
  39. data/markdown/use_cases/include/diagnose_missing_includee/includer_0.md +1 -0
  40. data/markdown/use_cases/include/diagnose_missing_includee/includer_1.md +1 -0
  41. data/markdown/use_cases/include/diagnose_missing_includee/includer_2.md +1 -0
  42. data/markdown/use_cases/include/diagnose_missing_includee/use_case.md +100 -0
  43. data/markdown/use_cases/include/diagnose_missing_includee/use_case_template.md +29 -0
  44. data/markdown/use_cases/include/include.rb +5 -0
  45. data/markdown/use_cases/include/include_code_block/hello.rb +8 -0
  46. data/markdown/use_cases/include/include_code_block/include_code_block.rb +79 -0
  47. data/markdown/use_cases/include/include_code_block/included.md +14 -0
  48. data/markdown/use_cases/include/include_code_block/includer.md +4 -0
  49. data/markdown/use_cases/include/include_code_block/use_case.md +108 -0
  50. data/markdown/use_cases/include/include_code_block/use_case_template.md +33 -0
  51. data/markdown/use_cases/include/include_generated_text/include_generated_text.rb +38 -0
  52. data/markdown/use_cases/include/include_generated_text/use_case.md +18 -0
  53. data/markdown/use_cases/include/include_generated_text/use_case_template.md +18 -0
  54. data/markdown/use_cases/include/include_highlighted_code/hello.rb +8 -0
  55. data/markdown/use_cases/include/include_highlighted_code/include_highlighted_code.rb +83 -0
  56. data/markdown/use_cases/include/include_highlighted_code/included.md +14 -0
  57. data/markdown/use_cases/include/include_highlighted_code/includer.md +4 -0
  58. data/markdown/use_cases/include/include_highlighted_code/use_case.md +110 -0
  59. data/markdown/use_cases/include/include_highlighted_code/use_case_template.md +35 -0
  60. data/markdown/use_cases/include/include_markdown/include_markdown.rb +81 -0
  61. data/markdown/use_cases/include/include_markdown/included.md +13 -0
  62. data/markdown/use_cases/include/include_markdown/includer.md +4 -0
  63. data/markdown/use_cases/include/include_markdown/markdown.md +10 -0
  64. data/markdown/use_cases/include/include_markdown/use_case.md +106 -0
  65. data/markdown/use_cases/include/include_markdown/use_case_template.md +33 -0
  66. data/markdown/use_cases/include/include_use_case.rb +110 -0
  67. data/markdown/use_cases/include/include_with_added_comments/include_with_added_comments.rb +43 -60
  68. data/markdown/use_cases/include/include_with_added_comments/included.md +2 -2
  69. data/markdown/use_cases/include/include_with_added_comments/use_case.md +56 -0
  70. data/markdown/use_cases/include/include_with_added_comments/{template.md → use_case_template.md} +20 -1
  71. data/markdown/use_cases/include/interface.md +25 -0
  72. data/markdown/use_cases/include/nest_inclusions/included.md +5 -0
  73. data/markdown/use_cases/include/nest_inclusions/includee.md +3 -0
  74. data/markdown/use_cases/include/nest_inclusions/includer.md +3 -0
  75. data/markdown/use_cases/include/nest_inclusions/nest_inclusions.rb +61 -0
  76. data/markdown/use_cases/include/nest_inclusions/nested_includee.md +1 -0
  77. data/markdown/use_cases/include/nest_inclusions/use_case.md +74 -0
  78. data/markdown/use_cases/include/nest_inclusions/use_case_template.md +23 -0
  79. data/markdown/use_cases/include/reuse_text/include.rb +5 -0
  80. data/markdown/use_cases/include/reuse_text/included.md +2 -5
  81. data/markdown/use_cases/include/reuse_text/includee.md +1 -0
  82. data/markdown/use_cases/include/reuse_text/includer.md +2 -5
  83. data/markdown/use_cases/include/reuse_text/reuse_text.rb +24 -77
  84. data/markdown/use_cases/include/reuse_text/use_case.md +69 -0
  85. data/markdown/use_cases/include/reuse_text/use_case_template.md +23 -0
  86. data/markdown/use_cases/resolve/gemify_images/gemify_images.rb +58 -29
  87. data/markdown/use_cases/resolve/gemify_images/template.md +4 -0
  88. data/markdown/use_cases/use_case.rb +45 -0
  89. data/markdown/use_cases/use_cases.md +9 -2
  90. data/markdown_helper.gemspec +1 -1
  91. metadata +70 -19
  92. data/markdown/highlighted_ruby.md +0 -12
  93. data/markdown/use_cases/include/include_generated_text/build.rb +0 -46
  94. data/markdown/use_cases/include/include_with_added_comments/include_with_added_comments.md +0 -37
  95. data/markdown/use_cases/include/reuse_text/reusable_text.md +0 -1
  96. data/markdown/use_cases/include/reuse_text/reuse_text.md +0 -54
  97. data/markdown/use_cases/include/reuse_text/template.md +0 -33
@@ -0,0 +1,23 @@
1
+ ### Reuse Text
2
+
3
+ Use file inclusion to stay DRY (Don't Repeat Yourself).
4
+
5
+ Maintain reusable text in a separate file, then include it wherever it's needed.
6
+
7
+ #### File To Be Included
8
+
9
+ @[markdown](includee.md)
10
+
11
+ #### Includer File
12
+
13
+ @[markdown](includer.md)
14
+
15
+ The treatment token ```:markdown``` specifies that the included text is to be treated as more markdown.
16
+
17
+ @[:markdown](../interface.md)
18
+
19
+ #### File with Inclusion
20
+
21
+ Here's the output file, after inclusion.
22
+
23
+ @[markdown](included.md)
@@ -1,39 +1,68 @@
1
- #!/usr/bin/env ruby
1
+ require_relative '../../use_case'
2
2
 
3
- relative_image_file_name = 'relative_image.md'
4
- absolute_image_file_name = 'resolved_image.md'
5
- template_file_name = 'template.md'
6
- use_case_file_name = 'gemify_images.md'
3
+ class GemifyImages < UseCase
7
4
 
8
- resolve_command = "markdown_helper resolve --pristine #{relative_image_file_name} #{absolute_image_file_name}"
5
+ def self.build
9
6
 
10
- File.write(
11
- relative_image_file_name,
12
- <<EOT
13
- ![html_image](../../../images/html.png)
14
- EOT
15
- )
7
+ use_case_dir_path = File.absolute_path(File.dirname(__FILE__))
16
8
 
17
- # Example resolution.
18
- system(resolve_command)
9
+ use_case = self.new(use_case_dir_path)
19
10
 
20
- File.write(
21
- template_file_name,
22
- <<EOT
23
- ### Gemify Images
11
+ reusable_text_file_name = 'reusable_text.md'
12
+ includer_file_name = 'includer.md'
13
+ included_file_name = 'included.md'
24
14
 
25
- Use the markdown helper to resolve image paths for a Ruby gem.
15
+ resolve_command = use_case.construct_resolve_command(includer_file_name, included_file_name, pristine = true)
16
+ build_command = use_case.construct_include_command(TEMPLATE_FILE_NAME, USE_CASE_FILE_NAME, pristine = true)
26
17
 
27
- When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
18
+ use_case.commands_to_execute.push(
19
+ resolve_command,
20
+ build_command,
21
+ )
28
22
 
29
- If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
23
+ #
24
+ # relative_image_file_name = 'relative_image.md'
25
+ # absolute_image_file_name = 'resolved_image.md'
26
+ # template_file_name = 'template.md'
27
+ # use_case_file_name = 'gemify_images.md'
28
+ #
29
+ # resolve_command = "markdown_helper resolve --pristine #{relative_image_file_name} #{absolute_image_file_name}"
30
+ #
31
+ # File.write(
32
+ # relative_image_file_name,
33
+ # <<EOT
34
+ # ![html_image](../../../images/html.png)
35
+ # EOT
36
+ # )
37
+ #
38
+ # # Example resolution.
39
+ # # system(resolve_command)
40
+ #
41
+ # File.write(
42
+ # template_file_name,
43
+ # <<EOT
44
+ # ### Gemify Images
45
+ #
46
+ # Use the markdown helper to resolve image paths for a Ruby gem.
47
+ #
48
+ # #### The Problem
49
+ #
50
+ # When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
51
+ #
52
+ # If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
53
+ #
54
+ # #### The Solution
55
+ #
56
+ # To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
57
+ #
58
+ # This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
59
+ # EOT
60
+ # )
61
+ #
62
+ # # Build use case.
63
+ # # build_command = "markdown_helper include --pristine #{template_file_name} #{use_case_file_name}"
64
+ # # system(build_command)
30
65
 
31
- To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
66
+ end
32
67
 
33
- This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
34
- EOT
35
- )
36
-
37
- # Build use case.
38
- build_command = "markdown_helper include --pristine #{template_file_name} #{use_case_file_name}"
39
- system(build_command)
68
+ end
@@ -2,10 +2,14 @@
2
2
 
3
3
  Use the markdown helper to resolve image paths for a Ruby gem.
4
4
 
5
+ #### The Problem
6
+
5
7
  When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
6
8
 
7
9
  If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
8
10
 
11
+ #### The Solution
12
+
9
13
  To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
10
14
 
11
15
  This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
@@ -0,0 +1,45 @@
1
+ class UseCase
2
+
3
+ attr_accessor :use_case_dir_path, :files_to_write, :commands_to_execute
4
+
5
+ USE_CASE_FILE_NAME = 'use_case.md'
6
+ TEMPLATE_FILE_NAME = 'use_case_template.md'
7
+
8
+ def initialize(use_case_dir_path)
9
+ self.use_case_dir_path = use_case_dir_path
10
+ self.files_to_write = {}
11
+ self.commands_to_execute = []
12
+ end
13
+
14
+ def build
15
+ Dir.chdir(use_case_dir_path) do
16
+ files_to_write.each_pair do |file_name, text|
17
+ File.open(file_name, 'w') do |file|
18
+ file.write(text)
19
+ end
20
+ end
21
+ commands_to_execute.each do |command|
22
+ system(command)
23
+ end
24
+ end
25
+ end
26
+
27
+ def construct_command(command, template_file_path, markdown_file_path, pristine = false)
28
+ pristine_option = pristine ? '--pristine ' : ''
29
+ "markdown_helper #{command} #{pristine_option}#{template_file_path} #{markdown_file_path}"
30
+ end
31
+
32
+ def construct_include_command(template_file_path, markdown_file_path, pristine = false)
33
+ construct_command(:include, template_file_path, markdown_file_path, pristine)
34
+ end
35
+
36
+ def construct_resolve_command(template_file_path, markdown_file_path, pristine = false)
37
+ construct_command(:resolve, template_file_path, markdown_file_path, pristine)
38
+ end
39
+
40
+ def UseCase.construct_include_command(template_file_path, markdown_file_path, pristine = false)
41
+ pristine_option = pristine ? '--pristine ' : ''
42
+ "markdown_helper include #{pristine_option}#{template_file_path} #{markdown_file_path}"
43
+ end
44
+
45
+ end
@@ -2,5 +2,12 @@
2
2
 
3
3
  ## Include
4
4
 
5
- * [Reuse Text](include/reuse_text/reuse_text.md#reuse-text)
6
- * [Include with Added Comments](include/include_with_added_comments/include_with_added_comments.md#include-with-added-comments)
5
+ * [Reuse Text](include/reuse_text/use_case.md#reuse-text)
6
+ * [Include with Added Comments](include/include_with_added_comments/use_case.md#include-with-added-comments)
7
+ * [Nest Inclusions](include/nest_inclusions/use_case.md#nest-inclusions)
8
+ * [Include Markdown](include/include_markdown/use_case.md#include-markdown)
9
+ * [Include a Code Block](include/include_code_block/use_case.md#include-code-block)
10
+ * [Include Highlighted Code](include/include_highlighted_code/use_case.md#include-highlighted-code)
11
+ * [Include Generated Text](include/include_generated_text/use_case.md#include-generated-text)
12
+ * [Diagnose Missing Includee](include/diagnose_missing_includee/use_case.md#diagnose-missing-includee)
13
+ * [Diagnose Circular Includes](include/diagnose_circular_includes/use_case.md#diagnose-circular-includes)
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'markdown_helper'
8
8
  spec.version = MarkdownHelper::VERSION
9
9
  spec.authors = ['burdettelamar']
10
- spec.email = ['BurdetteLamar@Yahoo.com']
10
+ spec.email = ['burdettelamar@yahoo.com']
11
11
  spec.summary = 'Class to help with GitHub markdown.'
12
12
  spec.description = <<-EOT
13
13
  Class to help with GitHub markdown:
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: 1.8.0
4
+ version: 1.9.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-04-29 00:00:00.000000000 Z
11
+ date: 2018-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ description: |
73
73
  * Image path resolution
74
74
  * Image attributes
75
75
  email:
76
- - BurdetteLamar@Yahoo.com
76
+ - burdettelamar@yahoo.com
77
77
  executables:
78
78
  - markdown_helper
79
79
  extensions: []
@@ -103,29 +103,80 @@ files:
103
103
  - images/include.png
104
104
  - lib/markdown_helper.rb
105
105
  - lib/markdown_helper/version.rb
106
- - markdown/README.template.md
107
- - markdown/code_block_ruby_template.md
108
- - markdown/highlight_ruby_template.md
109
- - markdown/highlighted_ruby.md
110
- - markdown/include.md
111
- - markdown/include.rb
112
- - markdown/include_usage.rb
113
- - markdown/resolve.md
114
- - markdown/resolve_usage.rb
106
+ - markdown/readme/README.template.md
107
+ - markdown/readme/code_block_ruby_template.md
108
+ - markdown/readme/highlight_ruby_template.md
109
+ - markdown/readme/highlighted_ruby.md
110
+ - markdown/readme/include.md
111
+ - markdown/readme/include.rb
112
+ - markdown/readme/include_usage.rb
113
+ - markdown/readme/resolve.md
114
+ - markdown/readme/resolve_usage.rb
115
+ - markdown/readme/verbatim_ruby_template.md
115
116
  - markdown/use_cases/Rakefile
116
- - markdown/use_cases/include/include_generated_text/build.rb
117
- - markdown/use_cases/include/include_with_added_comments/include_with_added_comments.md
117
+ - markdown/use_cases/include/diagnose_circular_includes/diagnose_circular_includes.err
118
+ - markdown/use_cases/include/diagnose_circular_includes/diagnose_circular_includes.rb
119
+ - markdown/use_cases/include/diagnose_circular_includes/include.rb
120
+ - markdown/use_cases/include/diagnose_circular_includes/includer.md
121
+ - markdown/use_cases/include/diagnose_circular_includes/includer_0.md
122
+ - markdown/use_cases/include/diagnose_circular_includes/includer_1.md
123
+ - markdown/use_cases/include/diagnose_circular_includes/includer_2.md
124
+ - markdown/use_cases/include/diagnose_circular_includes/use_case.md
125
+ - markdown/use_cases/include/diagnose_circular_includes/use_case_template.md
126
+ - markdown/use_cases/include/diagnose_missing_includee/diagnose_missing_includee.err
127
+ - markdown/use_cases/include/diagnose_missing_includee/diagnose_missing_includee.rb
128
+ - markdown/use_cases/include/diagnose_missing_includee/include.rb
129
+ - markdown/use_cases/include/diagnose_missing_includee/included.md
130
+ - markdown/use_cases/include/diagnose_missing_includee/includer.md
131
+ - markdown/use_cases/include/diagnose_missing_includee/includer_0.md
132
+ - markdown/use_cases/include/diagnose_missing_includee/includer_1.md
133
+ - markdown/use_cases/include/diagnose_missing_includee/includer_2.md
134
+ - markdown/use_cases/include/diagnose_missing_includee/use_case.md
135
+ - markdown/use_cases/include/diagnose_missing_includee/use_case_template.md
136
+ - markdown/use_cases/include/include.rb
137
+ - markdown/use_cases/include/include_code_block/hello.rb
138
+ - markdown/use_cases/include/include_code_block/include_code_block.rb
139
+ - markdown/use_cases/include/include_code_block/included.md
140
+ - markdown/use_cases/include/include_code_block/includer.md
141
+ - markdown/use_cases/include/include_code_block/use_case.md
142
+ - markdown/use_cases/include/include_code_block/use_case_template.md
143
+ - markdown/use_cases/include/include_generated_text/include_generated_text.rb
144
+ - markdown/use_cases/include/include_generated_text/use_case.md
145
+ - markdown/use_cases/include/include_generated_text/use_case_template.md
146
+ - markdown/use_cases/include/include_highlighted_code/hello.rb
147
+ - markdown/use_cases/include/include_highlighted_code/include_highlighted_code.rb
148
+ - markdown/use_cases/include/include_highlighted_code/included.md
149
+ - markdown/use_cases/include/include_highlighted_code/includer.md
150
+ - markdown/use_cases/include/include_highlighted_code/use_case.md
151
+ - markdown/use_cases/include/include_highlighted_code/use_case_template.md
152
+ - markdown/use_cases/include/include_markdown/include_markdown.rb
153
+ - markdown/use_cases/include/include_markdown/included.md
154
+ - markdown/use_cases/include/include_markdown/includer.md
155
+ - markdown/use_cases/include/include_markdown/markdown.md
156
+ - markdown/use_cases/include/include_markdown/use_case.md
157
+ - markdown/use_cases/include/include_markdown/use_case_template.md
158
+ - markdown/use_cases/include/include_use_case.rb
118
159
  - markdown/use_cases/include/include_with_added_comments/include_with_added_comments.rb
119
160
  - markdown/use_cases/include/include_with_added_comments/included.md
120
161
  - markdown/use_cases/include/include_with_added_comments/includee.md
121
162
  - markdown/use_cases/include/include_with_added_comments/includer.md
122
- - markdown/use_cases/include/include_with_added_comments/template.md
163
+ - markdown/use_cases/include/include_with_added_comments/use_case.md
164
+ - markdown/use_cases/include/include_with_added_comments/use_case_template.md
165
+ - markdown/use_cases/include/interface.md
166
+ - markdown/use_cases/include/nest_inclusions/included.md
167
+ - markdown/use_cases/include/nest_inclusions/includee.md
168
+ - markdown/use_cases/include/nest_inclusions/includer.md
169
+ - markdown/use_cases/include/nest_inclusions/nest_inclusions.rb
170
+ - markdown/use_cases/include/nest_inclusions/nested_includee.md
171
+ - markdown/use_cases/include/nest_inclusions/use_case.md
172
+ - markdown/use_cases/include/nest_inclusions/use_case_template.md
173
+ - markdown/use_cases/include/reuse_text/include.rb
123
174
  - markdown/use_cases/include/reuse_text/included.md
175
+ - markdown/use_cases/include/reuse_text/includee.md
124
176
  - markdown/use_cases/include/reuse_text/includer.md
125
- - markdown/use_cases/include/reuse_text/reusable_text.md
126
- - markdown/use_cases/include/reuse_text/reuse_text.md
127
177
  - markdown/use_cases/include/reuse_text/reuse_text.rb
128
- - markdown/use_cases/include/reuse_text/template.md
178
+ - markdown/use_cases/include/reuse_text/use_case.md
179
+ - markdown/use_cases/include/reuse_text/use_case_template.md
129
180
  - markdown/use_cases/pristine.md
130
181
  - markdown/use_cases/resolve/gemify_images/gemify_images.md
131
182
  - markdown/use_cases/resolve/gemify_images/gemify_images.rb
@@ -133,8 +184,8 @@ files:
133
184
  - markdown/use_cases/resolve/gemify_images/resolved_image.md
134
185
  - markdown/use_cases/resolve/gemify_images/template.md
135
186
  - markdown/use_cases/resolve/resize_images/template.md
187
+ - markdown/use_cases/use_case.rb
136
188
  - markdown/use_cases/use_cases.md
137
- - markdown/verbatim_ruby_template.md
138
189
  - markdown_helper.gemspec
139
190
  homepage: https://github.com/BurdetteLamar/markdown_helper
140
191
  licenses:
@@ -1,12 +0,0 @@
1
- <!-- >>>>>> BEGIN GENERATED FILE (include): SOURCE markdown/highlight_ruby_template.md -->
2
- <!-- >>>>>> BEGIN INCLUDED FILE (ruby): SOURCE markdown/include.rb -->
3
- <code>include.rb</code>
4
- ```ruby
5
- class RubyCode
6
- def initialize
7
- raise RuntimeError.new('I am only an example!')
8
- end
9
- end
10
- ```
11
- <!-- <<<<<< END INCLUDED FILE (ruby): SOURCE markdown/include.rb -->
12
- <!-- <<<<<< END GENERATED FILE (include): SOURCE markdown/highlight_ruby_template.md -->
@@ -1,46 +0,0 @@
1
- template_file_name = 'template.md'
2
- use_case_file_name = 'use_case.md'
3
-
4
- help_text_file_name = 'include_help.txt'
5
- includer_file_name = 'includer.md'
6
- included_file_name = 'included.md'
7
-
8
- help_command = "markdown_helper include --help > #{help_text_file_name}"
9
- include_command = 'markdown_helper include --pristine including_file.md include_help.txt'
10
- include_command = "markdown_helper include --pristine #{includer_file_name} #{included_file_name}"
11
- build_command = "markdown_helper include --pristine #{template_file_name} #{use_case_file_name}"
12
- build_command = "markdown_helper include --pristine #{template_file_name} #{use_case_file_name}"
13
-
14
-
15
-
16
- template = <<EOT
17
- ### Include Generated Text
18
-
19
- Use the markdown helper to include text that is generated at project "build time."
20
-
21
- #### Example
22
-
23
- In this project, some markdown pages include help text from the project's executables. At project "build" time, each executable is run with option ```--help```, and the help text is captured in a file. That file is then included wherever it's needed.
24
-
25
- Thus the displayed help text is always up-to-date.
26
-
27
- ### Command to Generate Help Text
28
-
29
- ```sh
30
- #{help_command}
31
- ```
32
-
33
- ### Help Text
34
-
35
- @[:code_block](#{help_text_file_path})
36
-
37
- ###
38
-
39
- EOT
40
-
41
- includer_file = <<EOT
42
- ### File to Include Help
43
-
44
- @[:code_block](including_file.md)
45
- EOT
46
-
@@ -1,37 +0,0 @@
1
- ### Include with Added Comments
2
-
3
- By default (that is, without option ```--pristine```) file inclusion adds comments that:
4
-
5
- * Identify the includer file.
6
- * Identify each includee file.
7
-
8
- #### Includee File
9
-
10
- <code>includee.md</code>
11
- ```markdown
12
- Text to be included.
13
- ```
14
-
15
- #### Includer File
16
-
17
- <code>includer.md</code>
18
- ```markdown
19
- @[:markdown](includee.md)
20
- ```
21
-
22
- #### Inclusion Command
23
-
24
- ```sh
25
- markdown_helper include includer.md included.md
26
- ```
27
-
28
- #### File with Inclusion and Added Comments
29
-
30
- <code>included.md</code>
31
- ```markdown
32
- <!-- >>>>>> BEGIN GENERATED FILE (include): SOURCE includer.md -->
33
- <!-- >>>>>> BEGIN INCLUDED FILE (markdown): SOURCE ./includee.md -->
34
- Text to be included.
35
- <!-- <<<<<< END INCLUDED FILE (markdown): SOURCE ./includee.md -->
36
- <!-- <<<<<< END GENERATED FILE (include): SOURCE includer.md -->
37
- ```
@@ -1 +0,0 @@
1
- This is some reusable text that can be included in more than one place (actually, in more than one file).
@@ -1,54 +0,0 @@
1
- ### Reuse Text
2
-
3
- Use file inclusion to stay DRY (Don't Repeat Yourself).
4
-
5
- Maintain reusable text in a separate file, then include it wherever it's needed.
6
-
7
- #### File to Be Included
8
-
9
- Here's a file containing some text that can be included:
10
-
11
- <code>reusable_text.md</code>
12
- ```markdown
13
- This is some reusable text that can be included in more than one place (actually, in more than one file).
14
- ```
15
-
16
- #### Includer File
17
-
18
- Here's a template file that includes it:
19
-
20
- <code>includer.md</code>
21
- ```markdown
22
- This file includes the useful text.
23
-
24
- @[:markdown](reusable_text.md)
25
-
26
- Then includes it again.
27
-
28
- @[:markdown](reusable_text.md)
29
- ```
30
-
31
- #### Command
32
-
33
- Here's the command to perform the inclusion:
34
-
35
- ```sh
36
- markdown_helper include --pristine includer.md included.md
37
- ```
38
-
39
- (Option ```--pristine``` suppresses comment insertion.)
40
-
41
- #### File with Inclusion
42
-
43
- Here's the finished file with the inclusion:
44
-
45
- <code>included.md</code>
46
- ```markdown
47
- This file includes the useful text.
48
-
49
- This is some reusable text that can be included in more than one place (actually, in more than one file).
50
-
51
- Then includes it again.
52
-
53
- This is some reusable text that can be included in more than one place (actually, in more than one file).
54
- ```