markdown_helper 1.5.0 → 1.5.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +6 -3
- data/lib/markdown_helper.rb +2 -5
- data/lib/markdown_helper/version.rb +1 -1
- data/readme_files/use_cases/evergreen_examples.md +2 -2
- data/readme_files/use_cases/generated_text.md +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e7b32f5f6e0b8b46878e5ef5586d2f94852c60
|
4
|
+
data.tar.gz: efefe056e97327bc5dafd225774e52ce81955a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62891f62df9f8a0a68f1cd865335057285e9a9b1cd28d7ff0d153fdb05e679bb61accec96ec626f6dfc450843e8bc3f6f0fbc7b3b38d09d3de9e7488a2c88e9c
|
7
|
+
data.tar.gz: 588635b8668e9757edcb0d1eaa11364c640763471b3d943410a2a650344f7168d152fd2f9cd6752c494ee57c57405702153f7b57f4da1e1fcec28781144f20ee
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -14,13 +14,16 @@ namespace :build do
|
|
14
14
|
Rake::Task['build:usages'].invoke
|
15
15
|
require_relative 'lib/markdown_helper'
|
16
16
|
markdown_helper = MarkdownHelper.new
|
17
|
-
|
17
|
+
template_file_path = 'readme_files/highlight_ruby_template.md'
|
18
|
+
markdown_file_path = 'readme_files/highlighted_ruby.md'
|
19
|
+
markdown_helper.include(template_file_path, markdown_file_path)
|
18
20
|
# Do the resolve before the include, so that the included text is not also resolved.
|
19
|
-
#
|
21
|
+
# This protects example code from being also resolved, thus damaging the example code.
|
20
22
|
# Temp file must be in the same directory as its source (it becomes the source).
|
21
23
|
temp_file_path = 'readme_files/temp_resolved.md'
|
22
24
|
markdown_helper.resolve('readme_files/README.template.md', temp_file_path)
|
23
|
-
|
25
|
+
readme_file_path = 'README.md'
|
26
|
+
markdown_helper.include(temp_file_path, readme_file_path)
|
24
27
|
File.delete(temp_file_path)
|
25
28
|
end
|
26
29
|
|
data/lib/markdown_helper.rb
CHANGED
@@ -41,10 +41,9 @@ class MarkdownHelper
|
|
41
41
|
# @example pragma to include text verbatim, to be rendered as markdown.
|
42
42
|
# @[:verbatim](foo.md)
|
43
43
|
def include(template_file_path, markdown_file_path)
|
44
|
-
|
44
|
+
send(:generate_file, template_file_path, markdown_file_path, __method__) do |input_lines, output_lines|
|
45
45
|
send(:include_files, template_file_path, input_lines, output_lines, paths = [], realpaths = [])
|
46
46
|
end
|
47
|
-
output
|
48
47
|
end
|
49
48
|
|
50
49
|
# Resolves relative image paths to absolute urls in markdown text.
|
@@ -70,10 +69,9 @@ class MarkdownHelper
|
|
70
69
|
# )
|
71
70
|
def resolve(template_file_path, markdown_file_path)
|
72
71
|
# Method :generate_file does the first things, yields the block, does the last things.
|
73
|
-
|
72
|
+
send(:generate_file, template_file_path, markdown_file_path, __method__) do |input_lines, output_lines|
|
74
73
|
send(:resolve_images, input_lines, output_lines)
|
75
74
|
end
|
76
|
-
output
|
77
75
|
end
|
78
76
|
alias resolve_image_urls resolve
|
79
77
|
|
@@ -192,7 +190,6 @@ EOT
|
|
192
190
|
end
|
193
191
|
formatted_attributes_s = formatted_attributes.join(' ')
|
194
192
|
repo_user, repo_name = repo_user_and_name
|
195
|
-
absolute_file_path = nil
|
196
193
|
if relative_file_path.start_with?('http')
|
197
194
|
absolute_file_path = relative_file_path
|
198
195
|
else
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Example code and output that's embedded in a markdown file is dead text that may no longer be correct.
|
4
4
|
|
5
|
-
Use the markdown helper to include example code and output -- but only after the project "build" has re-run the code and
|
5
|
+
Use the markdown helper to include example code and output -- but only after the project "build" has re-run the code and refreshed the output!
|
6
6
|
|
7
7
|
Here's how:
|
8
8
|
|
9
9
|
1. Maintain each code example in a separate executable file.
|
10
|
-
1. Maintain markdown files that have include
|
10
|
+
1. Maintain markdown files that have include descriptions, rather than embedded code and output.
|
11
11
|
1. At project "build time" (controlled by a suitable build tool):
|
12
12
|
1. Execute each code example, capturing its output to one or more files.
|
13
13
|
1. Check output for errors and validity.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
### Include Generated Text
|
2
2
|
|
3
|
-
Use the markdown helper to include text that is
|
3
|
+
Use the markdown helper to include text that is generated at project "build time."
|
4
4
|
|
5
|
-
Example: Project build runs each executable with option <code>--help</code>, capturing the output into a file. That file can then be included into the markdown pages for the project.
|
5
|
+
Example: Project build runs each executable with option <code>--help</code>, capturing the output into a file. That file can then be included into the markdown pages for the project.
|
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- burdettelamar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|