[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does anyone run Emacs/w3 ?

From: Pascal Bourguignon
Subject: Re: Does anyone run Emacs/w3 ?
Date: 28 Nov 2003 10:12:14 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Steven Woody <> writes:

> I'm running Emacs/w3.  My Emacs was set as black background, this make
> most pages look ugly.  Has any made a decent configuration for w3
> running in this situation?
> And, I found in w3, most pages do not wrap its long lines properly.  Is
> this a bug? How do I resolv it?

I'm  using this ugly  hook. It  started with  only removing  font size
tags, but as you can see, I added a number of ad-hoc pre-processing of
the html buffers.

A more general and stronger filter could be implemented in this hook.

Or you may use an online filter such as:

(add-hook 'w3-parse-hooks 'pjb-w3-remove-sizes)

(defun pjb-w3-remove-sizes ()
  ;; reseauvoltaire;shark tank;rigoler
  (goto-char (point-min))
  (when (re-search-forward "\\|newsletter de\\|CONTENT=\"Shark Tank\"\\|"; nil t)
    (goto-char (point-min))
    (while (re-search-forward "</?\\(center\\|table\\|tr\\|td\\|img\\|div 
align=\"center\"\\)[^>]*>" nil t)
      (replace-match "<p>"))
    ) ;;when
  ;; remove absolute width:
  (goto-char (point-min))
  (while (re-search-forward 
"\\(<[^>]*\\)\\<width=\\(['\"]*\\)[0-9][0-9]*\\2\\([^>]*>\\)" nil t)
    (replace-match "\\1\\3"))
  ;; remove absolute height:
  (goto-char (point-min))
  (while (re-search-forward 
"\\(<[^>]*\\)\\<height=\\(['\"]*\\)[0-9][0-9]*\\2\\([^>]*>\\)" nil t)
    (replace-match "\\1\\3"))
  ;; remove long lines of dots:
  (goto-char (point-min))
  (while (re-search-forward "\\.\\{40,\\}" nil t)
    (replace-match "<hr>" t t))
  ;; cut long space-less lines:
  (goto-char (point-min))
  (while (re-search-forward "\\([^<> \n\r]\\{60,\\}\\)" nil t)
    (replace-match (unsplit-string (cut-string (match-string 0) 20) " \n") t t))
  ;; remove <st1:xxx> and </st1:xxx> tags:
  (goto-char (point-min))
  (while (re-search-forward "\\(</?st1:[^>]*>\\)" nil t)
    (replace-match "" t t))
  ;; Text alternative instead of pictures.
  (goto-char (point-min))
  (while (re-search-forward "<IMG[^>]*\"\\[\\(XANALYS\\|Common Lisp HyperSpec 
(TM)\\)\\]\"[^>]*>" nil t)
    (replace-match "[X]"))
  (goto-char (point-min))
  (while (re-search-forward 
"<IMG[^>]*\"\\[\\(Previous\\|Up\\|Next\\)\\]\"[^>]*>" nil t)
    (replace-match "[\\1]"))
  ;; <hr>
  (goto-char (point-min))
  (while (re-search-forward "<hr>" nil t)
  ;; Convert all hN to h6.
  (goto-char (point-min))
  (while (re-search-forward "\\(</?h\\)\\([1-5]\\)\\([^>]*>\\)" nil t)
    (replace-match "\\16\\3"))
  ;; end
  (goto-char (point-min))
;;; (let ((w (buffer-string)))
;;;     (save-excursion
;;;     (find-file "/tmp/w")
;;;     (erase-buffer)
;;;     (insert w)
;;;     (save-buffer 0)
;;;     (kill-buffer (current-buffer))))

Living free in Alaska or in Siberia, a grizzli's life expectancy is 35 years,
but no more than 8 years in captivity. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]