Class: CodeRay::Scanners::HTML

Inherits:
Scanner
  • Object
show all
Defined in:
lib/coderay/scanners/html.rb

Overview

HTML Scanner

Alias: xhtml

See also: Scanners::XML

Direct Known Subclasses

XML

Constant Summary collapse

KINDS_NOT_LOC =
[
  :comment, :doctype, :preprocessor,
  :tag, :attribute_name, :operator,
  :attribute_value, :string,
  :plain, :entity, :error,
]
EVENT_ATTRIBUTES =

:nodoc:

%w(
  onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay
  oncanplaythrough onchange onclick oncontextmenu oncuechange ondblclick
  ondrag ondragdrop ondragend ondragenter ondragleave ondragover
  ondragstart ondrop ondurationchange onemptied onended onerror onfocus
  onformchange onforminput onhashchange oninput oninvalid onkeydown
  onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart
  onmessage onmousedown onmousemove onmouseout onmouseover onmouseup
  onmousewheel onmove onoffline ononline onpagehide onpageshow onpause
  onplay onplaying onpopstate onprogress onratechange onreadystatechange
  onredo onreset onresize onscroll onseeked onseeking onselect onshow
  onstalled onstorage onsubmit onsuspend ontimeupdate onundo onunload
  onvolumechange onwaiting
)
IN_ATTRIBUTE =
WordList::CaseIgnoring.new(nil).
add(EVENT_ATTRIBUTES, :script).
add(['style'], :style)
ATTR_NAME =

:nodoc:

/[\w.:-]+/
TAG_END =

:nodoc:

/\/?>/
HEX =

:nodoc:

/[0-9a-fA-F]/
ENTITY =
/
  &
  (?:
    \w+
  |
    \#
    (?:
      \d+
    |
      x#{HEX}+
    )
  )
  ;
/ox
PLAIN_STRING_CONTENT =

:nodoc:

{
  "'" => /[^&'>\n]+/,
  '"' => /[^&">\n]+/,
}

Constants inherited from Scanner

Scanner::DEFAULT_OPTIONS, Scanner::ScanError

Instance Attribute Summary

Attributes inherited from Scanner

#state

Attributes included from Plugin

#plugin_id

Instance Method Summary collapse

Methods inherited from Scanner

#binary_string, #column, #each, encoding, file_extension, #file_extension, #initialize, #lang, lang, #line, normalize, #string=, #tokenize, #tokens

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Constructor Details

This class inherits a constructor from CodeRay::Scanners::Scanner

Instance Method Details

#resetObject

:nodoc:



62
63
64
65
66
# File 'lib/coderay/scanners/html.rb', line 62

def reset
  super
  @state = :initial
  @plain_string_content = nil
end