diff --git a/README.md b/README.md index 56691d160..5f561116a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ What you'll need to use it: - [nanoc](nanoc.stoneship.org) → `gem install nanoc` - [zsh](zsh.org) → Installed by default on most good system -- A bunch of gems: `gem install ultraviolet krambook sass rainpress` +- A bunch of gems: `gem install kramdown builder sass rainpress` Optionally diff --git a/Rules b/Rules index 7d0e49448..3778cec1a 100644 --- a/Rules +++ b/Rules @@ -51,6 +51,7 @@ compile '/html/*' do elsif ext == 'haml' || ext.nil? filter :haml elsif ext == 'md' || ext == 'markdown' + filter :code filter :graph filter :description filter :falacy diff --git a/lib/ultraviolet.rb b/lib/ultraviolet.rb index 2ee4ce2da..fd7b0e307 100644 --- a/lib/ultraviolet.rb +++ b/lib/ultraviolet.rb @@ -1,7 +1,7 @@ class UltraVioletFilter < Nanoc3::Filter - identifier :ultraviolet + identifier :code - def protect(str) + def protect(str) str.gsub(%r{<([^>]*)>}) do "<#{$1}>" end @@ -33,4 +33,4 @@ class UltraVioletFilter < Nanoc3::Filter FileUtils.mkdir_p code_path File.open(%{#{code_path}/#{@filename}}, 'w'){|f|f.write(@code)} end -end +end diff --git a/output/Scratch/assets/css/cmufontface.css b/output/Scratch/assets/css/cmufontface.css new file mode 100644 index 000000000..a0af38613 --- /dev/null +++ b/output/Scratch/assets/css/cmufontface.css @@ -0,0 +1 @@ +@font-face{font-family:"cmuntt";src:url("fonts/cmuntt.eot");src:local("☺"),url("fonts/cmuntt.svg") format("svg"),url("fonts/cmuntt.ttf") format("truetype");font-weight:400;font-style:normal}@font-face{font-family:"ComputerModern";src:url("fonts/cmunrb.eot");src:local("☺"),url("fonts/cmunrb.svg") format("svg"),url("fonts/cmunrb.ttf") format("truetype");font-weight:700}@font-face{font-family:"ComputerModern";src:url("fonts/cmunsl.eot");src:local("☺"),url("fonts/cmunsl.svg") format("svg"),url("fonts/cmunsl.ttf") format("truetype");font-style:italic,oblique}@font-face{font-family:"ComputerModern";src:url("fonts/cmunrm.eot");src:local("☺"),url("fonts/cmunrm.svg") format("svg"),url("fonts/cmunrm.ttf") format("truetype");font-weight:400;font-style:normal} \ No newline at end of file diff --git a/output/Scratch/assets/css/main2.css b/output/Scratch/assets/css/main2.css new file mode 100644 index 000000000..5a12875e6 --- /dev/null +++ b/output/Scratch/assets/css/main2.css @@ -0,0 +1 @@ +@import url(/Scratch/assets/css/cmufontface.css);body{font-family:"Futura",serif;font-size:20px;color:#fdf6e3;background:#073642}a,a:link,a:visited,a:active,a:hover{color:#002b36;text-decoration:none;outline:none}a:hover{color:#cb4b16}hr{color:#eee8d5;border-top:1px solid #eee8d5;border-bottom:none;border-left:none;border-right:none}ul{list-style:none;padding-left:0;margin-left:1.5ex;text-indent:-1.5ex}ol{padding-left:0}ul li:before{content:"- "}ol li ul,ol li ol,ul li ol,ul li ul{margin:.5em 1.5em;list-style:none}li p,ol p{display:inline;padding:0}table tr:nth-child(odd){background-color:#fdf6e3}table{border-top:solid 2px #eee8d5;border-bottom:solid 2px #eee8d5}body{text-rendering:optimizelegibility;line-height:1.5em}h1,h2,h3,h4,h5,h6{color:#002b36;line-height:1.1em;padding-left:30px}.article #afterheader{counter-reset:niv02}.article #afterheader h2{counter-increment:niv02;counter-reset:niv03;marker-offset:3em}.article #afterheader h2:before{content:counter(niv02) ". "}.article #afterheader h3{counter-increment:niv03;counter-reset:niv04}.article #afterheader h3:before{content:counter(niv02) "." counter(niv03) ". "}.article #afterheader h4{counter-increment:niv04}.article #afterheader h4:before{content:counter(niv02) "." counter(niv03) "." counter(niv04) ". "}p,ul,ol,h1,h2,h3,h4{margin-bottom:30px;padding:0 30px;text-align:justify}pre{line-height:1.1em;margin-bottom:30px;padding:30px;overflow:auto;background:#fdf6e3;font-size:18px}abbr,acronym{text-transform:uppercase;font-size:.8em;text-decoration:none;border-bottom-width:0}.small{font-size:.8em}.sc{text-transform:uppercase;font-size:.8em}.clear,.flush{clear:both}.impact,.darkimpact{font-size:2em;margin:0 auto 1em auto;line-height:1.3em}figure{margin:3em 0}figure img{box-shadow:0 10px 15px#ccc inset}figure figcaption{text-align:center;margin:.5em 0}figure.left,figure.right{max-width:30%}#afterheader{color:#586e75;background-color:#fffff8}.intro,.resume,blockquote{font-style:italic;padding:.5em 1em}.intro a:hover,.resume a:hover,blockquote a:hover{color:#cb4b16}.intro i,.intro em,.resume i,.resume em,blockquote i,blockquote em{font-style:normal}.intro strong,.intro b,.resume strong,.resume b,blockquote strong,blockquote b{font-weight:400}.intro,.resume{font-size:.9em}blockquote{border:solid 1px #eee8d5;background-color:#fdf6e3}blockquote pre,blockquote pre code{background-color:#eee8d5}blockquote pre{border:solid 1px rgba(0,0,0,0.1)}blockquote ul{padding-left:1.5em}section.slide{border-color:#eee8d5;border:solid 1px;margin-bottom:1em;padding:.5em;font-family:sans-serif;font-size:.8em}.base03{color:#002b36}.base02{color:#073642}.base01{color:#586e75}.base00{color:#657b83}.base0{color:#839496}.base1{color:#93a1a1}.base2{color:#eee8d5}.base3{color:#fdf6e3}.yellow{color:#b58900}.orange{color:#cb4b16}.red{color:#dc322f}.magenta{color:#d33682}.violet{color:#6c71c4}.blue{color:#268bd2}.cyan{color:#2aa198}.green{color:#859900}#blackpage{font-family:sans-serif;font-style:italic;padding-top:8em;z-index:9000;cursor:wait}#blackpage img{background:none;border:none;max-width:80%;margin:0 auto}#blackpage a{cursor:pointer}.cut{font-size:.8em;text-align:right;display:inline-block;width:100%;opacity:.3}.cut:hover{opacity:1}#afterheader{width:35em;margin:0 auto}#afterheader img{width:100%}#afterheader img.left,#afterheader img.right{width:30%} \ No newline at end of file diff --git a/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html b/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html index f8432e3ec..56b075181 100644 --- a/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html +++ b/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html @@ -48,7 +48,7 @@
And you can see the intermediate steps to reach this goal:
- +From the 2nd section to the 4th it will be dirtier and dirtier. We start cleaning the code at the 5th section.
@@ -152,7 +152,7 @@ We start cleaning the code at the 5th section. The first being mostly some boilerplate2. And the second part more focused on OpenGL and content. -Well, if you download this file (look at the bottom of this section), compile it and run it this is the result:
- +A first very interesting property of this program is that the computation for all the points is done only once.
It is a bit long before the first image appears, but if you resize the window, it updates instantaneously.
This property is a direct consequence of purity.
If you look closely, you see that allPoints
is a pure list.
Therefore, calling allPoints
will always render the same result and Haskell is clever enough to use this property.
-While Haskell doesn’t garbage collect allPoints
the result is reused for free.
+While Haskell doesn’t garbage collect allPoints
the result is reused for free.
We did not specified this value should be saved for later use.
It is saved for us.
See what occurs if we make the window bigger:
- +We see some black lines because we have drawn less point than there is on the surface. We can repair this by drawing little squares instead of just points. @@ -565,7 +565,7 @@ maxZeroIndex func minval maxval n =
No rocket science here. See the result now:
- + -This code is cleaner but many things doesn’t feel right. +
This code is cleaner but many things doesn’t feel right. First, all the user interaction code is outside our main file. I feel it is okay to hide the detail for the rendering. But I would have preferred to control the user actions.
@@ -1271,12 +1271,12 @@ We will have two choices:Our main problem come from user interaction. -If you ask “the Internet”, +If you ask “the Internet”, about how to deal with user interaction with a functional paradigm, the main answer is to use functional reactive programming (FRP). -I won’t use FRP in this article. -Instead, I’ll use a simpler while less effective way to deal with user interaction. -But The method I’ll use will be as pure and functional as possible.
+I won’t use FRP in this article. +Instead, I’ll use a simpler while less effective way to deal with user interaction. +But The method I’ll use will be as pure and functional as possible.Here is a real working code, I’ve hidden most display functions. +
Here is a real working code, I’ve hidden most display functions. The YGL, is a kind of framework to display 3D functions. But it can easily be extended to many kind of representation.
@@ -1518,7 +1518,7 @@ idleAction tnew world = world {Now the function which will generate points in 3D.
The first parameter (res
) is the resolution of the vertex generation.
More precisely, res
is distance between two points on one direction.
-We need it to “close” our shape.
The type Function3D
is Point -> Point -> Maybe Point
.
Because we consider partial functions
@@ -1587,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
I won’t explain how the magic occurs here. +
I won’t explain how the magic occurs here.
If you are interested, just read the file YGL.hs
.
It is commented a lot.
Our code architecture feel very clean.
All the meaningful code is in our main file and all display details are
externalized.
-If you read the code of YGL.hs
, you’ll see I didn’t made everything perfect.
-For example, I didn’t finished the code of the lights.
+If you read the code of YGL.hs
, you’ll see I didn’t made everything perfect.
+For example, I didn’t finished the code of the lights.
But I believe it is a good first step and it will be easy to go further.
Unfortunately the program of the preceding session is extremely slow.
We compute the Mandelbulb for each frame now.
As we can use imperative style in a functional language, know you can use functional style in imperative languages. This article exposed a way to organize some code in a functional way. -I’d like to stress the usage of Haskell made it very simple to achieve this.
+I’d like to stress the usage of Haskell made it very simple to achieve this.Once you are used to pure functional style, it is hard not to see all advantages it offers.
The code in the two last sections is completely pure and functional.
-Furthermore I don’t use GLfloat
, Color3
or any other OpenGL type.
+Furthermore I don’t use GLfloat
, Color3
or any other OpenGL type.
If I want to use another library in the future,
I would be able to keep all the pure code and simply update the YGL module.
The YGL
module can be seen as a “wrapper” around 3D display and user interaction.
+
The YGL
module can be seen as a “wrapper” around 3D display and user interaction.
It is a clean separator between the imperative paradigm and functional paradigm.
If you want to go further, it shouldn’t be hard to add parallelism. +
If you want to go further, it shouldn’t be hard to add parallelism. This should be easy mainly because most of the visible code is pure. Such an optimization would have been harder by using directly the OpenGL library.
@@ -1915,7 +1915,7 @@ O(n².log(n)) to O(n³).Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil
. But even a minimal program who simply write some jpg
didn’t worked. I tried both with Haskell
and C
.↩
Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil
. But even a minimal program who simply write some jpg
didn’t worked. I tried both with Haskell
and C
.↩
Generally in Haskell you need to declare a lot of import lines. @@ -2010,10 +2010,14 @@ O(n².log(n)) to O(n³).
next entries + +tlàl : Un exemple progressif d’utilisation d’Haskell. +
tlàl : Un exemple progressif d’utilisation d’Haskell. Vous pourrez voir un ensemble de Mandelbrot étendu à la troisième dimension. De plus le code sera très propre. Les détails de rendu sont séparés dans un module externe. @@ -67,7 +67,7 @@ Vous pouvez vous inspirer de ce code utilisant le paradigme fonctional dans tous
And you can see the intermediate steps to reach this goal:
- +From the 2nd section to the 4th it will be dirtier and dirtier. We start cleaning the code at the 5th section.
@@ -152,7 +152,7 @@ We start cleaning the code at the 5th section. The first being mostly some boilerplate2. And the second part more focused on OpenGL and content. -Well, if you download this file (look at the bottom of this section), compile it and run it this is the result:
- +A first very interesting property of this program is that the computation for all the points is done only once.
It is a bit long before the first image appears, but if you resize the window, it updates instantaneously.
This property is a direct consequence of purity.
If you look closely, you see that allPoints
is a pure list.
Therefore, calling allPoints
will always render the same result and Haskell is clever enough to use this property.
-While Haskell doesn’t garbage collect allPoints
the result is reused for free.
+While Haskell doesn’t garbage collect allPoints
the result is reused for free.
We did not specified this value should be saved for later use.
It is saved for us.
See what occurs if we make the window bigger:
- +We see some black lines because we have drawn less point than there is on the surface. We can repair this by drawing little squares instead of just points. @@ -565,7 +565,7 @@ maxZeroIndex func minval maxval n =
No rocket science here. See the result now:
- + -This code is cleaner but many things doesn’t feel right. +
This code is cleaner but many things doesn’t feel right. First, all the user interaction code is outside our main file. I feel it is okay to hide the detail for the rendering. But I would have preferred to control the user actions.
@@ -1271,12 +1271,12 @@ We will have two choices:Our main problem come from user interaction. -If you ask “the Internet”, +If you ask “the Internet”, about how to deal with user interaction with a functional paradigm, the main answer is to use functional reactive programming (FRP). -I won’t use FRP in this article. -Instead, I’ll use a simpler while less effective way to deal with user interaction. -But The method I’ll use will be as pure and functional as possible.
+I won’t use FRP in this article. +Instead, I’ll use a simpler while less effective way to deal with user interaction. +But The method I’ll use will be as pure and functional as possible.Here is a real working code, I’ve hidden most display functions. +
Here is a real working code, I’ve hidden most display functions. The YGL, is a kind of framework to display 3D functions. But it can easily be extended to many kind of representation.
@@ -1518,7 +1518,7 @@ idleAction tnew world = world {Now the function which will generate points in 3D.
The first parameter (res
) is the resolution of the vertex generation.
More precisely, res
is distance between two points on one direction.
-We need it to “close” our shape.
The type Function3D
is Point -> Point -> Maybe Point
.
Because we consider partial functions
@@ -1587,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
I won’t explain how the magic occurs here. +
I won’t explain how the magic occurs here.
If you are interested, just read the file YGL.hs
.
It is commented a lot.
Our code architecture feel very clean.
All the meaningful code is in our main file and all display details are
externalized.
-If you read the code of YGL.hs
, you’ll see I didn’t made everything perfect.
-For example, I didn’t finished the code of the lights.
+If you read the code of YGL.hs
, you’ll see I didn’t made everything perfect.
+For example, I didn’t finished the code of the lights.
But I believe it is a good first step and it will be easy to go further.
Unfortunately the program of the preceding session is extremely slow.
We compute the Mandelbulb for each frame now.
As we can use imperative style in a functional language, know you can use functional style in imperative languages. This article exposed a way to organize some code in a functional way. -I’d like to stress the usage of Haskell made it very simple to achieve this.
+I’d like to stress the usage of Haskell made it very simple to achieve this.Once you are used to pure functional style, it is hard not to see all advantages it offers.
The code in the two last sections is completely pure and functional.
-Furthermore I don’t use GLfloat
, Color3
or any other OpenGL type.
+Furthermore I don’t use GLfloat
, Color3
or any other OpenGL type.
If I want to use another library in the future,
I would be able to keep all the pure code and simply update the YGL module.
The YGL
module can be seen as a “wrapper” around 3D display and user interaction.
+
The YGL
module can be seen as a “wrapper” around 3D display and user interaction.
It is a clean separator between the imperative paradigm and functional paradigm.
If you want to go further, it shouldn’t be hard to add parallelism. +
If you want to go further, it shouldn’t be hard to add parallelism. This should be easy mainly because most of the visible code is pure. Such an optimization would have been harder by using directly the OpenGL library.
@@ -1915,7 +1915,7 @@ O(n².log(n)) to O(n³).Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil
. But even a minimal program who simply write some jpg
didn’t worked. I tried both with Haskell
and C
.↩
Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil
. But even a minimal program who simply write some jpg
didn’t worked. I tried both with Haskell
and C
.↩
Generally in Haskell you need to declare a lot of import lines. @@ -2010,10 +2010,14 @@ O(n².log(n)) to O(n³).
articles suivants + +