Sha256: 77287bcf903934c14876ba753e304a8a20e5ee098023a2796e5f95873d0cdbc5
Contents?: true
Size: 463 Bytes
Versions: 6
Compression:
Stored size: 463 Bytes
Contents
require 'csv' # A filter for displaying full names of acronyms Nanoc::Filter.define(:scholar_acronym) do |content, params| acronyms = CSV.parse(params[:acronyms].raw_content, :headers => true) transformed = content.dup acronyms.each do |row| transformed.gsub! %r{(?<=[^a-zA-Z0-9])#{row['abbreviation']}(?=[^a-zA-Z0-9])} do |match| %{<span class='abbreviation' title='#{row['full']}'>#{row['abbreviation']}</span>} end end transformed end
Version data entries
6 entries across 6 versions & 1 rubygems