Skip to content

Commit ea5bbd4

Browse files
authored
Merge pull request #280 from miharp/fix-277-relative-docs-links
Use relative links where the text lands in the docs collection
2 parents 3f1d93a + 574ee42 commit ea5bbd4

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎lib/bolt/config/options.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ module Options
359359
description: "A list of module dependencies for the project. Each dependency is a map of data specifying " \
360360
"the module to install. To install the project's module dependencies, run the `bolt module " \
361361
"install` command. For more information about specifying modules, see [the " \
362-
"documentation](https://docs.openvoxproject.org/openbolt/latest/bolt_installing_modules.html#manually-specify-modules-in-a-bolt-project).",
362+
"documentation](bolt_installing_modules.md#manually-specify-modules-in-a-bolt-project).",
363363
type: Array,
364364
items: {
365365
type: [Hash, String],

‎lib/bolt/inventory/options.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module Options
8484
"plugin_hooks" => {
8585
description: "Configuration for the Puppet library plugin used to install the " \
8686
"Puppet agent on the target. For more information, see " \
87-
"https://docs.openvoxproject.org/openbolt/latest/writing_plugins.html",
87+
"[plugin hooks](writing_plugins.md#plugin-hooks).",
8888
type: Hash,
8989
properties: {
9090
"puppet_library" => {

‎rakelib/docs.rake‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ begin
148148
$stdout.puts "Generated packaged modules at:\n\t#{filepath}"
149149
end
150150

151+
# CLI help text carries full docs URLs, because it is printed to a terminal
152+
# where a relative link has nothing to resolve against. Inside the docs
153+
# collection the same text must use relative links, so that a locally served
154+
# build works offline and a page in an older collection does not silently
155+
# follow '/latest/' across a version boundary.
156+
docs_url = %r{https://docs\.openvoxproject\.org/openbolt/latest/(\S+?\.html(?:\#[\w-]+)?)}
157+
relative_docs_links = lambda do |text|
158+
text.gsub(docs_url) { "[#{Regexp.last_match(1)}](#{Regexp.last_match(1)})" }
159+
end
160+
151161
desc "Generate markdown docs for Bolt shell commands"
152162
task :command_reference do
153163
require 'bolt/bolt_option_parser'
@@ -172,11 +182,11 @@ begin
172182
short: switch.short.first,
173183
long: switch.long.first,
174184
arg: switch.arg,
175-
desc: switch.desc.map { |d| d.gsub("<", "&lt;") }.join(" ")
185+
desc: relative_docs_links.call(switch.desc.map { |d| d.gsub("<", "&lt;") }.join(" "))
176186
}
177187
end
178188

179-
desc = matches[:desc].split("\n").map(&:strip).join("\n")
189+
desc = relative_docs_links.call(matches[:desc].split("\n").map(&:strip).join("\n"))
180190
usage = matches[:usage].strip
181191

182192
@commands[command] = {

‎schemas/bolt-inventory.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,7 @@
18541854
]
18551855
},
18561856
"plugin_hooks": {
1857-
"description": "Configuration for the Puppet library plugin used to install the Puppet agent on the target. For more information, see https://docs.openvoxproject.org/openbolt/latest/writing_plugins.html",
1857+
"description": "Configuration for the Puppet library plugin used to install the Puppet agent on the target. For more information, see [plugin hooks](writing_plugins.md#plugin-hooks).",
18581858
"oneOf": [
18591859
{
18601860
"type": "object",

‎schemas/bolt-project.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
}
279279
},
280280
"modules": {
281-
"description": "A list of module dependencies for the project. Each dependency is a map of data specifying the module to install. To install the project's module dependencies, run the `bolt module install` command. For more information about specifying modules, see [the documentation](https://docs.openvoxproject.org/openbolt/latest/bolt_installing_modules.html#manually-specify-modules-in-a-bolt-project).",
281+
"description": "A list of module dependencies for the project. Each dependency is a map of data specifying the module to install. To install the project's module dependencies, run the `bolt module install` command. For more information about specifying modules, see [the documentation](bolt_installing_modules.md#manually-specify-modules-in-a-bolt-project).",
282282
"type": "array",
283283
"items": {
284284
"type": [

0 commit comments

Comments
 (0)