Commit graph

101 commits

Author SHA1 Message Date
Lars Magne Ingebrigtsen
bb13183c1b (shr-insert): Also remove soft hypens from non-folded text. 2015-03-01 12:21:43 +01:00
Lars Magne Ingebrigtsen
2294380798 * lisp/net/shr.el (shr-insert): Remove soft hyphens. 2015-03-01 12:17:52 +01:00
Lars Magne Ingebrigtsen
10a5a054ac * lisp/net/shr.el (shr-tag-li): Speed up rendering pages with lots of <ul> 2015-02-13 15:51:23 +11:00
Lars Magne Ingebrigtsen
6ebbeafc94 Fix <li><p> indentation in shr
(shr-ensure-paragraph): Don't insert a new paragraph as the first
item in a <li>.
2015-02-11 17:25:10 +11:00
Lars Magne Ingebrigtsen
e6929b0b8a (shr-fill-line): Preserve background colours when indenting/folding. 2015-02-11 15:34:07 +11:00
Lars Magne Ingebrigtsen
cbb6f138e6 shr space widths fixup
* lisp/net/shr.el (shr-insert): Make sure the space inserted has the
right font (for width).
2015-02-11 14:34:21 +11:00
Lars Magne Ingebrigtsen
f6d781c294 Fix up :align-to background colours
(shr-insert-table): Only copy the background, not underline and
the like.
(shr-face-background): New function.
2015-02-10 18:52:57 +11:00
Lars Magne Ingebrigtsen
d5111d525f shr cleanup and background color fix
(shr-table-widths): Off-by-one error in width computation.
(shr-expand-newlines): Remove dead code.
(shr-insert-table): Extend background colors to the end of the column.
2015-02-10 18:09:56 +11:00
Lars Magne Ingebrigtsen
50f64a3653 (shr-tag-hr): Compute the right length when using fonts. 2015-02-10 16:54:13 +11:00
Lars Magne Ingebrigtsen
6a319400cc Fix <h1> and <tt> rendering
(shr-tag-h1): Don't use variable-pitch fonts on fontless rendering.
(shr-tag-tt): New function.
2015-02-10 16:48:04 +11:00
Lars Magne Ingebrigtsen
656caef350 Allow using variable-width fonts in eww
* lisp/gnus/mm-decode.el (mm-shr): Only pass the fill column when not using
fonts, because limiting the width to what's appropriate for followups
doesn't really help when not using proportional fonts.

* lisp/net/shr.el (shr-use-fonts): New variable.
(shr-fill-text): Rename from "fold".
(shr-pixel-column, shr-pixel-region, shr-string-pixel-width): New
functions.
(shr-insert): Just insert, don't fill the text.  Filling is now
done afterwards per display unit.
(shr-fill-lines, shr-fill-line): New functions to fill text on a
per-unit base.
(shr-find-fill-point): Take a "beginning" parameter.
(shr-indent): Indent using the :width display parameter when using
fonts.
(shr-parse-style): Ignore "inherit" values, since we already do that.
(shr-tag-img): Remove the insertion states.
(shr-tag-blockquote): New-style filling.
(shr-tag-dd): Ditto.
(shr-tag-li): Ditto.
(shr-mark-fill): New function to mark lines that need filling.
(shr-tag-h1): Use a larger font.
(shr-tag-table-1): Get the natural and suggested widths in one
rendering.
(shr-tag-table): Create the "fixed" version of the table only once
so that we can cache data in the table.
(shr-insert-table): Get colspan calculations right by having
zero-width columns after colspan ones.
(shr-expand-alignments): New function to make :align-to specs work
right when rendered in one buffer and displayed in another one.
(shr-insert-table-ruler): Use :align-to to get the widths right.
(shr-make-table): Cache more.
(shr-make-table-1): Use the new <td> data layout.
(shr-pixel-buffer-width): New function.
(shr-render-td): Add a caching layer.
(shr-dom-max-natural-width): New function.
2015-02-10 16:29:05 +11:00
Lars Magne Ingebrigtsen
1a369fc7f1 (shr-make-table-1): Make colspan display more sensibly.
This makes display of stuff like

 ---------- ---- ---- ----
|R1C1      |R1C2|R1C2|R1C2|
 ---------- ---- ---- ----
|R2C1 and R2C2  |RC4      |
|in one         |         |
 ---------- ---- ---- ----

