[Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-01 Thread Pierce Ng
Hi all,

I've published Phoedown, an FFI to hoedown, the standards compliant, fast, 
secure Markdown
processing library written in C. 

- https://github.com/PierceNg/Phoedown
- https://github.com/hoedown/hoedown

A simple example:

| md |
md := (FileSystem memory / 'somefile.md')
writeStreamDo: [ :ws |
ws nextPutAll: 
'
 ```smalltalk
Transcript show: ''Happy New Year!''; cr
 ```
' ];
contents.
HdHtmlRenderer new
setMarkdownExtension: HdMarkdownExtensions FencedCode;
setMarkdownExtension: HdMarkdownExtensions NoIntraEmphasis;
render: md

This is the output:

Transcript show: 'Happy New 
Year!'; cr

 
Pierce




Re: [Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-01 Thread Tim Mackinnon
I’m loving all the little utility libraries coming out (and appreciate the 
write ups on how things are done).

I’m curious why you chose to use ffi for this one in particular as it would 
seem to be quite straightforward to do it all in native Smalltalk (not to down 
play your integration in any way of course). Was performance a big thing? Or 
was it simply relying on others to keep it up to date?

Tim





Sent from my iPhone
> On 1 Jan 2020, at 10:40, Pierce Ng  wrote:
> 
> Hi all,
> 
> I've published Phoedown, an FFI to hoedown, the standards compliant, fast, 
> secure Markdown
> processing library written in C. 
> 
> - https://github.com/PierceNg/Phoedown
> - https://github.com/hoedown/hoedown
> 
> A simple example:
> 
>| md |
>md := (FileSystem memory / 'somefile.md')
>writeStreamDo: [ :ws |
>ws nextPutAll: 
>'
> ```smalltalk
>Transcript show: ''Happy New Year!''; cr
> ```
>' ];
>contents.
>HdHtmlRenderer new
>setMarkdownExtension: HdMarkdownExtensions FencedCode;
>setMarkdownExtension: HdMarkdownExtensions NoIntraEmphasis;
>render: md
> 
> This is the output:
> 
>Transcript show: 'Happy New 
> Year!'; cr
>
> 
> Pierce
> 
> 




Re: [Pharo-users] why is masses not found?

2020-01-01 Thread Roelof Wobben via Pharo-users
--- Begin Message ---

Hello,

I have it now working but as you said there is a lot of code smells and 
my exact question is how to get rid of them.


solution
 | computer |
 computer := self new.
 computer readRam: computer masses.
 computer patchRam: 1 value: 12.
 computer patchRam: 2 value: 2.
 computer processData: computer ram.
 computer at: 0


this is now a class method but I need a lot the computer variable.


here you can find the whole code under intComputer class.






Op 31-12-2019 om 19:29 schreef Sean P. DeNigris:

Pharo Smalltalk Users mailing list wrote

when I call on the class side the method which
should reed the masses which are on the instanc side , the masses
cannnot be found.

IntComputer class >> solution
| computer ram |
computer := self new.
computer readRam: masses.
...

In your code above, you are not actually "calling a class-side method"
(which BTW in Smalltalk the term is "sending a message", an important
philosophical distinction if you want to grok Smalltalk), but referring to a
class-side instance variable named "masses". The clue to this would have
been that when you tried to compile the method, a dialog came up telling you
about the undeclared variable. You seem to have clicked through choosing to
create a variable, which you can now see in the class-side class definition:
 IntComputer class
instanceVariableNames: 'masses'

Probably you forgot to add "computer" before "masses", like so: `computer
readRam: computer masses.`

For future exploration, there are some design smells in your code, but it
seems like you're currently at the "get it to work" stage, so it seems
premature to dive into them here.

NB: It will be much easier to help you in the future, if you include both of
the following in your questions:
1. the exact error
2. "steps to reproduce"

IOW in this case, something like: "I'm seeing '#splitOn: was sent to nil'
from IntComputer class>>#readRam:. To reproduce, do `IntComputer solution`"

This way we don't have to go hunting for an entry point, which will stop
many (busy) people from even trying!



-
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--- End Message ---


[Pharo-users] How can we celebrate the 50th anniversary of Smalltalk?

2020-01-01 Thread Richard Kenneth Eng
https://medium.com/@richardeng/how-can-we-celebrate-the-50th-anniversary-of-smalltalk-e6b35dbc09a9


Re: [Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-01 Thread Pierce Ng
On Wed, Jan 01, 2020 at 02:35:03PM +0100, Tim Mackinnon wrote:
> I’m curious why you chose to use ffi for this one in particular as it
> would seem to be quite straightforward to do it all in native
> Smalltalk (not to down play your integration in any way of course).
> Was performance a big thing? Or was it simply relying on others to
> keep it up to date?

I wanted something that works out of the box. I did not want to
implement MD parsing myself.

Also I saw hoedown's wiki page on bindings and thought I'd put Smalltalk
on the map there.

  https://github.com/hoedown/hoedown/wiki/Bindings

Pierce