diff --git a/content/css/gen.css b/content/css/gen.css index 565d4b578..b9f501661 100644 --- a/content/css/gen.css +++ b/content/css/gen.css @@ -509,3 +509,6 @@ hr #menuMessage +smallblock +downsmallround + +#content > .date + :color = !blanc_fonce diff --git a/content/html/en/index.erb b/content/html/en/index.erb index 9934ff0c5..726ea3abc 100644 --- a/content/html/en/index.erb +++ b/content/html/en/index.erb @@ -1,40 +1,27 @@ ----- -# Built-in -filters_pre: - - erb - - bluecloth - -# Custom -# menu title: Welcome -multiTitle: - fr: Bienvenue - en: Welcome - noSubMenu: true ----- -Hello and welcome on my personnal website. This is mainly my blog. - -Here are an exerpt of the last 5 articles - - - <% number_of_articles=5 + number_of_char_for_resume=800 language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'') last_articles = articles.select do |a| a.reps[0].path =~ /\/#{language}\// - end.sort { |x,y| x[:created_at] <=> y[:created_at] }[0..(number_of_articles-1)] + end + last_articles=last_articles.sort { |x,y| y[:created_at] <=> x[:created_at] }[0..(number_of_articles-1)] %> + +

Welcome on my personnal website.

+ +

Here are my <%= number_of_articles %> last posts begining.

+ +
+

† approximatively the <%= number_of_char_for_resume %> first characters.

+ <% last_articles.each do |a| %> - <% puts @config[:dateFormat].to_s %> - <% puts language %> - <% puts @config[:dateFormat][language.intern] %>

<%= a[:created_at].strftime( @config[:dateFormat][language.intern] ) %> <%= link_to(a[:title], a) %>

-
- <%= excerptize( a.reps[0].compiled_content, {:length => 500} ) %> -
- + <%= repair_html ( excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume} ) ) %> <% end %> diff --git a/content/html/fr/index.erb b/content/html/fr/index.erb index d8d96e74c..cde0285b2 100644 --- a/content/html/fr/index.erb +++ b/content/html/fr/index.erb @@ -1,39 +1,27 @@ ----- -# Built-in -filters_pre: - - erb - - bluecloth - -# Custom -# menu -title: Welcome -multiTitle: - fr: Bienvenue - en: Welcome - +title: Bienvenue noSubMenu: true ----- -Bonjour et bienvenue sur mon site personnel. Je l'utilise principalement comme -plateforme de blog. - -Trouvez ici le résumé de mes cinq dernières entrées de blog. - <% number_of_articles=5 + number_of_char_for_resume=800 language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'') last_articles = articles.select do |a| a.reps[0].path =~ /\/#{language}\// - end.sort { |x,y| x[:created_at] <=> y[:created_at] }[0..(number_of_articles-1)] + end + last_articles=last_articles.sort { |x,y| y[:created_at] <=> x[:created_at] }[0..(number_of_articles-1)] %> + +

Bonjour et bienvenue sur mon site personnel.

+ +

Voici un aperçu de mes <%= number_of_articles %> derniers articles.

+ +
+

† approximativement les <%= number_of_char_for_resume %> premiers caractères.

+ <% last_articles.each do |a| %> - <% puts @config[:dateFormat].to_s %> - <% puts language %> - <% puts @config[:dateFormat][language.intern] %>

<%= a[:created_at].strftime( @config[:dateFormat][language.intern] ) %> <%= link_to(a[:title], a) %>

-
- <%= excerptize( a.reps[0].compiled_content, {:length => 500} ) %> -
- + <%= repair_html ( excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume} ) ) %> <% end %> diff --git a/lib/repair_html.rb b/lib/repair_html.rb new file mode 100644 index 000000000..9db05762e --- /dev/null +++ b/lib/repair_html.rb @@ -0,0 +1,26 @@ +# All files in the 'lib' directory will be loaded +# before nanoc starts compiling. + +# repair cutted XML code by closing the tags +# work even if the XML is cut into a tag. +# example: +# transform '
toto

hello ' + depth.to_s + puts 'parents='+parents.join('; ') + else + depth-=1 + puts '<'+m[0]+m[1]+'> ' + depth.to_s + end + end + res=html.sub(/<[^>]*$/m,'') + depth.downto(0).each { |x| res<<= %{} } + res +end