Method: JsDuck::GuideAnchors.transform_id
- Defined in:
- lib/jsduck/guide_anchors.rb
.transform_id(id, guide_name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jsduck/guide_anchors.rb', line 24 def self.transform_id(id, guide_name) if id =~ /^#{guide_name}-section-/ id else # Escape the ID if it's not already escaped. This check is # needed to avoid re-escaping anchor-links created with # Markdown - these get auto-escaped by RDiscount. id = (id =~ /%[0-9A-F]{2}/) ? id : CGI::escape(id) "#{guide_name}-section-#{id}" end end |