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

Re: It's <table BORDER="1"> for me, forever



j> (setq w3m-use-filter t)
j> (eval-after-load "w3m-filter"
j>   '(nconc w3m-filter-rules
j> 	  '((".*" w3m-filter-tables-always-border))))
j> (defun w3m-filter-tables-always-border (url)
How can I improve
j>   (w3m-filter-replace-regexp url "<table" "<table border=\"1\""))
so that it won't affect tables that explicitly say their borders
already? Can I do something like these perl expressions in emacs?

$ perl -lwe '$_=q|<table border="0">|;s/<table(?![^>]+border[^>]+)/$& border="1"/i;print'
<table border="0">
$ perl -lwe '$_=q|<table border="2">|;s/<table(?![^>]+border[^>]+)/$& border="1"/i;print'
<table border="2">
$ perl -lwe '$_=q|<table|;            s/<table(?![^>]+border[^>]+)/$& border="1"/i;print'
<table border="1"
$ perl -lwe '$_=q|<table qq=xx>|;     s/<table(?![^>]+border[^>]+)/$& border="1"/i;print'
<table border="1" qq=xx>
$ perl -lwe '$_=q|<TABLE QQ=XX>|;     s/<table(?![^>]+border[^>]+)/$& border="1"/i;print'
<TABLE border="1" QQ=XX>
j> (However this also affects browsing text/plain.
e.g., even http://article.gmane.org/gmane.emacs.w3m/8325/raw when
browsed in emacs-w3m.