From 4a2367e7918455ab4669c200f1a30197f539ebfb Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Wed, 1 Dec 2010 17:36:28 +0100 Subject: [PATCH] Better init file --- .gitignore | 2 + Rules | 24 +++---- config.rb | 10 +++ config.yaml | 4 ++ content/html/index.erb | 138 +++++++++++++++++++++++++++++++++++++++++ layouts/default.html | 12 ++-- lib/html.rb | 3 +- lib/multi.rb | 4 +- lib/multiMenu.rb | 11 ++-- lib/nanoc_item_conf.rb | 7 ++- 10 files changed, 184 insertions(+), 31 deletions(-) create mode 100644 config.rb create mode 100644 content/html/index.erb diff --git a/.gitignore b/.gitignore index 8b6742f29..403289dd8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ output/Scratch/fr output/Scratch/en output/Scratch/assets output/Scratch/sitemap.xml +output/index.html tmp/ recupen.pl recupfr.pl +.sass-cache diff --git a/Rules b/Rules index 5a0980e58..fd19960a0 100644 --- a/Rules +++ b/Rules @@ -16,23 +16,6 @@ end route '/css/*' do '/Scratch/assets' + item.identifier.chop + '.css' end -# compile '/css/*', :rep => :mozilla do -# filter :mozilla -# filter :sass -# filter :rainpress -# end -# route '/css/*', :rep => :mozilla do -# '/Scratch/assets' + item.identifier.chop + '_mozilla.css' -# end -# compile '/css/*', :rep => :webkit do -# filter :webkit -# filter :sass -# filter :rainpress -# end -# route '/css/*', :rep => :webkit do -# '/Scratch/assets' + item.identifier.chop + '_webkit.css' -# end - compile '/img/*' do end route '/img/*' do @@ -52,6 +35,13 @@ route '/js/*' do '/Scratch/assets' + item.identifier.chop + '.js' end +compile '/html' do + filter :erb + layout 'default' unless item[:layout] == "none" +end +route '/html' do + '/index.html' +end compile '/html/*' do # item[:extension] returns 'html.erb' for multi-dotted filename diff --git a/config.rb b/config.rb new file mode 100644 index 000000000..79c467ae7 --- /dev/null +++ b/config.rb @@ -0,0 +1,10 @@ +http_path = "/" +project_path = "." +sass_dir = "compass" +css_dir = "output/Scratch/assets/css" +images_dir = "output/Scratch/assets/img" + +# wehn using SCSS: +sass_options = { + :syntax => :scss +} diff --git a/config.yaml b/config.yaml index d39ce2841..47a40d1b8 100644 --- a/config.yaml +++ b/config.yaml @@ -5,8 +5,12 @@ data_sources: type: filesystem_unified output_dir: output ultraviolet_theme: "twilight" +webprefix: "/Scratch" base_url: "http://yannesposito.com" author_uri: "http://yannesposito.com" +rss_uri: + fr: "http://feeds.feedburner.com/yannespositocomfr" + en: "http://feeds.feedburner.com/yannespositocomen" # les langues languages: diff --git a/content/html/index.erb b/content/html/index.erb new file mode 100644 index 000000000..417e19f80 --- /dev/null +++ b/content/html/index.erb @@ -0,0 +1,138 @@ +--- +title: Yann Esposito +noSubMenu: true +no_entete: true +--- +<% content_for :title do %> + + Yann + Esposito + +<% end %> +<% content_for :subtitle do %> + Yogsototh +<% end %> + +
English
+
+
+

+ + Blog + » + +

+

+ Computer, Philosophy & Life. +

+
+
+

+ + Softwares + » + +

+

+ Password Manager, + Screensavers & + Scientific Applications. +

+
+
+

+ Contact + » + +

+

+ Don't be shy, I'll be happy to talk to you. +

+ +
+
+
+
Français
+
+
+

+ + Blog + » + +

+

+ Ordinateurs, philosophie & des choses de la vie. +

+
+
+

+ + Logiciels + » + +

+

+ Des économiseurs d'écran, + un gestionnaire de mots de passe & + des applications scientifiques. +

+
+
+

+ + Contact + » + +

+

+ Au diable la timidité, n'hésitez pas à me contacter, je serai ravi de vous parler. +