work
2015-01-26 17:04:55 +11:00
Lars Magne Ingebrigtsen
776705f49c (shr-make-table-1): Add comments. 2015-01-26 16:35:51 +11:00
Lars Magne Ingebrigtsen
dafb0ef852 * lisp/net/shr.el (shr-make-table-1): Fix colspan typo. 2015-01-26 16:14:17 +11:00
Lars Magne Ingebrigtsen
ec7605b4b1 (shr-urlify): Don't bother the user about invalidly-encoded display strings 2015-01-10 17:54:24 +01:00
Ivan Shmakov
fd6b7e5807 (shr-urlify): Decode URLs before using them as titles
Fixes: debbugs:19555

* lisp/net/shr.el (shr-urlify): Decode URLs before using them as titles.
2015-01-10 17:48:38 +01:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Lars Ingebrigtsen
c5a81fdb6f Make eww rendering default to `window-width' again
* lisp/gnus/mm-decode.el (mm-shr): Bind `shr-width' to `fill-column'
so that lines don't get overlong when responding.

* lisp/net/eww.el (eww-mode): Truncate overlong lines for prettier
display when resizing.

* lisp/net/shr.el (shr-width): Default to using the window width when
rendering.
2014-12-29 13:48:43 +01:00
Ivan Shmakov
53822badf4 shr table header/footer fixes
Fixes: debbugs:19444

* lisp/net/shr.el (shr-tag-table): Fix handling of tbody/header/footer
elements in tables.
2014-12-28 15:06:05 +01:00
Lars Magne Ingebrigtsen
872617ad73 * net/shr.el (shr-fold-text): Don't bug out on zero-length text. 2014-12-15 06:05:05 +01:00
Andreas Schwab
4ea175894a * net/shr.el (shr-next-link): Don't error out at eob. 2014-12-13 19:04:00 +01:00
Lars Magne Ingebrigtsen
05beff88de (shr-fold-text): Inhibit state from being altered. 2014-12-13 16:32:17 +01:00
Lars Magne Ingebrigtsen
76f9994d67 Make shr fold long title texts
* net/shr.el (shr-fold-text): New function.
(shr-show-alt-text, shr-urlify, shr-tag-img): Use it to fold long
alt/title texts.
2014-12-13 16:23:40 +01:00
Lars Magne Ingebrigtsen
ef8892db3c (shr-tag-object): Don't bug out on text elements in <object> 2014-12-10 05:00:32 +01:00
Lars Magne Ingebrigtsen
c3ea511964 Make inline SVGs work in shr again
* net/shr.el (shr-dom-print): Don't print comments.
(shr-tag-svg): Give inline SVG images the right type.
2014-12-09 05:18:12 +01:00
Stefan Monnier
be307485f7 * lisp: Prefer inlinable functions to macros.
* lisp/fringe.el (fringe-bitmap-p): Make it a plain function.

* lisp/tooltip.el (tooltip-region-active-p): Remove.

* lisp/net/shr.el (shr-char-breakable-p, shr-char-kinsoku-bol-p)
(shr-char-kinsoku-eol-p, shr-char-nospace-p): Use define-inline.

* lisp/url/url-future.el (url-future-done-p, url-future-completed-p)
(url-future-errored-p, url-future-cancelled-p):
* lisp/url/url-dav.el (url-dav-http-success-p): Use define-inline.

* lisp/vc/ediff-init.el (ediff-odd-p): Remove.
(ediff-background-face): Use cl-oddp instead.
(ediff-buffer-live-p): Make it a defsubst.
2014-12-05 12:49:53 -05:00
Lars Magne Ingebrigtsen
64755ed3ad * net/shr.el (shr--extract-best-source): Ignore non-text children. 2014-12-04 14:42:57 +01:00
Lars Magne Ingebrigtsen
6d80f26a9a shr-dom-print dom.el changes
* net/shr.el (shr-dom-print): Fix up `shr-dom-print' after the
dom.el changes.
2014-12-01 20:18:15 +01:00
Lars Magne Ingebrigtsen
803df8492d * net/shr.el (shr-make-table-1): dom.el changes for table rendering. 2014-11-27 00:03:09 +01:00
Lars Magne Ingebrigtsen
d9ba097fe4 Use the new dom.el accessors in shr and eww
* net/shr.el: Ditto.

* net/eww.el: Use the new dom.el accessors throughout.
2014-11-26 19:42:29 +01:00
Lars Magne Ingebrigtsen
cbd90e1d30 Move eww and shr to customization group `web'
* net/eww.el (eww): Ditto.

