Class: Kramdown::Element
Constant Summary collapse
- STUDLY_ATTR =
occasionally regenerate the studly attribute name list via script in data/studly.rb
%w( asciiAbbrev asciiFullname asciiInitials asciiName asciiSurname asciiValue blankLines derivedAnchor derivedContent derivedCounter derivedLink displayFormat docName expiresDate hangIndent hangText indexInclude iprExtract keepWithNext keepWithPrevious originalSrc prepTime quoteTitle quotedFrom removeInRFC sectionFormat seriesNo showOnFrontPage slugifiedName sortRefs submissionType symRefs tocDepth tocInclude )
- STUDLY_ATTR_MAP =
- TRUTHY =
Hash.new {|h, k| k}
Class Method Summary collapse
-
.attrmangle(k) ⇒ Object
explicit or automatic studlification note that explicit (including trailing “_”) opts out of automatic.
Instance Method Summary collapse
Class Method Details
.attrmangle(k) ⇒ Object
explicit or automatic studlification note that explicit (including trailing “_”) opts out of automatic
271 272 273 274 275 |
# File 'lib/kramdown-rfc2629.rb', line 271 def self.attrmangle(k) if (d = k.gsub(/_(.|$)/) { $1.upcase }) != k or d = STUDLY_ATTR_MAP[k] d end end |
Instance Method Details
#rfc2629_fix(opts) ⇒ Object
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/kramdown-rfc2629.rb', line 277 def rfc2629_fix(opts) if a = attr if anchor = a.delete('id') a['anchor'] = ::Kramdown::Parser::RFC2629Kramdown.idref_cleanup(anchor) end if anchor = a.delete('href') a['target'] = ::Kramdown::Parser::RFC2629Kramdown.idref_cleanup(anchor) end if lang = a.delete('lang-') a['xml:lang'] = lang end if av = a.delete('noabbrev') # pseudo attribute -> opts opts = opts.merge(noabbrev: TRUTHY[av]) # updated copy end attr.keys.each do |k| if d = self.class.attrmangle(k) a[d] = a.delete(k) end end end opts end |