+
+
+
+

+ + Curriculum Vitæ + » + +

+

+ Doctorat → Post Doc → Consultant
+ Geek → G33K → G33|< + +

+ +
+
+

+ + Enseignement + » + +

+

+ Informatique:
+ TD, TD & solutions
+ BAC+1 à BAC+5
+ Projet réseau anonyme + » + +

+
+
+

+ + Photos + » + +

+

+ + Cliquez ici pour avoir le mot de passe. + » + +

+
+
+ diff --git a/layouts/default.html b/layouts/default.html index 4fe0b6825..6bb00536e 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -9,7 +9,7 @@ <%= meta_tags %> - + <%= meta_alternate %> @@ -23,6 +23,7 @@
+ <% unless @item[:no_entete] %>
<%= choixrss %>
@@ -32,14 +33,15 @@
+ <% end %> Presentation drawing

- <%= @item[:title] %> + <%= @item[:content_for_title].nil? ? @item[:title] : @item[:content_for_title] %>

- <% unless @item[:subtitle].nil? %> + <% unless @item[:subtitle].nil? and @item[:content_for_subtitle].nil? %>

- <%= @item[:subtitle] %> + <%= @item[:content_for_subtitle].nil? ? @item[:subtitle] : @item[:content_for_subtitle] %>

<% end %>
@@ -59,7 +61,9 @@
<%= yield %> + <% unless @item[:no_entete] %> + <% end %>
diff --git a/lib/html.rb b/lib/html.rb index e218bc6ba..683b2b29f 100644 --- a/lib/html.rb +++ b/lib/html.rb @@ -17,8 +17,7 @@ def meta_alternate end def choixrss - rssurl=%{http://feeds.feedburner.com/yannespositocom#{ @conf.language }} - return %{#{ tradOf(:subscribe) }} + return %{#{ tradOf(:subscribe) }} end def choixlang diff --git a/lib/multi.rb b/lib/multi.rb index ff5556ac3..e4ea5dc40 100644 --- a/lib/multi.rb +++ b/lib/multi.rb @@ -1,7 +1,5 @@ def tradOf(keyword) - language=@item.path - language.match('/Scratch/(..)') - language=$1 + language=@conf.language tradOfKeywordIn(keyword, language ) end diff --git a/lib/multiMenu.rb b/lib/multiMenu.rb index aacb46840..c70030389 100644 --- a/lib/multiMenu.rb +++ b/lib/multiMenu.rb @@ -1,6 +1,6 @@ def homepage @items.find do |i| - i.reps[0].path == %{/Scratch/#{@conf.language}/} + i.reps[0].path == %{#{@config[:webprefix]}/#{@conf.language}/} end end @@ -11,6 +11,9 @@ end def generateMenu home=homepage + if home.nil? + return '' + end liste=[] liste<<=link_to_unless_current(home[:title],home.reps[0]) sortedChildrenByMenuPriority(home).each do |page| @@ -105,7 +108,7 @@ def blogimage(val,title="no name", divclass=nil) else imgpath=@item.path end - imgpath=imgpath.sub(%r{/Scratch/../},'/Scratch/img/')+val + imgpath=imgpath.sub(%r{#{@config[:webprefix]}/../},@config[:webprefix]+'/img/')+val if not divclass.nil? cls=%{ class="#{divclass}"} end @@ -117,8 +120,8 @@ def leftblogimage(val,title="no name") end def lnkto(title,item) - language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'') - link_to(title, "/Scratch/#{language}"+item) + language=@item_rep.path.sub(/#{@config[:webprefix]}\//,'').sub(/\/.*$/,'') + link_to(title, "#{@config[:webprefix]}/#{language}"+item) end def nextFor(page) diff --git a/lib/nanoc_item_conf.rb b/lib/nanoc_item_conf.rb index c54f887d4..477c51add 100644 --- a/lib/nanoc_item_conf.rb +++ b/lib/nanoc_item_conf.rb @@ -15,7 +15,12 @@ def setItemConf # -- init variables -- conf=LocalConf.new language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'') - conf.language=language + if language != '' + conf.language=language + else + conf.language='en' + language=conf.language + end # the current item is an article article=( ( not @item[:kind].nil? ) && @item[:kind] == 'article' )