LF instead of CR for new lines or writing about Pharo inside Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

LF instead of CR for new lines or writing about Pharo inside Pharo

Offray
Hi all! :-)

Today is a good day because Pharo is helping me a lot in getting things
done (like in the Black Eyed Peas song, but nerdy style). Here you can
see a screenshot of the exportation of the outliner project I have been
working on (still in alpha):

http://www.enlightenment.org/ss/e-54206a705cafd9.68856727.jpg

Down is the Pharo outliner, upper left the markdown exportation and
upper right the pdf exportation. As you can see, I have small glitches
that need to be solved, mainly the fact that new lines are represented
in Pharo by default with CR instead of LR, which doesn't like so much to
the Pandoc[1][2] exporter. So, there is any way to change this behaviour
to make LF the default character? This has some implications when you're
writing code inside System Browsers or Playgrounds instead of my
particular app? If yes, there is any way to replace each CR for LF in a
text object, inside Pharo?

[1] http://johnmacfarlane.net/pandoc/
[2]
http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown

Thanks a lot,

Offray

Reply | Threaded
Open this post in threaded view
|

Re: LF instead of CR for new lines or writing about Pharo inside Pharo

Offray
Hi :-),

A small answer to myself that can be useful is someone find this thread:

I have seen some post on Internet about CR and LF issues on Pharo
Smalltalk, like this:

[1]
http://stackoverflow.com/questions/11739548/how-to-correctly-decode-text-files-from-filesystemreadstream-in-pharo-1-4
[2] http://stackoverflow.com/questions/1598054/smalltalk-newline-character

A detailed search on the web take me to this:

http://magaloma.seasidehosting.st/Collections-Strings

Here I searched for "replace" and found the proper method:

"""
withInternetLineEndings
change line endings from CR's to CRLF's. This is probably in
prepration for sending a string over the Internet
"""

So taking my string and sending:

   myString contents withInternetLineEndings

did the trick.

I hope it will be helpful for future newbies.

Cheers,

Offray


On 09/22/2014 01:38 PM, Offray Vladimir Luna Cárdenas wrote:

> Hi all! :-)
>
> Today is a good day because Pharo is helping me a lot in getting things
> done (like in the Black Eyed Peas song, but nerdy style). Here you can
> see a screenshot of the exportation of the outliner project I have been
> working on (still in alpha):
>
> http://www.enlightenment.org/ss/e-54206a705cafd9.68856727.jpg
>
> Down is the Pharo outliner, upper left the markdown exportation and
> upper right the pdf exportation. As you can see, I have small glitches
> that need to be solved, mainly the fact that new lines are represented
> in Pharo by default with CR instead of LR, which doesn't like so much to
> the Pandoc[1][2] exporter. So, there is any way to change this behaviour
> to make LF the default character? This has some implications when you're
> writing code inside System Browsers or Playgrounds instead of my
> particular app? If yes, there is any way to replace each CR for LF in a
> text object, inside Pharo?
>
> [1] http://johnmacfarlane.net/pandoc/
> [2]
> http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown
>
>
> Thanks a lot,
>
> Offray
>
>


Reply | Threaded
Open this post in threaded view
|

Re: LF instead of CR for new lines or writing about Pharo inside Pharo

Ben Coman
Offray Vladimir Luna Cárdenas wrote:

> Hi :-),
>
> A small answer to myself that can be useful is someone find this thread:
>
> I have seen some post on Internet about CR and LF issues on Pharo
> Smalltalk, like this:
>
> [1]
> http://stackoverflow.com/questions/11739548/how-to-correctly-decode-text-files-from-filesystemreadstream-in-pharo-1-4 
>
> [2]
> http://stackoverflow.com/questions/1598054/smalltalk-newline-character
>
> A detailed search on the web take me to this:
>
> http://magaloma.seasidehosting.st/Collections-Strings
>
> Here I searched for "replace" and found the proper method:
>
> """
> withInternetLineEndings
> change line endings from CR's to CRLF's. This is probably in
> prepration for sending a string over the Internet
> """
>
> So taking my string and sending:
>
>   myString contents withInternetLineEndings
>
> did the trick.
>
> I hope it will be helpful for future newbies.
>
> Cheers,
>
> Offray
>
>
> On 09/22/2014 01:38 PM, Offray Vladimir Luna Cárdenas wrote:
>> Hi all! :-)
>>
>> Today is a good day because Pharo is helping me a lot in getting things
>> done (like in the Black Eyed Peas song, but nerdy style). Here you can
>> see a screenshot of the exportation of the outliner project I have been
>> working on (still in alpha):
>>
>> http://www.enlightenment.org/ss/e-54206a705cafd9.68856727.jpg
>>
>> Down is the Pharo outliner, upper left the markdown exportation and
>> upper right the pdf exportation. As you can see, I have small glitches
>> that need to be solved, mainly the fact that new lines are represented
>> in Pharo by default with CR instead of LR, which doesn't like so much to
>> the Pandoc[1][2] exporter. So, there is any way to change this behaviour
>> to make LF the default character? This has some implications when you're
>> writing code inside System Browsers or Playgrounds instead of my
>> particular app? If yes, there is any way to replace each CR for LF in a
>> text object, inside Pharo?
>>
>> [1] http://johnmacfarlane.net/pandoc/
>> [2]
>> http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown 
>>
>>
>>
>> Thanks a lot,
>>
>> Offray
>>
>>
>
>
>
Thanks for the update.  I'm not entirely new anymore, but there are
always new corners to learn.
cheers -ben


Reply | Threaded
Open this post in threaded view
|

Re: LF instead of CR for new lines or writing about Pharo inside Pharo

Henrik Sperre Johansen
In reply to this post by Offray

On 23 Sep 2014, at 6:28 , Offray Vladimir Luna Cárdenas <[hidden email]> wrote:

> Hi :-),
>
> A small answer to myself that can be useful is someone find this thread:
>
> I have seen some post on Internet about CR and LF issues on Pharo Smalltalk, like this:
>
> [1] http://stackoverflow.com/questions/11739548/how-to-correctly-decode-text-files-from-filesystemreadstream-in-pharo-1-4
> [2] http://stackoverflow.com/questions/1598054/smalltalk-newline-character
>
> A detailed search on the web take me to this:
>
> http://magaloma.seasidehosting.st/Collections-Strings
>
> Here I searched for "replace" and found the proper method:
>
> """
> withInternetLineEndings
> change line endings from CR's to CRLF's. This is probably in
> prepration for sending a string over the Internet
> """
>
> So taking my string and sending:
>
>  myString contents withInternetLineEndings
>
> did the trick.
>
> I hope it will be helpful for future newbies.
>
> Cheers,
>
> Offray
A better solution if you are writing to file, and still want to keep the string in image with its default line ending, is using the lineEnding conversion of the Stream (MultiByteFileStream >> lineEndConvention:).

Cheers,
Henry

signature.asc (859 bytes) Download Attachment