unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Pankaj Jangid <pankaj@codeisgreat.org>
Cc: 44348@debbugs.gnu.org
Subject: bug#44348: 28.0.50; eww renders xml processing element as is
Date: Sat, 31 Oct 2020 20:47:09 +0100	[thread overview]
Message-ID: <87tuuaqite.fsf@gmx.net> (raw)
In-Reply-To: <m2pn4yo0rs.fsf@mb2.local.i-did-not-set--mail-host-address--so-tickle-me> (Pankaj Jangid's message of "Sat, 31 Oct 2020 21:17:35 +0530")

On Sat, 31 Oct 2020 21:17:35 +0530 Pankaj Jangid <pankaj@codeisgreat.org> wrote:

> I published a webpage using org. The output has this xml element at the
> top:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> But this is rendered as it is in eww when I fetch it from the hosted
> website.
>
> When I view-source the element there is:
>
> &lt;?xml version="1.0" encoding="utf-8"?>
>
> Note that the opening angle bracket is converted to HTML entity type.

The simplest fix would seem to be this:

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index fd9fe98439..051698d6d6 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -420,7 +420,7 @@ eww--preprocess-html
       (narrow-to-region start end)
       (goto-char start)
       (let ((case-fold-search t))
-        (while (re-search-forward "<[^0-9a-z!/]" nil t)
+        (while (re-search-forward "<[^0-9a-z!?/]" nil t)
           (goto-char (match-beginning 0))
           (delete-region (point) (1+ (point)))
           (insert "&lt;"))))))

But if that's too permissive, then a more specific fix is this:

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index fd9fe98439..bc795df256 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -421,9 +421,11 @@ eww--preprocess-html
       (goto-char start)
       (let ((case-fold-search t))
         (while (re-search-forward "<[^0-9a-z!/]" nil t)
-          (goto-char (match-beginning 0))
-          (delete-region (point) (1+ (point)))
-          (insert "&lt;"))))))
+          (unless (and (looking-back "\\?" (line-beginning-position))
+                       (looking-at "xml"))
+            (goto-char (match-beginning 0))
+            (delete-region (point) (1+ (point)))
+            (insert "&lt;")))))))

 ;;;###autoload (defalias 'browse-web 'eww)

Steve Berman





  reply	other threads:[~2020-10-31 19:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 15:47 bug#44348: 28.0.50; eww renders xml processing element as is Pankaj Jangid
2020-10-31 19:47 ` Stephen Berman [this message]
2020-11-01 13:28   ` Lars Ingebrigtsen
2020-11-01 23:08     ` Stephen Berman
2020-11-02 15:16       ` Lars Ingebrigtsen
2020-11-02 22:28         ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tuuaqite.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=44348@debbugs.gnu.org \
    --cc=pankaj@codeisgreat.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).