Function: eww--parse-html-region

eww--parse-html-region is a byte-compiled function defined in eww.el.gz.

Signature

(eww--parse-html-region START END &optional CODING-SYSTEM)

Documentation

Parse the HTML between START and END, returning the DOM as an S-expression.

Use CODING-SYSTEM to decode the region; if nil, decode as UTF-8.

This replaces the region with the preprocessed HTML.

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww--parse-html-region (start end &optional coding-system)
  "Parse the HTML between START and END, returning the DOM as an S-expression.
Use CODING-SYSTEM to decode the region; if nil, decode as UTF-8.

This replaces the region with the preprocessed HTML."
  (setq coding-system (or coding-system 'utf-8))
  (with-restriction start end
    (unless (and (not enable-multibyte-characters)
		 (eq coding-system 'utf-8))
      (condition-case nil
          (decode-coding-region (point-min) (point-max) coding-system)
        (coding-system-error nil)))
    ;; Remove CRLF and replace NUL with � before parsing.
    (while (re-search-forward "\\(\r$\\)\\|\0" nil t)
      (replace-match (if (match-beginning 1) "" "�") t t))
    (eww--preprocess-html (point-min) (point-max))
    (libxml-parse-html-region (point-min) (point-max))))