unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Regexp: match any character including newline
Date: Thu, 17 Oct 2013 10:25:13 +0800	[thread overview]
Message-ID: <87vc0wocqe.fsf@ericabrahamsen.net> (raw)
In-Reply-To: CAP_d_8Vj6Wa6OXP_73jxaZOM3U6cw8sc2zHkae5gfgVR6to2mg@mail.gmail.com

Yuri Khan <yuri.v.khan@gmail.com> writes:

> Hello All,
>
> I’m doing regexp replacements on a hard-wrapped XHTML-alike. Here’s an
> original fragment:
>
> ===
> <tr><td><pre><code>X(n, t)
> X a(n, t)</code></pre></td><td></td>
>     <td><requires><p><code>T</code> shall be
>         <concept>Copy&shy;Insert&shy;able</concept> into
>         <code>X</code>.</p></requires>
>         <p>post: <code>distance(begin(), end()) == n</code></p>
>         <p>Constructs a sequence container with <code>n</code> copies
>         of <code>t</code></p></td></tr>
> ===

Another option (though I'm not claiming you'll actually want to do this)
is to use xml.el (comes with emacs?) to parse that xml into a tree, and
then mess with the tree. Parsing the above gets me:

((tr nil (td nil (pre nil (code nil "X(n, t) X a(n, t)"))) (td nil) " "
(td nil (requires nil (p nil (code nil "T") " shall be " (concept nil
"Copy?Insert?able") " into " (code nil "X") ".")) " " (p nil "post: "
(code nil "distance(begin(), end()) == n")) " " (p nil "Constructs a
sequence container with " (code nil "n") " copies of " (code nil
"t")))))

`xml-entity-alist' would have to be tweaked.

Like I said, you probably wouldn't want this, but it's an interesting
option...

E




  parent reply	other threads:[~2013-10-17  2:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 14:42 Regexp: match any character including newline Yuri Khan
2013-10-16 15:31 ` Kai Großjohann
2013-10-16 15:56   ` Yuri Khan
2013-10-16 16:53 ` Drew Adams
2013-10-17  2:25 ` Eric Abrahamsen [this message]
     [not found] <mailman.4131.1381934579.10748.help-gnu-emacs@gnu.org>
2013-10-16 15:58 ` Rustom Mody
2013-10-16 16:16   ` Yuri Khan
     [not found]   ` <mailman.4141.1381940186.10748.help-gnu-emacs@gnu.org>
2013-10-16 16:48     ` Rustom Mody

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=87vc0wocqe.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.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.
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).