I've used conditionals to ensure that the version attributes are set for the Versioned Plugin Reference only.
Why? The Logstash Reference is stack versioned, and we don't want the VPR approximations to interfere by causing unintended consequences.
When tested and approved, these attribute settings need to be added for each plugin affected by versioning problems (output-elasticsearch, input-beats, etc.) Don't worry... I know the list. 😄
When the versioning work has been implemented and fully functional, the VPR will need some cleanup to remove past "band-aids" to versioning.
When the cleanup work is complete, I'll remove the attribute resets at the end of each source file.
Related to plugin versioning work in https://github.com/elastic/docs-tools/pull/70 and https://github.com/elastic/docs-tools/pull/73. The stack version attributes must be (calculated and) set on a per file basis, as the stack version will increment over time. I believe that this approach represents the right place to set those attributes.
Notes