|
List Info
Thread: python autolink that doesnt mangle html
|
|
| python autolink that doesnt mangle html |
  United States |
2007-09-18 23:52:46 |
Hello guys
I m looking for a library or a scrip that autolinks html +
non html
content such as
i love...
Spin the bottle
Redneck hoe
<br><br> <a href="http://den.com&qu
ot;>A</a>
http://www.google.com
loves ICP songs
and the result should be
i love...<br>
Spin the bottle<br>
Redneck hoe<br>
<br><br> <a href="http://den.com&qu
ot;>A</a>
<a href="http://www.google.com">http://www.google.c
om</a> loves ICP
songs
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: python autolink that doesnt mangle
html |

|
2007-09-19 05:40:51 |
Hello,
On 9/19/07, John <sanmateoquest yahoo.com> wrote:
> I m looking for a library or a scrip that autolinks
html + non html
> content such as
>
> i love...
> Spin the bottle
> Redneck hoe
> <br><br> <a href="http://den.com&qu
ot;>A</a>
> http://www.google.com loves
ICP songs
>
> and the result should be
>
> i love...<br>
> Spin the bottle<br>
> Redneck hoe<br>
> <br><br> <a href="http://den.com&qu
ot;>A</a>
> <a href="http://www.google.com">http://www.google.c
om</a> loves ICP
> songs
The real problem is finding a suitable regular expression,
which is a
little off topic for this list. For my (simple) purposes
this is
sufficient:
r"""(?P<url>!?([a-z]+://[^ ]+[^.,'
)]}]))""",
To avoid substitution inside existing html tags you'll have
to limit
to strings of the form (^|>)[^<]*(<|$) I guess.
Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: python autolink that doesnt mangle
html |
  United States |
2007-09-19 12:07:28 |
John wrote:
> Hello guys
> I m looking for a library or a scrip that autolinks
html + non html
> content such as
>
> i love...
> Spin the bottle
> Redneck hoe
> <br><br> <a href="http://den.com&qu
ot;>A</a>
> http://www.google.com loves
ICP songs
>
> and the result should be
>
> i love...<br>
> Spin the bottle<br>
> Redneck hoe<br>
> <br><br> <a href="http://den.com&qu
ot;>A</a>
> <a href="http://www.google.com">http://www.google.c
om</a> loves ICP
> songs
>
What you're asking is much trickier than you might think.
Consider this
snippet:
iron < brass < br > <brrr!>
How will you know that the first and third "<"
should be turned in to
"<" while the second one should be left as
a tag?
--
Tim Roberts, timr probo.com
Providenza & Boekelheide, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: python autolink that doesnt mangle
html |
  United States |
2007-09-20 16:43:17 |
Arnar the 2 regexes u ve given me seem good how to do
To avoid substitution inside existing html tags
you'll have
to limit to strings of the form (^|>)[^<]*(<|$) I
guess.
Thanks
On Sep 19, 3:40 am, "Arnar Birgisson"
<arna... gmail.com> wrote:
> Hello,
>
> On 9/19/07, John <sanmateoqu... yahoo.com> wrote:
>
>
>
> > I m looking for a library or a scrip that
autolinks html + non html
> > content such as
>
> > i love...
> > Spin the bottle
> > Redneck hoe
> > <br><br> <a href="http://den.com&qu
ot;>A</a>
> >http://www.google.comloves
ICP songs
>
> > and the result should be
>
> > i love...<br>
> > Spin the bottle<br>
> > Redneck hoe<br>
> > <br><br> <a href="http://den.com&qu
ot;>A</a>
> > <a href="http://www.google.com">http://www.google.c
om</a> loves ICP
> > songs
>
> The real problem is finding a suitable regular
expression, which is a
> little off topic for this list. For my (simple)
purposes this is
> sufficient:
>
> r"""(?P<url>!?([a-z]+://[^
]+[^.,' )]}]))""",
>
> To avoid substitution inside existing html tags you'll
have to limit
> to strings of the form (^|>)[^<]*(<|$) I
guess.
>
> Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: python autolink that doesnt mangle
html |
  United States |
2007-10-15 10:36:20 |
Have you tried markdown or textile?
http://d
aringfireball.net/projects/markdown/
sudo easy_install markdown
http://textile.thr
esholdstate.com/
On Sep 20, 10:43 pm, John <sanmateoqu... yahoo.com> wrote:
> Arnar the 2 regexes u ve given me seem good how to do
> To avoid substitution inside existing html
tags you'll have
> to limit to strings of the form
(^|>)[^<]*(<|$) I guess.
>
> Thanks
> On Sep 19, 3:40 am, "Arnar Birgisson"
<arna... gmail.com> wrote:
>
> > Hello,
>
> > On 9/19/07, John <sanmateoqu... yahoo.com> wrote:
>
> > > I m looking for a library or a scrip that
autolinks html + non html
> > > content such as
>
> > > i love...
> > > Spin the bottle
> > > Redneck hoe
> > > <br><br> <a href="http://den.com&qu
ot;>A</a>
> > >http://www.google.comlo
vesICP songs
>
> > > and the result should be
>
> > > i love...<br>
> > > Spin the bottle<br>
> > > Redneck hoe<br>
> > > <br><br> <a href="http://den.com&qu
ot;>A</a>
> > > <a href="http://www.google.com">http://www.google.c
om</a> loves ICP
> > > songs
>
> > The real problem is finding a suitable regular
expression, which is a
> > little off topic for this list. For my (simple)
purposes this is
> > sufficient:
>
> > r"""(?P<url>!?([a-z]+://[^
]+[^.,' )]}]))""",
>
> > To avoid substitution inside existing html tags
you'll have to limit
> > to strings of the form (^|>)[^<]*(<|$) I
guess.
>
> > Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-5]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|