diff options
author | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-08-19 15:01:21 +0300 |
---|---|---|
committer | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-08-19 15:01:21 +0300 |
commit | 320671e5cf3dd9eada39578e13f56d0bda28ceb6 (patch) | |
tree | 915bf68acacdfa9e1644147264190a530447029a /lib/gitlab | |
parent | 821415d35c31dbc4f8bd9ae45b9e317f18199fd1 (diff) |
Remove suffix from anchors during `internal_anchors` check
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/docs/link.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/docs/link.rb b/lib/gitlab/docs/link.rb index 23460f88..887ba102 100644 --- a/lib/gitlab/docs/link.rb +++ b/lib/gitlab/docs/link.rb @@ -1,6 +1,8 @@ module Gitlab module Docs class Link + PRODUCT_SUFFIX = /-(core|starter|premium|ultimate)(-only)?/.freeze + attr_reader :link, :href, :page def initialize(link, page) @@ -63,9 +65,11 @@ module Gitlab end def destination_anchor_not_found? - !destination_page.has_anchor?(anchor_name) + # TODO: Remove me when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39715 is merged + anchor_without_suffix = anchor_name.gsub(PRODUCT_SUFFIX, '') + + !destination_page.has_anchor?(anchor_without_suffix) end end end end - |