some of these patterns are taken from SmartyPants…
Source Code
# File rdoc/markup/simple_markup/to_html.rb, line 190 def convert_string(item) CGI.escapeHTML(item). # convert -- to em-dash, (-- to en-dash) gsub(/---?/, '—'). #gsub(/--/, '–'). # convert ... to elipsis (and make sure .... becomes .<elipsis>) gsub(/\.\.\.\./, '.…').gsub(/\.\.\./, '…'). # convert single closing quote gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1’" }. gsub(%r{\'(?=\W|s\b)}) { "’" }. # convert single opening quote gsub(/'/, '‘'). # convert double closing quote gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}) { "#$1”" }. # convert double opening quote gsub(/'/, '“'). # convert copyright gsub(/\(c\)/, '©'). # convert and registered trademark gsub(/\(r\)/, '®') end
<code/>and<pre/>for code samples.