Commit graph

389 commits

Author SHA1 Message Date
Lars Ingebrigtsen
510da73b4a Fix problems with not rendering shr tables with rowspan
* lisp/net/shr.el (shr-max-columns): When rowspans were in effect,
columns would go missing from subsequent lines (bug#42194).
2020-07-17 03:13:05 +02:00
Basil L. Contovounesios
3dd6b23cdf Propertize all shr fragment IDs as shr-target-id
* lisp/net/shr.el (shr-target-id): Add docstring.
(shr-descend, shr-tag-a): Display dummy anchor characters as the
empty string.  Give all relevant 'id' or 'name' fragment identifier
attributes the shr-target-id text property.  This ensures that
cached content, such as tables, retains the property across
renders.  (Bug#40532)

* lisp/net/eww.el: (eww-display-html): Adapt shr-target-id property
search accordingly.
2020-06-18 16:16:49 +01:00
Basil L. Contovounesios
3a7894ecd1 Improve shr/eww handling of mailto URLs
* lisp/net/eww.el (eww): Use function-put in place of put, as
recommended in "(elisp) Symbol Plists".
(eww-follow-link):
* lisp/net/shr.el (shr-browse-url): Rather than call browse-url-mail
directly, call browse-url which respects the user options
browse-url-handlers and browse-url-mailto-function.  (Bug#41133)
(shr--current-link-region): Return nil if there is no link at point.
(shr--blink-link): Adapt accordingly.
(shr-fill-line, shr-indent, shr-table-body): Refactor to avoid some
unnecessary allocations.
* etc/NEWS: Announce that eww-follow-link and shr-browse-url support
custom URL handlers.
2020-05-22 16:28:20 +01:00
Lars Ingebrigtsen
17691ad2d3 shr comment typo fix
* lisp/net/shr.el (shr-parse-base): Comment typo fix.
2020-02-20 15:15:07 +01:00
Kévin Le Gouguec
b7d5a64f40 Introduce face for <code> elements in shr
* lisp/net/shr.el (shr-tag-code): Don't use the `default' font,
because it has properties that will override surrounding elements
(like <a...>) (bug#39504).
2020-02-20 14:30:54 +01:00
Lars Ingebrigtsen
d9385acac2 Make links in shr use separate mouse highlight regions
* lisp/net/shr.el (shr-urlify): Make adjacent links have separate
mouse hightlights (bug#39115).
2020-01-24 16:26:34 +01:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Robert Pluim
a9fe6dfa90 Fix problem with emacs -nw / eww / svg
* lisp/net/shr.el (shr-parse-image-data): Don't bug out on
non-visual Emacs versions on SVG images (bug#38507).
2019-12-24 17:21:06 +01:00
Lars Ingebrigtsen
0956a65e6f Make shr scale images on all frames
* lisp/net/shr.el (shr-rescale-image): Rescale images even if the
window isn't on the current frame.
2019-10-29 13:56:49 +01:00
Lars Ingebrigtsen
e4a4aa3057 Don't have shr bug out if svg support isn't available
* lisp/net/shr.el (shr-put-image): Don't bug out if SVG support
isn't available.
2019-10-19 10:23:19 +02:00
Juri Linkov
d24a197790 Use tabs in EWW (bug#37592)
* lisp/net/eww.el (eww-open-in-new-buffer): Call tab-new when tab-bar-mode
is enabled.
(eww-browse-url): Add docstring.  Call tab-new when tab-bar-mode
is enabled.

* lisp/net/shr.el (shr-map): Bind [C-down-mouse-1] to
shr-mouse-browse-url-new-window.
(shr-mouse-browse-url-new-window): New command.
(shr-browse-url): Add optional arg new-window.

* doc/misc/eww.texi (Basics): Mention opening tabs on M-RET.
2019-10-07 00:08:10 +03:00
Lars Ingebrigtsen
cbe3f5f720 Touch up previous shr-dom-to-xml encoding change
* lisp/net/shr.el (shr-dom-to-xml): Include an XML declaration if
we're encoding the data.
(shr-parse-image-data): Add comment about why encoding is necessary.
2019-10-03 16:15:22 +02:00
Lars Ingebrigtsen
0b5fe611e9 Fix up previous SVG-multibyte fix
* lisp/net/shr.el (shr-dom-to-xml): For SVG images, take an
optional charset parameter to return unibyte data.
(shr-parse-image-data): Use it.
(shr-tag-svg): Ditto.
(svg--wrap-svg): Revert previous kludge.
2019-10-03 16:15:22 +02:00
Lars Ingebrigtsen
25f45d710e Avoid bugging out on multibyte SVG data in shr
* lisp/net/shr.el (svg--wrap-svg): Ensure that the SVG data is
unibyte.
2019-10-01 21:51:23 +02:00
Lars Ingebrigtsen
542b78edde Fix rendering of degenerate tables some more in shr.el
* lisp/net/shr.el (shr--fix-tbody): New function (bug#31665).
(shr--fix-table): Use it to fix the
<table><tbody>foo</tbody></table> case.
2019-09-30 07:27:46 +02:00
Lars Ingebrigtsen
9f9dca57c6 shr table fix refactoring
* lisp/net/shr.el (shr--fix-table): Refactor out into own function
from...
(shr-tag-table): ... this function.
2019-09-30 07:17:12 +02:00
Lars Ingebrigtsen
7823dcf2fb Slight shr-put-image clean up
* lisp/net/shr.el (shr-put-image): Use image-multi-frame-p
directly, and remove outdated comments (image-multi-frame-p
returns the delay).
2019-09-24 19:38:21 +02:00
Lars Ingebrigtsen
ea5c79f657 Allow controlling when to send cookies when retrieving images in shr
* lisp/net/shr.el (shr--use-cookies-p): New function.
(shr-tag-img): Use it.
(shr-cookie-policy): New variable.
(shr-save-contents): Use cookies.

* doc/misc/eww.texi (Advanced): Document it.
2019-09-24 17:48:41 +02:00
Lars Ingebrigtsen
bdc222b268 Tweak how much <sup>/<sub> raises/lowers text in shr
* lisp/net/shr.el (shr-tag-sup, shr-tag-sub): Raising by 0.5 gives
very ugly displays.  0.2 seems sufficient for legibility.
2019-09-23 16:05:16 +02:00
Lars Ingebrigtsen
7156b0efc7 Minor svg wrap tweak
* lisp/net/shr.el (svg--wrap-svg): Add the size to the wrapper to
avoid having the SVG images shrink (bug#37159).
2019-09-19 16:07:58 +02:00
Lars Ingebrigtsen
2d8c8950b9 Further fix-ups for SVG wrapping in shr
* lisp/net/shr.el (svg--wrap-svg): Add the size to the wrapper to
avoid having the SVG images shrink (bug#37159).
2019-09-19 15:58:34 +02:00
Juanma Barranquero
79a01866a0 lisp/*.el, src/*.c: Fix typos in docstrings
* lisp/apropos.el (apropos-do-all):
* lisp/auth-source-pass.el (auth-source-pass--select-from-entries):
* lisp/auth-source.el (auth-source-user-or-password):
* lisp/calc/calc-forms.el (math-tzone-names):
* lisp/calendar/diary-lib.el (diary-face-attrs)
(diary-mark-entries-1):
* lisp/cedet/cedet-files.el (cedet-files-list-recursively):
* lisp/cedet/ede.el (ede-constructing, ede-deep-rescan):
* lisp/cedet/ede/cpp-root.el (ede-cpp-root-header-file-p):
* lisp/cedet/ede/proj.el (ede-proj-target-makefile):
* lisp/cedet/inversion.el (inversion-check-version)
(inversion-test):
* lisp/cedet/mode-local.el (mode-local-map-file-buffers):
* lisp/cedet/semantic/complete.el (semantic-displayer-ghost):
* lisp/cedet/semantic/db-find.el (semanticdb-find-translate-path-default):
* lisp/cedet/semantic/db.el (semanticdb-table)
(semanticdb-search-system-databases):
* lisp/cedet/semantic/imenu.el (semantic-imenu-index-directory):
* lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map):
* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-use-headers-flag):
* lisp/cedet/semantic/lex.el (semantic-lex-make-keyword-table)
(semantic-lex-make-type-table, semantic-lex-debug-analyzers):
* lisp/cedet/semantic/tag-ls.el (semantic-tag-abstract-p)
(semantic-tag-leaf-p, semantic-tag-static-p)
(semantic-tag-prototype-p):
* lisp/dnd.el (dnd-open-remote-file-function, dnd-open-local-file):
* lisp/emacs-lisp/eieio-opt.el (eieio-build-class-alist)
(eieio-read-class, eieio-read-subclass):
* lisp/emacs-lisp/generator.el (cps--replace-variable-references)
(cps--handle-loop-for):
* lisp/erc/erc-dcc.el (erc-dcc-list, erc-dcc-member, erc-dcc-server)
(erc-dcc-auto-mask-p, erc-dcc-get-file, erc-dcc-chat-accept):
* lisp/eshell/em-pred.el (eshell-pred-file-type):
* lisp/faces.el (defined-colors-with-face-attributes):
* lisp/font-core.el (font-lock-mode):
* lisp/frame.el (frame-restack):
* lisp/net/shr.el (shr-image-animate):
* lisp/org/org-agenda.el (org-agenda-change-all-lines)
(org-agenda-today-p):
* lisp/org/org-id.el (org-id-get):
* lisp/org/org.el (org-highlight-latex-and-related)
(org--valid-property-p):
* lisp/org/ox-beamer.el (org-beamer--get-label):
* lisp/org/ox-latex.el (org-latex--caption-above-p):
* lisp/org/ox-odt.el (org-odt--copy-image-file)
(org-odt--copy-formula-file):
* lisp/org/ox.el (org-export-with-timestamps):
* lisp/progmodes/verilog-mode.el (verilog-indent-declaration-macros):
* lisp/ses.el (ses-file-format-extend-parameter-list):
* lisp/term.el (ansi-term):
* lisp/textmodes/bibtex.el (bibtex-no-opt-remove-re)
(bibtex-beginning-of-first-entry, bibtex-autokey-get-title)
(bibtex-read-key, bibtex-initialize):
* lisp/textmodes/flyspell.el (flyspell-word):
* lisp/view.el (view-mode-exit):
* src/composite.c:
* src/floatfns.c (Fisnan): Fix typos in docstrings.
2019-09-19 04:32:25 +02:00
Lars Ingebrigtsen
5a0ab88cc9 Add default foreground colours to SVG images
* lisp/net/shr.el (svg--wrap-svg): Add a default foreground colour
to SVG images (bug#37159).  This helps with images like the ones
in https://en.wikipedia.org/wiki/Banach_fixed-point_theorem that
specify no foreground or background colours.
(shr-parse-image-data): Use it.
2019-09-14 16:48:21 +02:00
Lars Ingebrigtsen
d87e9a59cd Tweak shr background colour handling
* lisp/net/shr.el (shr-fill-line): Extend the background to the
end of the line when folding lines.
2019-08-29 09:19:19 +02:00
Lars Ingebrigtsen
6b68f92166 Remove debugging from previous shr.el patch 2019-08-23 09:59:09 +02:00
Lars Ingebrigtsen
aae9ac275c Avoid an infloop in shr when filling text with :align-to properties
* lisp/net/shr.el (shr-fill-line): Only join together URL buttons
if there are any URL buttons.
2019-08-23 08:51:35 +02:00
Lars Ingebrigtsen
e619a6b338 Mark shr buttons as button.el buffers
* lisp/net/shr.el (shr-urlify): Mark buttons as button.el buffers
for easier reuse in buttonified buffers.
2019-07-30 15:23:22 +02:00
Lars Ingebrigtsen
d69e1d7056 Rename the new `browse-url-external-browser' variable
* lisp/net/shr.el (shr-external-browser, shr-browse-url):
* lisp/net/eww.el (eww-browse-with-external-browser)
(eww-follow-link):
* lisp/net/browse-url.el
(browse-url-secondary-browser-function)
(browse-url-button-open):
* lisp/gnus/gnus-sum.el (gnus-summary-browse-url): Rename from
`browse-url-external-browser' to
`browse-url-secondary-browser-function'.
2019-07-29 00:07:34 +02:00
Lars Ingebrigtsen
a32e1feb43 Enable browse-url to buttonize buffers
This patch also moves the internal/external browser logic from
shr to browse-url, where it belongs more naturally.

* doc/misc/eww.texi (Basics): Adjust to browse-url-external-browser.

* doc/misc/gnus.texi (Article Commands): Ditto.

* lisp/gnus/gnus-art.el (gnus-button-url-regexp): Default to
`browse-url-button-regexp', which has taken over the definition
previously enjoyed by this variable.

* lisp/gnus/gnus-sum.el (gnus-summary-browse-url): Adjust usage.

* lisp/net/browse-url.el (browse-url--browser-defcustom-type): New
internal variable...
(browse-url-browser-function, browse-url-external-browser): Used
by these two; the latter of which is a new variable.
(browse-url-botton-regexp): New variable.
(browse-url-button-map): New keymap.
(browse-url-button): New face.
(browse-url-add-buttons): New function to add clickable browse-url
buttons to almost any buffer.
(browse-url-button-open): New command.
(browse-url-button-copy): New command.

* lisp/net/eww.el (eww-browse-with-external-browser)
(eww-follow-link): Adjust usage.

* lisp/net/shr.el (shr-external-browser): Make an obsolete alias
of `browse-url-external-browser'.
(shr-browse-url): Adjust usage.
2019-07-28 15:55:37 +02:00
Lars Ingebrigtsen
46301fc256 Tweak the sizing of the shr placeholder images on HiDPI screens
* lisp/net/shr.el (shr-make-placeholder-image): We have already
computed the size of the placeholder including the scale, so force
the automatic scale to 1.  This will make the placeholder the
correct size on HiDPI screen.
2019-07-25 20:44:07 +02:00
Lars Ingebrigtsen
8ebcc7b9d4 Tweak background colour handling in shr
* lisp/net/shr.el (shr-fill-line): Keep the background colour on
the newline and the indentation.
2019-07-14 14:45:21 +02:00
Nick Drozd
bda8a57141 Handle 'abbr' and 'acronym' tags in shr.el
* lisp/net/shr.el (shr-tag-abbr, shr-tag-acronym): New functions
handling 'abbr' and 'acronym' tags, respectively.
* etc/NEWS: Announce change in shr behavior (bug#36475).
2019-07-07 13:57:25 +02:00
Basil L. Contovounesios
4a754df885 ; * lisp/net/shr.el (shr-selected-link): Doc fix. 2019-07-04 19:22:59 +01:00
Nick Drozd
c4bfb5dfab Handle 'code' tag in shr.el
* etc/NEWS: Announce change in shr behavior (bug#36247).
* lisp/net/shr.el: Add 'code' tag handling.
2019-06-23 19:07:43 +02:00
Lars Ingebrigtsen
2d71e68428 Restore image scaling support when there's no native image scaling
* lisp/net/shr.el (shr--image-type): New function.
(shr-rescale-image): Use it to allow image scaling on Emacsen with
ImageMagick support that does not have native image scaling support.
2019-06-12 19:00:43 +02:00
Lars Ingebrigtsen
bc0adf112d Make shr-rescale-image respect get-buffer-window again
* lisp/net/shr.el (shr-rescale-image): Partially revert previous
change -- ressurrect the check for `get-buffer-window'.
2019-05-16 13:38:11 +02:00
Lars Ingebrigtsen
e3fbe04cbc Make image scaling work without imagemagick support in eww
* lisp/net/shr.el (shr-rescale-image): Emacs has native image
scaling now, so images can be rescaled without imagemagick
support.
2019-05-15 02:53:56 +02:00
Lars Ingebrigtsen
3de3452014 Add a comment about the previous shr change 2019-05-13 15:10:33 -04:00
Lars Ingebrigtsen
648a52ae69 Fix problems in shr when indenting tables
* lisp/net/shr.el (shr-mark-fill, shr-insert-table): Fix problems
when block-quoting/<li>-ing a table -- the indentation/prefix was
inserted twice (bug#32277).
2019-05-13 15:04:46 -04:00
Nicholas Drozd
8282c34f0f Handle HTML 'ol' start attribute in shr.el
* lisp/net/shr.el (shr-tag-ol): Don't automatically assume
1-indexing for all ordered lists, use <ol> if given.

* etc/NEWS: Announce change in shr behavior.

* test/data/shr/ol.html:
* test/data/shr/ol.txt: New test data files.
2019-02-22 09:52:57 +02:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Glenn Morris
6aa93b45af Merge from origin/emacs-26
1908173 (origin/emacs-26) Fix Bug#32828
7f5086d * lisp/net/shr.el (shr-copy-url): Fix docstring.
d309994 Fix typos in documentation
25cdd65 ; Spellcheck two more documentation strings
c8bda05 ; * lisp/simple.el (save-interprogram-paste-before-kill): Fix...
dc7fdee * doc/emacs/kmacro.texi (Basic Keyboard Macro): Mention old b...
17766a1 Improve docs of functions/variables related to 'display-buffer'
a363931 * lisp/mouse.el (tear-off-window): Fix non-mouse use (bug#32799)
8b8a4c0 Improve documentation of directory-local variables
c9c9756 Don't use obsolete variable 'save-place' in documentation
ca208e8 Use save-place-mode instead of save-place
2018-09-28 07:54:24 -07:00
Noam Postavsky
7f5086da05 * lisp/net/shr.el (shr-copy-url): Fix docstring. 2018-09-27 19:37:25 -04:00
Noam Postavsky
0250d22eeb shr: Allow skipping tags with aria-hidden (Bug#32348)
* lisp/net/shr.el (shr-discard-aria-hidden): New option.
(shr-descend): Suppress aria-hidden=true tags if it's set.
* doc/misc/eww.texi (Advanced): Document shr-discard-aria-hidden.
* etc/NEWS: Announce it.
2018-08-27 19:16:47 -04:00
Lars Ingebrigtsen
94d60f59fc Don't have shr bug out on degenerate <img> tags
* lisp/net/shr.el (shr-tag-img): Protect against contructs like
<img src=" ">.
2018-06-11 20:38:53 +02:00
Basil L. Contovounesios
f10fa789ca Set :version of shr faces
* lisp/net/shr.el (shr-strike-through, shr-link, shr-selected-link):
Set :version tag (bug#31200).
2018-04-17 21:46:26 +02:00
Lars Ingebrigtsen
d742d4ca2e shr doc string fix
* lisp/net/shr.el (shr-strike-through, shr-link)
(shr-selected-link): Doc string fix.
2018-04-17 21:43:34 +02:00
Basil L. Contovounesios
3dfec182d2 Modernise face specs and set version tags in eww/shr
* lisp/net/shr.el (shr-strike-through, shr-link, shr-selected-link):
Set :version tag (bug#31200).

* lisp/net/eww.el (eww-form-text, eww-form-textarea):
* lisp/net/shr.el (shr-strike-through, shr-link, shr-selected-link):
Use (DISPLAY . PLIST) face spec syntax as recommended in
'(elisp) Defining Faces'.
2018-04-17 21:42:04 +02:00
Lars Ingebrigtsen
d12800303f Tweak shr window width computation
* lisp/net/shr.el (shr-insert-document): The computation of the
window width is apparently one pixel too wide for the shr line
folding algorithm (bug#31196).
2018-04-17 20:34:12 +02:00