Sha256: 6f3e56371e531099daa7a6cc2dd65315e27adbc5e0459578d9ab72f2dc613601
Contents?: true
Size: 442 Bytes
Versions: 5
Compression:
Stored size: 442 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| %{<abbr title='#{row['full']}'>#{row['abbreviation']}</abbr>} end end transformed end
Version data entries
5 entries across 5 versions & 1 rubygems