----- # Built-in # Custom kind: article title: An ultraviolet test multiTitle: en: Ultraviolet fr: Ultraviolet multiSubTitle: fr: les test du plugin ruby en: ruby plugin tests -----
#!/usr/bin/zsh
wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz
tar zxvf onig-5.9.1.tar.gz
cd onig-5.9.1
./configure
make
sudo make install
sudo gem install ultraviolet
['1','2','3'].each{ |x| puts 'chiffre '+x }
class UltraVioletFilter < Nanoc::Filter
identifier :ultraviolet
def run(content)
require 'rio'
require 'rubygems'
require 'uv'
code_rule = %r{((.+?)<}+%{/code>)}m
content.gsub!(code_rule) do |full|
# original, lang, filename, code = full[0], full[1], full[3], full[4]
original, lang, filename, code = $1, $2, $4, $5
if lang =~ /^(zsh|bash|sh|csh|shell)$/
lang='shell-unix-generic'
end
# Create a plaintext file version for download.
codeprefix=''
codesuffix=''
if filename
webpath = '/Scratch/multi'+@page.path
code_path = [@site.config[:output_dir], webpath, 'code']
url = webpath + 'code/' + filename
if (url == @url)
puts %{erreur de redo : #{url}}
break
end
@url=url
copy_text_to_file(code, filename, code_path)
codeprefix=%{\n}
codesuffix=%{\n}
end
# Substitute the un-highlighted code with the highlighted code.
codeprefix+Uv.parse(code, "xhtml", lang, false, @site.config[:ultraviolet_theme])+codesuffix
end
content
end
private
def copy_text_to_file(str, fname, dir)
if @page_rep.name == :default then
dest_rio = rio(dir).mkpath
frio = rio(dir, fname).delete
frio << str
puts "\t\twrote file #{dir}/#{fname}"
end
end
end
for fic in **/*(.); do
if [[ ! -x $fic ]]; then
chmod u+x $fic
fi
exec $fic
done