all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23057: 25.0.92; shr wrongly adds two newlines to div element
@ 2016-03-18 21:10 Stephen Berman
  2016-03-18 22:18 ` Stephen Berman
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2016-03-18 21:10 UTC (permalink / raw)
  To: 23057

As a consequence of commit 9781dc4da35934839bf848b576829786962655b4
Author: Lars Ingebrigtsen <larsi@gnus.org>
Date:   Mon Feb 29 18:06:36 2016 +1100

    Make <div> in <li> not insert extra newlines
    
    * lisp/net/shr.el (shr-tag-div): Make <div> in <li> not insert
    extra newlines (bug#19587).

div elements that do not contain other block elements now get two
newlines added to them.  To reproduce, select the following bit of HTML
and apply shr-render-region to it:

<ul>
  <li>
    <div>
      <p >This is the first paragraph of a list item.
    </div>
    <p >This is the second paragraph of a list item.
  </li>
  <li>
    <div>This is the first paragraph of a list item.</div>
    <div>This is the second paragraph of a list item.</div>
  </li>
</ul>

This shows up e.g. in Gnus postings displayed as HTML (see
http://lists.gnu.org/archive/html/bug-gnu-emacs/2016-03/msg00817.html)
and in eww (look e.g. at this page in eww:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=9781dc4da35934839bf848b576829786962655b4).
The following patch fixes this display problem for me, but I'm not
familiar enough either with shr or with all the details of HTML block
elements to be sure this is a sufficient or even correct fix.


diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index e943132..d9dcda3 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -812,6 +812,9 @@ shr-ensure-paragraph
 						    (line-end-position))
 		       (line-end-position)))))
 	(delete-region (match-beginning 0) (match-end 0)))
+       ((eq (dom-tag dom) 'div)
+	;; <div> contains no block element; do nothing.
+	)
        (t
 	(insert "\n\n"))))))


In GNU Emacs 25.0.92.4 (x86_64-suse-linux-gnu, GTK+ Version 3.14.15)
 of 2016-03-18 built on rosalinde
Repository revision: ed909c049e845a22a7beb626ac98f139388005fa
Windowing system distributor 'The X.Org Foundation', version 11.0.11601000
System Description:	openSUSE 13.2 (Harlequin) (x86_64)

Configured using:
 'configure --with-xwidgets 'CFLAGS=-Og -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 XWIDGETS

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-20 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 21:10 bug#23057: 25.0.92; shr wrongly adds two newlines to div element Stephen Berman
2016-03-18 22:18 ` Stephen Berman
2016-03-19 12:59   ` Michael Heerdegen
2016-03-20 11:57   ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.