Module: Slamdown::Conversion::Policy
- Defined in:
- lib/slamdown/conversion/policy.rb
Overview
Resolves caller policy over Slamdown's default semantic and retention policy while preserving where each decision originated.
Defined Under Namespace
Classes: Decision, MatchDecision, Resolver
Constant Summary collapse
- CONVERTER_NAMES =
([ "p", "blockquote", "ol", "ul", "li", "dl", "dt", "dd", "details", "summary", "hr", "br", "code", "kbd", "pre", "samp", "tt", "var", "a", "img", "em", "i", "strong", "b", "s", "strike", "table", "thead", "tbody", "tfoot", "tr", "td", "th", "caption", "col", "colgroup", "div", "span" ] + (1..6).map { |level| "h#{level}" }).freeze
- PRESERVED_NAMES =
%w[abbr cite del ins mark sub sup u].freeze
- DEFAULT_ELEMENTS =
begin elements = {} CONVERTER_NAMES.each { |name| elements[name] = {:action => :convert} } PRESERVED_NAMES.each { |name| elements[name] = {:action => :preserve} } %w[audio time video].each { |name| elements[name] = {:action => :inline} } elements["a"][:attributes] = {"href" => :preserve} elements["img"][:attributes] = {"src" => :preserve, "alt" => :preserve} elements["ol"][:attributes] = {"start" => :preserve} elements["abbr"][:attributes] = {"title" => :preserve} %w[td th].each { |name| elements[name][:attributes] = {"colspan" => :preserve, "rowspan" => :preserve, "scope" => :preserve} } %w[col colgroup].each { |name| elements[name][:attributes] = {"span" => :preserve} } elements[:any] = {:attributes => {:any => :drop}} Immutable.copy(elements) end