Sha256: 2bcbd85ad096b9c78584d5d07b83f39d920864e7758a7cbca5bf5a6226084d90

Contents?: true

Size: 495 Bytes

Versions: 22

Compression:

Stored size: 495 Bytes

Contents

module Garage
  module Docs
    module AnchorBuilding
      def preprocess(full_document)
        reset
        full_document
      end

      def postprocess(full_document)
        reset
        full_document
      end

      private

      def reset
        @anchors = Hash.new(0)
      end

      def to_anchor(text)
        unique_text = text + @anchors[text].to_s
        @anchors[text] += 1

        unique_text.gsub(/\s+/, '-').gsub(/<\/?[^>]*>/, '').downcase
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
the_garage-2.8.2 lib/garage/docs/anchor_building.rb
the_garage-2.8.1 lib/garage/docs/anchor_building.rb
the_garage-2.8.0 lib/garage/docs/anchor_building.rb
the_garage-2.7.0 lib/garage/docs/anchor_building.rb
the_garage-2.6.1 lib/garage/docs/anchor_building.rb
the_garage-2.6.0 lib/garage/docs/anchor_building.rb
the_garage-2.5.0 lib/garage/docs/anchor_building.rb
the_garage-2.4.4 lib/garage/docs/anchor_building.rb
the_garage-2.4.3 lib/garage/docs/anchor_building.rb
the_garage-2.4.2 lib/garage/docs/anchor_building.rb
the_garage-2.4.1 lib/garage/docs/anchor_building.rb
the_garage-2.4.0 lib/garage/docs/anchor_building.rb
the_garage-2.3.3 lib/garage/docs/anchor_building.rb
the_garage-2.3.2 lib/garage/docs/anchor_building.rb
the_garage-2.3.1 lib/garage/docs/anchor_building.rb
the_garage-2.3.0 lib/garage/docs/anchor_building.rb
the_garage-2.2.0 lib/garage/docs/anchor_building.rb
the_garage-2.1.0 lib/garage/docs/anchor_building.rb
the_garage-2.0.3 lib/garage/docs/anchor_building.rb
the_garage-2.0.2 lib/garage/docs/anchor_building.rb