* net/shr.el (shr): Move to the new defgroup `web'.
2014-11-16 21:29:40 +01:00
Lars Magne Ingebrigtsen
14b1c9d82d * net/shr.el (shr-inhibit-images): Add a doc string. 2014-11-13 23:06:05 +01:00
Lars Magne Ingebrigtsen
f7a192cb5c Make shr stop descending into the dom before `max-specpdl-size' stops us
* net/shr.el (shr-descend): Don't descend further than
`max-specpdl-size' allows (bug#16587).
(shr-depth): New variable.
(shr-warning): New variable.
2014-11-13 22:11:51 +01:00
Ivan Shmakov
fdae50c73f shr URL expansion fixes
Fixes: debbugs:17958

* net/shr.el (shr-parse-base): Handle <base href=""> correctly.
(shr-expand-url): Expand absolute URLs correctly (bug#17958).
2014-11-13 19:41:20 +01:00
Lars Magne Ingebrigtsen
cbf8ea6f7f Display SVG images in external <object> files
Fixes: debbugs:16244

* net/eww.el (eww-form-file): Fix version number.

* net/shr.el (shr-parse-image-data): Remove blocked bits from
external SVG images.
(shr-tag-object): Display images in <object> forms.
(shr-tag-table): Also insert <objects> after the tables.
2014-11-13 17:16:51 +01:00
Lars Magne Ingebrigtsen
704da6eeb4 shr typo fix from recent check-in
* net/shr.el (shr-retransform-dom): Typo fix.
2014-11-03 23:59:07 +01:00
Lars Magne Ingebrigtsen
1ca31e8cbd Minor readability parsing issues with SVC images
* net/eww.el (eww-score-readability): Parse SVC images correctly.

* net/shr.el: Ditto.
2014-11-03 23:54:16 +01:00
Lars Magne Ingebrigtsen
772a965c5f Minor `shr-retransform-dom' fix
* net/shr.el (shr-retransform-dom): Don't ignore elements that
have no children like <br />.
2014-11-03 23:38:26 +01:00
Lars Magne Ingebrigtsen
01af3a585d * net/shr.el (shr-retransform-dom): Allow several text sub-nodes. 2014-11-03 02:02:37 +01:00
Lars Magne Ingebrigtsen
2e8259b044 Add a new, somewhat experimental "readability" command to eww
* net/eww.el (eww-readable): New command and keystroke.

* net/shr.el (shr-retransform-dom): New function.
2014-11-03 01:01:20 +01:00
Ivan Kanis
212b4d631b Allow users to specify `shr-width'
* net/shr.el, net/eww.el: Don't override `shr-width', but
introduce a new variable `shr-internal-width'.  This allows users
to specify a width themselves.
2014-09-18 21:18:34 +02:00
Glenn Morris
6d26235315 Merge from emacs-24; up to 2014-07-02T00:57:53Z!juri@jurta.org 2014-08-27 18:59:29 -07:00
Glenn Morris
bd3be308f7 shr.el: Comment. 2014-08-26 22:06:20 -07:00
João Távora
e7b37ae4df * net/shr.el (shr-expand-url): Plain expand-file-name is not enough;
use url-expand-file-name.

Fixes: debbugs:18310
2014-08-26 22:04:47 -07:00
Lars Magne Ingebrigtsen
42ee94e0f4 Fix typo in last shr.el check-in 2014-08-25 18:04:39 +02:00
Lars Magne Ingebrigtsen
0a4aa6bd20 shr.el: Encode copied URLs
* net/shr.el (shr-copy-url): Encode copied URL to avoid getting
URLs containing spaces and the like.
2014-08-25 17:59:38 +02:00
Lars Magne Ingebrigtsen
488df60acc * lisp/net/shr.el (shr-copy-url): Also copy the image URL.
* lisp/net/shr.el (shr-copy-url): Also copy the image URL.
2014-08-05 20:15:03 +02:00
João Távora
f596f897c6 Fix relative links to parent directories in shr
* lisp/net/shr.el (shr-expand-url): Use `expand-file-name' for relative
links. .

Fixes: debbugs:17217
2014-04-14 23:01:54 +01:00
Lars Ingebrigtsen
6952100dc3 (eww-textarea-map): [tab] doesn't work on tty.
Reported by Mario Lang.

* net/shr.el (shr-map): Ditto.
2014-03-05 19:44:58 +01:00
Glenn Morris
b70257b07e Tweak earlier shr.el change 2014-02-28 15:00:12 -05:00