Gnus development mailing list
 help / color / mirror / Atom feed
From: "François Pinard" <pinard@iro.umontreal.ca>
Cc: ding@gnus.org
Subject: Re: The <word>.<word>.<word> rule
Date: 16 May 2000 07:58:24 -0400	[thread overview]
Message-ID: <oq1z32wvtr.fsf@titan.progiciels-bpi.ca> (raw)
In-Reply-To: Hrvoje Niksic's message of "16 May 2000 09:29:21 +0200"

Hrvoje Niksic <hniksic@iskon.hr> writes:

> Miroslav Zubcic <miroslav.zubcic@zesoi.fer.hr> writes:

> > I found good string posted by
> > Per Abrahamsen <rj1z339a3z.fsf_-_@zuse.dina.kvl.dk> This string is
> > just fine, not too much, not too small. (Main problem was strings and
> > regexps, this `|\(%' are hardly readible to me).

> Sigh, a standard problem in languages that don't support a regexp syntax.

I did not follow this thread in detail, but let me add my grain of salt
nevertheless (or my grain of sand, depending on how you see it :-).

When I saw all this new highlighting, my first impression was positive,
as I like non-language to stand out in some way.  It was not perfect:
for example, the name part (before the `@') was forgotten, but overall,
it looked like a step in a good direction.

But when I realised that associated with the highlighting, was a button
invariably presuming, wrongly in most cases, that we were facing an HTTP
reference, my joy disappeared: this was far too dumb to be clever.

In a word, I like non-language to be highlighted.  However, button
association should be done _much_ more carefully.

I do not know if this might be useful, but here is some Python code I use to
highlight, then buttonize plain text while converting it into HTML pages.
The results are satisfying most of times, and maybe it could point towards
some compromise?  [Python regexps are Perlish more than Emacsish.]


def enhance(text, verbatim=0):
    text = string.replace(text, '&', '&amp;')
    text = string.replace(text, '<', '&lt;')
    text = string.replace(text, '>', '&gt;')
    text = string.replace(text, '\f', '')
    if verbatim:
        text = re.sub(r'((mailto:|http://|ftp://)[-_.@~/a-zA-Z0-9]+)',
                      r'<a href="\1">\1</a>', text)
    else:
        text = re.sub(r'((mailto:|http://|ftp://)([-_.@~/a-zA-Z0-9]+))',
                      r'<a href="\1">\3</a>', text)
    text = re.sub((r'(^|[^-_%+./a-zA-Z0-9:])'
                   r'([-_%+./a-zA-Z0-9]+@[-a-zA-Z0-9]+\.[-.a-zA-Z0-9]+)'),
                  r'\1<a href="mailto:\2">\2</a>', text)
    if verbatim:
        text = re.sub(r'_([-_@./a-zA-Z0-9]+)_', r'_<i>\1</i>_', text)
        text = re.sub(r'\*([-_@./a-zA-Z0-9]+)\*', r'*<b>\1</b>*', text)
        text = re.sub(r"`([-_@./a-zA-Z0-9]+)'", r"`<tt><b>\1</b></tt>'",
                      text)
    else:
        text = re.sub(r'_([-_@./a-zA-Z0-9]+)_', r'<i>\1</i>', text)
        text = re.sub(r'\*([-_@./a-zA-Z0-9]+)\*', r'<b>\1</b>', text)
        text = re.sub(r"`([-_@./a-zA-Z0-9]+)'", r'<tt><b>\1</b></tt>',
                      text)
    return text


P.S. - By the way, Lars, I would much like having a Python version of Gnus!
Would you add this to the Gnus TODO file? :-) :-) :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





  reply	other threads:[~2000-05-16 11:58 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-11 10:24 Per Abrahamsen
2000-05-12 11:50 ` Hrvoje Niksic
2000-05-12 12:57   ` Stein A. Strømme
2000-05-12 15:16     ` Stainless Steel Rat
2000-05-12 15:47       ` Kai Großjohann
2000-05-12 19:58         ` Jaap-Henk Hoepman
2000-05-14 19:17           ` Karl Kleinpaste
2000-05-14 19:30             ` Steinar Bang
2000-05-14 19:35               ` Karl Kleinpaste
2000-05-14 19:46                 ` Steinar Bang
2000-05-14 20:29                   ` Karl Kleinpaste
2000-05-14 20:46                     ` Bruce Stephens
2000-05-15 13:03                       ` Karl Kleinpaste
2000-05-15 13:51                         ` Toby Speight
2000-05-15 14:00                           ` Steinar Bang
2000-05-14 21:30                     ` naked URLs -- a little data (Re: The <word>.<word>.<word> rule) Karl Kleinpaste
2000-05-15  7:06                       ` Steinar Bang
2000-05-15 12:02                     ` The <word>.<word>.<word> rule Miroslav Zubcic
2000-05-15 12:37                       ` Karl Kleinpaste
2000-05-15 23:14                         ` Miroslav Zubcic
2000-05-16  7:29                           ` Hrvoje Niksic
2000-05-16 11:58                             ` François Pinard [this message]
2000-05-17  8:28                               ` Python Emacs (was Re: The <word>.<word>.<word> rule) Jaap-Henk Hoepman
2000-05-17 20:06                                 ` François Pinard
2000-05-17 20:27                                   ` Kai Großjohann
2000-05-17 20:37                                     ` Stainless Steel Rat
2000-05-17 21:04                                       ` Brian Edmonds
2000-05-18  1:25                                         ` Stainless Steel Rat
2000-05-18 23:18                                         ` Russ Allbery
2000-05-18 20:48                                       ` Jaap-Henk Hoepman
2000-05-19 14:42                                         ` Stainless Steel Rat
2000-05-20 20:35                                           ` Jaap-Henk Hoepman
2000-05-20 22:43                                             ` Kai Großjohann
2000-05-21 19:06                                               ` Jaap-Henk Hoepman
2000-05-22 12:05                                               ` Per Abrahamsen
2000-05-23  0:12                                               ` Hal Snyder
     [not found]                                                 ` <m3g0raulgw.fsf@peorth.rgo.gweep.net>
2000-05-23  1:16                                                   ` Eric S. Johansson
2000-05-23  1:29                                                     ` Lloyd Zusman
2000-05-23  1:44                                                       ` real programmers(TM) Brian May
2000-05-23  7:03                                                         ` Hrvoje Niksic
2000-05-23  7:36                                                     ` Python Emacs (was Re: The <word>.<word>.<word> rule) Luc MAZARDO
2000-05-21  4:22                                             ` Stainless Steel Rat
2000-05-21 19:07                                               ` Jaap-Henk Hoepman
2000-05-22 17:59                                             ` Jim Davidson
2000-05-22 19:32                                               ` Jaap-Henk Hoepman
2000-05-22 22:54                                               ` François Pinard
2000-05-17 20:59                                     ` François Pinard
2000-05-17 21:29                                       ` Eric S. Johansson
2000-05-17 22:15                                         ` Felix Lee
2000-05-18  6:28                                           ` Randal L. Schwartz
2000-05-18 12:22                                             ` Felix Lee
2000-05-17 22:55                                         ` Steve Harris
2000-05-18  0:10                                         ` Brian May
2000-05-18 11:56                                           ` Kai Großjohann
2000-05-18 12:27                                           ` Felix Lee
2000-05-18  9:17                                         ` Kai Großjohann
2000-05-18 11:46                                           ` getting started again was:Re: " Eric S. Johansson
2000-05-18 14:08                                             ` Kai Großjohann
2000-05-18 20:13                                               ` getting started again Eric S. Johansson
2000-05-18 21:32                                                 ` Erik Johannessen
     [not found]                                                 ` <x77lcr7deb.fsf@!  rask.void.nil>
2000-05-18 21:51                                                   ` Eric S. Johansson
2000-05-22 18:12                                                 ` Rene Matteau
2000-05-18 19:31                                         ` Python Emacs (was Re: The <word>.<word>.<word> rule) Jim Davidson
2000-05-18  8:50                                     ` Simon Josefsson
2000-05-18  9:33                                     ` Luc MAZARDO
2000-05-18 20:44                                     ` Jaap-Henk Hoepman
2000-05-19 10:32                                       ` Kai Großjohann
2000-05-22 12:19                                     ` Didier Verna
2000-08-12 19:55                                   ` Lars Magne Ingebrigtsen
2000-05-15 12:52                       ` The <word>.<word>.<word> rule Jørgen Wahlberg
2000-05-15 13:32                         ` Steinar Bang
2000-05-14 20:38                   ` Karl Eichwalder
2000-05-15  5:34               ` Stainless Steel Rat
2000-05-15  6:40                 ` Steinar Bang
2000-05-15 12:25                 ` Andreas Fuchs
2000-05-14 19:32             ` Andreas Fuchs
2000-05-14 20:06             ` Kai Großjohann
2000-05-16 15:38             ` Jaap-Henk Hoepman
2000-05-14 19:23           ` Steinar Bang
2000-05-12 15:52     ` Steinar Bang
2000-05-12 23:06       ` Stainless Steel Rat
2000-05-13  9:07         ` Kai Großjohann
2000-05-13 12:56           ` Stainless Steel Rat
2000-05-14 10:54           ` Steinar Bang
2000-05-14 11:43             ` Andi Hechtbauer
2000-05-14 19:25               ` Steinar Bang
2000-05-14 19:33                 ` Karl Kleinpaste
2000-05-14 19:57                   ` Felix Lee
2000-05-15 11:20                   ` Toby Speight
2000-05-14 20:54                 ` Bjørn Mork
2000-05-15  5:28                   ` Steinar Bang
2000-05-15 18:24                     ` Bjørn Mork
2000-05-15 18:38                       ` Steinar Bang
2000-05-15 18:40                       ` Steinar Bang
2000-05-15 14:11             ` New URL button rule (was: Re: The <word>.<word>.<word> rule) Per Abrahamsen
2000-05-15 14:18               ` Steinar Bang
2000-05-15 15:28               ` Stainless Steel Rat
2000-05-15 16:11                 ` Per Abrahamsen
2000-05-15 16:27                   ` Steinar Bang
2000-05-15 18:31                     ` Bjørn Mork
2000-05-15 19:58                   ` Kai Großjohann
2000-05-16  7:25                     ` Hrvoje Niksic
2000-05-16 11:08               ` Per Abrahamsen
2000-05-13  9:14         ` The <word>.<word>.<word> rule Steinar Bang
2000-05-13 10:56           ` Karl Eichwalder
2000-05-13 13:01           ` Stainless Steel Rat
2000-05-15 14:02           ` Per Abrahamsen

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

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

  git send-email \
    --in-reply-to=oq1z32wvtr.fsf@titan.progiciels-bpi.ca \
    --to=pinard@iro.umontreal.ca \
    --cc=ding@gnus.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 NNTP newsgroup(s).