diff --git a/versioned_plugins.rb b/versioned_plugins.rb index b2ee16f..b0b21ee 100644 --- a/versioned_plugins.rb +++ b/versioned_plugins.rb @@ -320,16 +320,7 @@ def extract_doc(doc, plugin_full_name, release_tag, release_date, changelog_url) .gsub(":include_path: ../../../logstash/docs/include", ":include_path: ../include/6.x") .gsub(/[\t\r ]+$/,"") - content = content - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#string[string]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#array[array]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#number[number]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#boolean[boolean]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#hash[hash]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#password[password]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#path[path]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#uri[uri]") - .gsub("<>", "{logstash-ref}/configuration-file-structure.html#bytes[bytes]") + content = fix_configuration_file_structure_links(content) .gsub("<>", "{logstash-ref}/event-api.html[Event API]") .gsub("<>", '{logstash-ref}/dead-letter-queues.html[dead-letter-queues]') .gsub("<>", "{logstash-ref}/event-dependent-configuration.html#logstash-config-field-references[Field References]") @@ -381,6 +372,22 @@ def extract_doc(doc, plugin_full_name, release_tag, release_date, changelog_url) write_stack_versions(content, type) end + + # transforms '<>' into {logstash-ref}/configuration-file-structure.html#ANCHOR[ANYTHING] + def fix_configuration_file_structure_links(content) + anchors = %w( + string + array + number + boolean + hash + password + path + uri + bytes + ) + content.gsub(/<<(#{Regexp.union(anchors)}),(.+?)>>/, '{logstash-ref}/configuration-file-structure.html#\1[\2]') + end def versions_index_exists?(name, type) File.exist?("#{logstash_docs_path}/docs/versioned-plugins/#{type}s/#{name}-index.asciidoc")