in versioned_plugins.rb [299:387]
def extract_doc(doc, plugin_full_name, release_tag, release_date, changelog_url)
_, type, name = plugin_full_name.split("-",3)
content = doc \
.gsub("%VERSION%", release_tag) \
.gsub("%RELEASE_DATE%", release_date) \
.gsub("%CHANGELOG_URL%", changelog_url) \
.gsub(":include_path: ../../../../logstash/docs/include", ":include_path: ../include/6.x") \
content = content.sub(/^=== .+? [Pp]lugin$/) do |header|
"#{header} {version}"
end
if repair?
content = content.gsub(/^====== /, "===== ")
.gsub(/^\[source\]$/, "[source,shell]")
.gsub('[id="plugins-{type}-{plugin}', '[id="plugins-{type}s-{plugin}')
.gsub(":include_path: ../../../logstash/docs/include", ":include_path: ../include/6.x")
.gsub(/[\t\r ]+$/,"")
content = content
.gsub("<<string,string>>", "{logstash-ref}/configuration-file-structure.html#string[string]")
.gsub("<<array,array>>", "{logstash-ref}/configuration-file-structure.html#array[array]")
.gsub("<<number,number>>", "{logstash-ref}/configuration-file-structure.html#number[number]")
.gsub("<<boolean,boolean>>", "{logstash-ref}/configuration-file-structure.html#boolean[boolean]")
.gsub("<<hash,hash>>", "{logstash-ref}/configuration-file-structure.html#hash[hash]")
.gsub("<<password,password>>", "{logstash-ref}/configuration-file-structure.html#password[password]")
.gsub("<<path,path>>", "{logstash-ref}/configuration-file-structure.html#path[path]")
.gsub("<<uri,uri>>", "{logstash-ref}/configuration-file-structure.html#uri[uri]")
.gsub("<<bytes,bytes>>", "{logstash-ref}/configuration-file-structure.html#bytes[bytes]")
.gsub("<<event-api,Event API>>", "{logstash-ref}/event-api.html[Event API]")
.gsub("<<dead-letter-queues>>", '{logstash-ref}/dead-letter-queues.html[dead-letter-queues]')
.gsub("<<logstash-config-field-references>>", "{logstash-ref}/event-dependent-configuration.html#logstash-config-field-references[Field References]")
end
content = content.gsub('[id="plugins-', '[id="{version}-plugins-')
.gsub("<<plugins-{type}s-common-options>>", "<<{version}-plugins-{type}s-{plugin}-common-options>>")
.gsub("<<plugins-{type}-{plugin}", "<<plugins-{type}s-{plugin}")
.gsub("<<plugins-{type}s-{plugin}", "<<{version}-plugins-{type}s-{plugin}")
.gsub("<<plugins-#{type}s-#{name}", "<<{version}-plugins-#{type}s-#{name}")
.gsub("[[dlq-policy]]", '[id="{version}-dlq-policy"]')
.gsub("<<dlq-policy>>", '<<{version}-dlq-policy>>')
.gsub("[Kafka Input Plugin @9.1.0](https://github.com/logstash-plugins/logstash-input-rabbitmq/blob/v9.1.0/CHANGELOG.md)", "[Kafka Input Plugin @9.1.0](https://github.com/logstash-plugins/logstash-input-kafka/blob/v9.1.0/CHANGELOG.md)")
.gsub("[Kafka Output Plugin @8.1.0](https://github.com/logstash-plugins/logstash-output-rabbitmq/blob/v8.1.0/CHANGELOG.md)", "[Kafka Output Plugin @8.1.0](https://github.com/logstash-plugins/logstash-output-kafka/blob/v8.1.0/CHANGELOG.md)")
if repair?
content.gsub!(/<<plugins-.+?>>/) do |link|
match = link.match(/<<plugins-(?<link_type>\w+)-(?<link_name>\w+)(?:,(?<link_text>.+?))?>>/)
if match.nil?
link
else
if match[:link_type] == "#{type}s" && match[:link_name] == name
link
else
if match[:link_text].nil?
"{logstash-ref}/plugins-#{match[:link_type]}-#{match[:link_name]}.html[#{match[:link_name]} #{match[:link_type][0...-1]} plugin]"
else
"{logstash-ref}/plugins-#{match[:link_type]}-#{match[:link_name]}.html[#{match[:link_text]}]"
end
end
end
end
match = content.match(/\[id="{version}-plugins-{type}s-{plugin}-common-options"\]/)
if match.nil? && type != "codec"
content = content.sub("\ninclude::{include_path}/{type}.asciidoc[]",
"[id=\"{version}-plugins-{type}s-{plugin}-common-options\"]\ninclude::{include_path}/{type}.asciidoc[]")
end
if type == "codec"
content = content.sub("This plugin supports the following configuration options plus the <<{version}-plugins-{type}s-{plugin}-common-options>> described later.\n", "")
content = content.sub("Also see <<{version}-plugins-{type}s-{plugin}-common-options>> for a list of options supported by all\ncodec plugins.\n", "")
content = content.sub("\n[id=\"{version}-plugins-{type}s-{plugin}-common-options\"]\ninclude::{include_path}/{type}.asciidoc[]", "")
content = content.sub("\ninclude::{include_path}/{type}.asciidoc[]", "")
end
end
write_stack_versions(content, type)
end