Sha256: 27ac889ed2c636b69cf864eb80e18a29eefdd63a1b84c50d8500dd2578d4b8df

Contents?: true

Size: 262 Bytes

Versions: 5

Compression:

Stored size: 262 Bytes

Contents

AutoHtml.add_filter(:gist).with({}) do |text, options|
  # E.g. https://gist.github.com/1710276
  regex = /https:\/\/gist\.github\.com\/(\d+)/
  text.gsub(regex) do
    gist_id = $1
    %{<script src="https://gist.github.com/#{gist_id}.js"></script>}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auto_html-1.5.1.1 lib/auto_html/filters/gist.rb
auto_html-1.6.0 lib/auto_html/filters/gist.rb
auto_html-1.5.3 lib/auto_html/filters/gist.rb
auto_html-1.5.2 lib/auto_html/filters/gist.rb
auto_html-1.5.1 lib/auto_html/filters/gist.rb