From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 26 12:28:07 2014 Received: (at submit) by debbugs.gnu.org; 26 Dec 2014 17:28:07 +0000 Received: from localhost ([127.0.0.1]:58366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y4YgI-0007WJ-Oj for submit@debbugs.gnu.org; Fri, 26 Dec 2014 12:28:07 -0500 Received: from fely.am-1.org ([78.47.74.50]:46283) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y4YgF-0007W9-Qe for submit@debbugs.gnu.org; Fri, 26 Dec 2014 12:28:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=tlYiZ8gNx3K6pmDfWGd5bbcqaLBUDpcxbdXWqs7f4WE=; b=J1jYDlJ09DigiRn71/cKcJyxI24huwU1Py9U4/J1iZjwCMBKFjK+WasQkSW4eherxGrgiSF/p6RcCQVTD3tWpIlx28FncuPINFaDNnW80VjbVoTAydJ3kyaQ+cQ8Xb0aCiwj6oyZN2BOeevyJpkp7Cnyx1/6dQSbFSBPmxGPRR4=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y4YgE-0006PP-1O for submit@debbugs.gnu.org; Fri, 26 Dec 2014 17:28:02 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y4Yg6-0004fz-Fg for submit@debbugs.gnu.org; Sat, 27 Dec 2014 00:27:54 +0700 From: Ivan Shmakov To: submit@debbugs.gnu.org Subject: shr-tag-table: the value passed to shr-tag-table-1 is not a DOM Date: Fri, 26 Dec 2014 17:27:53 +0000 Message-ID: <87fvc2fhie.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs As of 36c43e95de5e (2014-12-18 16:44:11 +0000), shr-tag-table fails to pass a valid DOM value to shr-tag-table-1 when the table contains a thead, tfoot, or caption element (or any combination thereof.) Consider, e. g.: (with-temp-buffer (mapcar (lambda (table) (erase-buffer) (let ((r (shr-tag-table table))) (cons r (buffer-string)))) '((table nil (thead nil (tr nil (th nil "Foo") (th nil "Bar"))) (tbody nil (tr nil (th nil "Baz") (th nil "Qux")))) (table nil (thead nil (tr nil (th nil "Foo") (th nil "Bar"))) (tr nil (th nil "Baz") (th nil "Qux"))) (table nil (tr nil (th nil "Foo") (th nil "Bar")) (tfoot nil (tr nil (th nil "Baz") (th nil "Qux")))) (table nil (caption nil "Hello, world!") (tr nil (th nil "Foo") (th nil "Bar")) (tr nil (th nil "Baz") (th nil "Qux"))) (table nil (tr nil (th nil "Foo") (th nil "Bar")) (tr nil (th nil "Baz") (th nil "Qux")))))) ; =E2=86=92 ((nil . "") (nil . "") (nil . "") (nil . "") ; (nil . " Foo Bar \n Baz Qux \n")) The reasons to this are twofold. First of all, shr-tag-table generally assumes that the value of header and footer locals (and body, =E2=80=93 if at least one of header, footer is non-nil) are lists of elements, while they are in fact DOM values: 1440 (defun shr-tag-table (dom) 1441 (shr-ensure-paragraph) 1442 (let* ((caption (dom-child-by-tag dom 'caption)) 1443 (header (dom-child-by-tag dom 'thead)) 1444 (body (or (dom-child-by-tag dom 'tbody) dom)) 1445 (footer (dom-child-by-tag dom 'tfoot)) Suppose that (thead nil (tr nil (th nil "Foo") (th nil "Bar"))) gets assigned to =E2=80=98header=E2=80=99, for instance. Now, at a later point, =E2=80=98header=E2=80=99 is assumed to hold a list = of elements instead, which are put into a new tbody element: 1469 (if (=3D nbody nfooter) 1470 `((tr (td (table (tbody ,@header ,@body ,@footer))))) 1471 (nconc `((tr (td (table (tbody ,@header ,@body))))) 1472 (if (=3D nfooter 1) 1473 footer 1474 `((tr (td (table (tbody ,@footer)))))))) The second reason behind this problem is that the above backquote templates by no means lead to valid DOM values! For example, the last template above should instead read: `((tr nil (td nil (table nil (tbody nil ,@footer))))) Please consider the patch MIMEd. * lisp/net/shr.el (shr-tag-table): Ensure that shr-tag-table-1 gets passed a valid DOM value for tables containing a thead, tfoot, or caption. FWIW, applying the change makes the example above give a more sensible result: ((nil . " Foo Bar \n Baz Qux \n") (nil . " Foo Bar \n Baz Qux \n") (nil . " Foo Bar \n Baz Qux \n") (nil . " Hello, world! \n Foo Bar \n Baz Qux \n") (nil . " Foo Bar \n Baz Qux \n")) PS. I also took the liberty of rearranging a chain of =E2=80=98if=E2=80=99= forms into a cond. Not that it makes a big difference, though. --=20 FSF associate member #7257 np. Hope =E2=80=93 Apocalyptica =E2=80=A6 3= 013 B6A0 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1439,10 +1439,11 @@ defun shr-tag-table-1 (dom) (defun shr-tag-table (dom) (shr-ensure-paragraph) - (let* ((caption (dom-child-by-tag dom 'caption)) - (header (dom-child-by-tag dom 'thead)) - (body (or (dom-child-by-tag dom 'tbody) dom)) - (footer (dom-child-by-tag dom 'tfoot)) + (let* ((caption (dom-children (dom-child-by-tag dom 'caption))) + (header (dom-non-text-children (dom-child-by-tag dom 'thead))) + (body (dom-non-text-children (or (dom-child-by-tag dom 'tbody) + dom))) + (footer (dom-non-text-children (dom-child-by-tag dom 'tfoot))) (bgcolor (dom-attr dom 'bgcolor)) (start (point)) (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) @@ -1461,42 +1462,62 @@ defun shr-tag-table (dom) ;; It's a real table, so render it. (shr-tag-table-1 (nconc - (if caption `((tr (td ,@caption)))) - (if header - (if footer - ;; header + body + footer - (if (= nheader nbody) - (if (= nbody nfooter) - `((tr (td (table (tbody ,@header ,@body ,@footer))))) - (nconc `((tr (td (table (tbody ,@header ,@body))))) - (if (= nfooter 1) - footer - `((tr (td (table (tbody ,@footer)))))))) - (nconc `((tr (td (table (tbody ,@header))))) - (if (= nbody nfooter) - `((tr (td (table (tbody ,@body ,@footer))))) - (nconc `((tr (td (table (tbody ,@body))))) - (if (= nfooter 1) - footer - `((tr (td (table (tbody ,@footer)))))))))) - ;; header + body - (if (= nheader nbody) - `((tr (td (table (tbody ,@header ,@body))))) - (if (= nheader 1) - `(,@header (tr (td (table (tbody ,@body))))) - `((tr (td (table (tbody ,@header)))) - (tr (td (table (tbody ,@body)))))))) - (if footer - ;; body + footer - (if (= nbody nfooter) - `((tr (td (table (tbody ,@body ,@footer))))) - (nconc `((tr (td (table (tbody ,@body))))) - (if (= nfooter 1) - footer - `((tr (td (table (tbody ,@footer)))))))) - (if caption - `((tr (td (table (tbody ,@body))))) - body)))))) + (list 'table nil) + (if caption `((tr nil (td nil ,@caption)))) + (cond (header + (if footer + ;; header + body + footer + (if (= nheader nbody) + (if (= nbody nfooter) + `((tr nil (td nil (table nil + (tbody nil ,@header + ,@body ,@footer))))) + (nconc `((tr nil (td nil (table nil + (tbody nil ,@header + ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil (tbody + nil ,@footer)))))))) + (nconc `((tr nil (td nil (table nil (tbody + nil ,@header))))) + (if (= nbody nfooter) + `((tr nil (td nil (table + nil (tbody nil ,@body + ,@footer))))) + (nconc `((tr nil (td nil (table + nil (tbody nil + ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil + (tbody + nil + ,@footer)))))))))) + ;; header + body + (if (= nheader nbody) + `((tr nil (td nil (table nil (tbody nil ,@header + ,@body))))) + (if (= nheader 1) + `(,@header (tr nil (td nil (table + nil (tbody nil ,@body))))) + `((tr nil (td nil (table nil (tbody nil ,@header)))) + (tr nil (td nil (table nil (tbody nil ,@body))))))))) + (footer + ;; body + footer + (if (= nbody nfooter) + `((tr nil (td nil (table + nil (tbody nil ,@body ,@footer))))) + (nconc `((tr nil (td nil (table nil (tbody nil ,@body))))) + (if (= nfooter 1) + footer + `((tr nil (td nil (table + nil (tbody nil ,@footer))))))))) + (caption + `((tr nil (td nil (table nil (tbody nil ,@body)))))) + (body))))) (when bgcolor (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) bgcolor)) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 26 12:50:57 2014 Received: (at control) by debbugs.gnu.org; 26 Dec 2014 17:50:57 +0000 Received: from localhost ([127.0.0.1]:58376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y4Z2P-00089p-BU for submit@debbugs.gnu.org; Fri, 26 Dec 2014 12:50:57 -0500 Received: from fely.am-1.org ([78.47.74.50]:46291) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y4Z2K-00089c-15 for control@debbugs.gnu.org; Fri, 26 Dec 2014 12:50:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=LEYPoAO/uId0VyBzc7mdyosrk0mCOzG5ptSV7H8ZCUU=; b=E8vT9aoGHk4M89BYYdPeRmFwFy2K5bkuapCW7ZNsOQ0u2IgfBMvlX9Y0jotOR+IyePDalJgco3ZjrlCuVBfL0WNIOKQXvy1iCOk0h/m5gSKankw9itUF3vcfwiv1m3e0wCVHWTi7Y9AgysKVZPoiVtS2DESXWcoGy6AXd5Azb9E=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y4Z2J-0006hi-9f for control@debbugs.gnu.org; Fri, 26 Dec 2014 17:50:51 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y4Z2C-0004ib-4S for control@debbugs.gnu.org; Sat, 27 Dec 2014 00:50:44 +0700 From: Ivan Shmakov To: control@debbugs.gnu.org Subject: tweaking bugs Mail-Followup-To: emacs-devel@gnu.org Date: Fri, 26 Dec 2014 17:50:43 +0000 Message-ID: <877fxefggc.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) reopen 19152 tags 19445 + patch tags 19444 + patch tags 18246 + patch tags 18175 + patch thanks In news:jwvfvcykvep.fsf-monnier+emacsbugs@gnu.org, Stefan has confirmed that #19152 is not yet resolved. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 28 09:07:01 2014 Received: (at 19444) by debbugs.gnu.org; 28 Dec 2014 14:07:01 +0000 Received: from localhost ([127.0.0.1]:59498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5EUn-0004Bj-0k for submit@debbugs.gnu.org; Sun, 28 Dec 2014 09:07:01 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:46481) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5EUl-0004Bb-7v for 19444@debbugs.gnu.org; Sun, 28 Dec 2014 09:06:59 -0500 Received: from 2.150.68.69.tmi.telenormobil.no ([2.150.68.69] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Y5EUU-0004iy-90; Sun, 28 Dec 2014 15:06:42 +0100 From: Lars Ingebrigtsen To: Ivan Shmakov Subject: Re: bug#19444: shr-tag-table: the value passed to shr-tag-table-1 is not a DOM References: <87fvc2fhie.fsf@violet.siamics.net> X-Now-Playing: burn's _304 (Moon Base Big)_: "Wire!Red_Barked_Tree!01-Please_Take" Date: Sun, 28 Dec 2014 15:06:39 +0100 In-Reply-To: <87fvc2fhie.fsf@violet.siamics.net> (Ivan Shmakov's message of "Fri, 26 Dec 2014 17:27:53 +0000") Message-ID: <87h9wfuavk.fsf@building.gnus.org> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1Y5EUU-0004iy-90 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1420380403.28606@Pwzhv0dxvOFkSOy8i4SUdw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 19444 Cc: 19444@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Thanks; applied. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 28 09:07:06 2014 Received: (at control) by debbugs.gnu.org; 28 Dec 2014 14:07:06 +0000 Received: from localhost ([127.0.0.1]:59501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5EUs-0004CN-HZ for submit@debbugs.gnu.org; Sun, 28 Dec 2014 09:07:06 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:46487) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5EUq-0004CD-6C for control@debbugs.gnu.org; Sun, 28 Dec 2014 09:07:04 -0500 Received: from 2.150.68.69.tmi.telenormobil.no ([2.150.68.69] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Y5EUY-0004j8-CD for control@debbugs.gnu.org; Sun, 28 Dec 2014 15:06:46 +0100 Date: Sun, 28 Dec 2014 15:06:45 +0100 Message-Id: <87fvbzuave.fsf@building.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #19444 X-MailScanner-ID: 1Y5EUY-0004j8-CD X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1420380406.61023@5TMXfht/Q4RwxBo0yUbhNw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 19444 fixed close 19444 25.1 From unknown Fri Sep 05 08:43:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 26 Jan 2015 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator