Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2017-06-30 11:16:42 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2017-06-30 11:16:42 +0300
commita2c8b6ea4e285bd22e18c6bba251fd970b5c0fcb (patch)
tree06a2ade3ea57ff83a758dab07485e5fdd3245899 /lib
parent940f5662d21b5fc4beff5b85d5751e315c514c89 (diff)
Revert "Merge branch 'fix-anchor-links' into 'master'"
This reverts merge request !101
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers_.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/helpers_.rb b/lib/helpers_.rb
index e3310e31..e23e00da 100644
--- a/lib/helpers_.rb
+++ b/lib/helpers_.rb
@@ -13,10 +13,8 @@ class HTML < Redcarpet::Render::HTML
def header(text, header_level)
- # https://gitlab.com/gitlab-com/gitlab-docs/issues/84#note_24957099
- text = Nokogiri::HTML.parse(text).text
# https://github.com/cookpad/garage/blob/c817733e382c734eedba743e9103cd8a124f24eb/lib/garage/docs/anchor_building.rb#L24
- anchor = text.gsub(/\s+/, '-').downcase
+ anchor = text.gsub(/\s+/, '-').gsub(/<\/?[^>]*>/, '').downcase
# https://github.com/rails/rails/blob/e491b2c06329afb3c989261a2865d2a93c8b84b8/activesupport/lib/active_support/inflector/transliterate.rb#L86
anchor.gsub!(/[^a-z0-9\-_]+/i, '-')
anchor.squeeze!('-') # replace multiple dashes with one