From 1d1d04cb3cd7f38fe64202f5c98a026136bf12b5 Mon Sep 17 00:00:00 2001 From: pifou Date: Sat, 16 Jun 2007 11:49:03 +0000 Subject: [PATCH] FIX Correction de l'html dans le synopsis git-svn-id: svn://euphorik.ch/pompage@25 02bbb61a-6d21-0410-aba0-cb053bdfd66a --- css/yopyop.css | 67 +++++++++++++++++++++++++------------------------- src/film.rb | 25 ++++++++++++++----- xsl/yopyop.xsl | 25 +++++++++++-------- 3 files changed, 68 insertions(+), 49 deletions(-) diff --git a/css/yopyop.css b/css/yopyop.css index 5f5e1bf..bb631fd 100644 --- a/css/yopyop.css +++ b/css/yopyop.css @@ -5,7 +5,7 @@ } html { - background-color: #8DDD83; + background-color: #8DDD83; height: auto; font: normal 12pt Arial, Verdana, Helvetica, sans-serif; } @@ -37,19 +37,19 @@ body { } h1 { - font-size: 20pt; - font-style: italic; - font-weight: bold; - margin-left: 40px; + font-size: 20pt; + font-style: italic; + font-weight: bold; + margin-left: 40px; } td { - vertical-align:top; + vertical-align:top; } div.entete { width: 90%; - position: fixed; + position: fixed; z-index: 5; background-color: #65A35D; height: 50px; @@ -104,17 +104,17 @@ div.entete form button { } div.entete form p { - color: black; - font-size: 7pt; - margin-top: 1px; + color: black; + font-size: 7pt; + margin-top: 1px; } div.entete form p label { - margin-right: 4px; + margin-right: 4px; } div.entete form input[type='checkbox'] { - border:2px solid red; + border:2px solid red; } div.pied { @@ -140,35 +140,35 @@ table#liste { } table#liste .listeFichiers img { - position: absolute; + position: absolute; left: -9px; top: -18px; } table#liste td { - background-color: #7BC671; + background-color: #7BC671; color: #20531A; - padding: 3px; + padding: 3px; } table#liste td.titre { - font-weight: bold; - cursor: pointer; + font-weight: bold; + cursor: pointer; } table#liste td.annee { - text-align: right; - width: 50px; + text-align: right; + width: 50px; } table#liste td.duree { - text-align: right; - width: 80px; + text-align: right; + width: 80px; } table#liste td.lien { - text-align: center; - width: 15px; + text-align: center; + width: 15px; } table#liste td.lien div { @@ -194,8 +194,8 @@ table#liste td.lien a:hover { } table#liste td.fichier { - text-align: center; - width: 12px; + text-align: center; + width: 12px; } table#liste td.fichier div { @@ -269,28 +269,29 @@ table#liste td.fichier div ul:hover li:first-child { }*/ table#liste td.titre:hover { - background-color: #B1F1A9; - padding: 3px; + background-color: #B1F1A9; + padding: 3px; } table#liste td.detail { - background-color: #8DDD83; - padding: 0px 0px 0px 0px; + background-color: #8DDD83; + padding: 0px 0px 0px 0px; } table#liste table.detail { - display:none; + display:none; + width:100%; padding-bottom: 10px; - border-spacing: 0px 0px; + border-spacing: 0px 0px; } table#liste table.detail td { - padding: 3px; + padding: 3px; background-color: #B1F1A9; } table#liste table.detail td.titreDetail { - font-weight: bold; + font-weight: bold; } diff --git a/src/film.rb b/src/film.rb index c97e518..21c27cb 100644 --- a/src/film.rb +++ b/src/film.rb @@ -1,3 +1,5 @@ +# Attention, le but de ce fichier n'est pas d'être le plus clair possible ^-^´´ + require 'rexml/document' require 'net/http' require 'thread' @@ -12,7 +14,10 @@ require 'constantes.rb' class String def virerBalisesHTML - return self.gsub(/<(.*?)>/, '') + return gsub(/<(.*?)>/, '') + end + def virerBalisesHTML! + gsub!(/<(.*?)>/, '') end end @@ -262,7 +267,7 @@ public @aPlusieursReponses = false # pour faire les choses bien - puts @fichiers[0] + puts " -> " + @fichiers[0] puts "Fais ton choix jeune padawan (un caractère et pas plus)" tabNoms = @idsAllocine.keys choix = 1 @@ -355,12 +360,12 @@ public #// =~ donneesHtml #r = donneesHtml.scan(/(.*?)<\/a>/) - r = donneesHtml.scan(/(.*?)<\/a>(?:<\/h4>
 (.*?)<\/h5>){0,1}/) + r = donneesHtml.scan(/(.*?)<\/a>(?:<\/h4>
 (.*?)<\/h5>){0,1}(?:


<\/h4>){0,1}(?:

de (.*?)<\/h4>){0,1}(?:

 avec (.*?)<\/h4>){0,1}(?:

 \((.*?)\)<\/h4>){0,1}/) if r.length > 1 @aPlusieursReponses = true r.each{|f| - @idsAllocine[f[1].virerBalisesHTML + (f[2] != nil ? " " + f[2].virerBalisesHTML : "")] = f[0] + @idsAllocine[f[1].virerBalisesHTML + (f[2] != nil ? " " + f[2].virerBalisesHTML : "") + (f[3] != nil ? " de " + f[3].virerBalisesHTML : "") + (f[4] != nil ? " avec " + f[4].virerBalisesHTML : "") + (f[5] != nil ? " (" + f[5].virerBalisesHTML + ")" : "")] = f[0] } elsif r.length == 1 loadDepuisIdAllocine(r[0][0], connexionHttp) @@ -434,8 +439,10 @@ private } unless $1.nil? # Synopsis - /Synopsis.*?

(.+?)<\/h4>/m =~ ficheHtml + /Synopsis.*?

(.*?)<\/h4>/m =~ ficheHtml @synopsis = $1 unless $1.nil? + @synopsis.gsub!(/|/, "\n") + @synopsis.virerBalisesHTML! # Budget /Budget<\/b> : (.+?) millions d'euros<\/h4>/ =~ ficheHtml @@ -488,7 +495,13 @@ public } racine.add(genres) - racine.add(REXML::Element::new('synopsis').add_text(@synopsis)) + synopsisElement = REXML::Element::new('synopsis') + @synopsis.split("\n").each{|s| + next if s =~ /^\s*$/ + synopsisElement.add(REXML::Element::new('p').add_text(s)) + } + racine.add(synopsisElement) + budgetElement = REXML::Element::new('budget') budgetElement.add_text(@budget) budgetElement.add_attribute('unite', @budgetUnite) diff --git a/xsl/yopyop.xsl b/xsl/yopyop.xsl index de0302a..5b22174 100644 --- a/xsl/yopyop.xsl +++ b/xsl/yopyop.xsl @@ -1,13 +1,16 @@  - + + DivX - + + +

DivX - TV

@@ -26,21 +29,19 @@

+
- - +
@@ -68,15 +69,19 @@ - +
-
-
Synopsis +

+
- - + +
-
+ +
+
-- 2.43.0