How do I encode this?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I encode this?

Patrick Larkin-2
Lasso 8.6/MySQL

I have records containing blocks of text that contain both hot-linked URLs as well as paragraph breaks.

If I display the text using

[var('story', -EncodeNone)]

I lose all of the paragraph breaks but the link HTML is encoded correctly.

If I display the text using

[var('story', -EncodeBreak)]

I get a nice breaking story but then all the HTML is encoded.

I tried -EncodeSmart and tried different combinations to get what I need to no avail.  

Anyone?



Patrick

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How do I encode this?

Brad Lindsay-2
On Dec 3, 2012, at 10:52 AM, Patrick Larkin <[hidden email]> wrote:

> Lasso 8.6/MySQL
>
> I have records containing blocks of text that contain both hot-linked URLs as well as paragraph breaks.
>
> If I display the text using
>
> [var('story', -EncodeNone)]
>
> I lose all of the paragraph breaks but the link HTML is encoded correctly.
>
> If I display the text using
>
> [var('story', -EncodeBreak)]
>
> I get a nice breaking story but then all the HTML is encoded.
>
> I tried -EncodeSmart and tried different combinations to get what I need to no avail.  
>
> Anyone?

A couple of things for you to try:
[string_replace(encode_smart($story), -find='\n', -replace='<br />')]

[string_replace($story, -find='\n', -replace='<br />')]

If you can't guarantee what the line ending will be, you could do something like this:
[
  local('output') = string_replace($story, -find='\r\n', -replace='<br />');
  #output->replace('\r', '<br />')&replace('\n', '<br />');
  encode_smart(#output);
]


Brad
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How do I encode this?

Patrick Larkin-2

On Dec 3, 2012, at 11:03 AM, Brad Lindsay wrote:

> A couple of things for you to try:
> [string_replace(encode_smart($story), -find='\n', -replace='<br />')]

This resulted in no encoding of the HTML and no paragraph breaks.  :(
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How do I encode this?

Brad Lindsay-2
On Dec 3, 2012, at 11:26 AM, Patrick Larkin <[hidden email]> wrote:
> On Dec 3, 2012, at 11:03 AM, Brad Lindsay wrote:
>
>> A couple of things for you to try:
>> [string_replace(encode_smart($story), -find='\n', -replace='<br />')]
>
> This resulted in no encoding of the HTML and no paragraph breaks.  :(

And my other examples?

[string_replace($story, -find='\n', -replace='<br />')]


[
 local('output') = string_replace($story, -find='\r\n', -replace='<br />');
 #output->replace('\r', '<br />')&replace('\n', '<br />');
 encode_smart(#output);
]



Other ones to try as well:

// A one-liner of the one above
[encode_smart(string_replace($story, -find='\r\n', -replace='<br />')&replace('\r', '<br />')&replace('\n', '<br />')&)]


[encode_smart(string_replace($story, -find='\n', -replace='<br />'))]


Brad
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How do I encode this?

Patrick Larkin-2


On Dec 3, 2012, at 11:32 AM, Brad Lindsay wrote:
>
> And my other examples?
>
> [string_replace($story, -find='\n', -replace='<br />')]

Same.  No encoding of the HTML done here.

>
>
> [
> local('output') = string_replace($story, -find='\r\n', -replace='<br />');
> #output->replace('\r', '<br />')&replace('\n', '<br />');
> encode_smart(#output);
> ]

This worked.  Thanks.
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>