Contenu supprimé Contenu ajouté
Raoli (discussion | contributions)
Page créée avec « {{Bienvenue|~~~~}} »
 
Mmenal (discussion | contributions)
→‎RimBot : nouvelle section
Ligne 1 :
{{Bienvenue|[[Utilisateur:Raoli|Raoli]] ([[Discussion utilisateur:Raoli|discussion]]) 3 avril 2012 à 02:12 (CEST)}}
 
== [[Utilisateur:RimBot|RimBot]] ==
 
Hello,
 
You can find the code on [[Utilisateur:RimBot/count-quotes.py]]. As you can see on any article on fr.wikiquote, we use the {{m|citation}} template to enclose quotes. This makes the article a bit harder to edit, but we can change the quote formatting with a simple template modification.
 
count-quotes.py parses the articles (see the workon() method), looking for the quote template ({{m|citation}} in fr.wikiquote). Every quote is then parsed (known formatting templates are stripped etc., see parse_templates()), stripped of any non-alphanumeric characters and stored in a dictionary (globalvar.quotes), the key being a hashed version of the stripped quote. When all articles have been parsed, it removes duplicates (using the hashes, see generate_output()) and generate the output (either the number of quotes, the number of pages with at least one quote, or a full fledged statistics page).
 
I wrote this code quite a long time ago, and a good cleanup would be necessary. But it still works anyway, so if you want to use it, feel free. Unfortunately my server has been down for a few days due to networking operator problems, but I can add other wikis to RimBot when it's back on.
 
Feel free to ask any further question if you have trouble understanding the code. [[Utilisateur:Mmenal|Manuel Menal]] ([[Discussion utilisateur:Mmenal|discussion]]) 4 avril 2012 à 22:00 (CEST)