Utilisateur:ZX81-bot/Journaux/2007061700
Début : 17/06/2007 19:24:16
Fin : 17/06/2007 20:44:11
Historique : Special:Contributions/ZX81-bot
Mode : semi-automatique
Outil utilisé : AutoWikiBrowser version 3.9.2.0
Options AWB activées :
- Apply general fixes
- Unicodify whole article
Module activé :
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
string[] AddCategories = new string[] { };
string[] DelCategories = new string[] { };
string[] ReplaceCategories = new string[] { "Sorcière fictive|Magicien ou sorcier de fiction" };
Skip = false;
Summary = "";
string ArticleTextOld;
ArticleText = Regex.Replace(ArticleText,
@"(?<=\[\[)[ _]*" +
@"(?:" + Variables.LangCode.ToString().ToLower() + @"[ _]*:[ _]*)?" +
@"(?:Category|" + Variables.Namespaces[14].Replace(":", "") + @")[ _]*:[ _]*" +
@"(?=[^\]]+\]\])",
Variables.Namespaces[14], RegexOptions.IgnoreCase);
ArticleText = Regex.Replace(ArticleText,
@"(?<=\[\[" +
Variables.Namespaces[14] +
@")\p{Ll}",
new MatchEvaluator(UpFirstChar));
ArticleTextOld = ArticleText;
string category;
if (AddCategories.Length > 0)
{
foreach (string cat in AddCategories)
{
category = cat;
if (!Regex.IsMatch(ArticleText, @"\[\[" + Variables.Namespaces[14] + category.Replace(" ", "[ _]+") + @"[ _]*(?:\|[^\]]*)?\]\]"))
{
category = "[[" + Variables.Namespaces[14] + cat + "]]";
if (ArticleTitle.StartsWith(Variables.Namespaces[10]))
ArticleText += "<noinclude>" + category + "</noinclude>";
else
ArticleText += "\r\n" + category;
Summary += ", ajout " + category;
}
}
}
if (DelCategories.Length > 0)
{
foreach (string cat in DelCategories)
{
category = cat;
if (Regex.IsMatch(ArticleText, @"\[\[" + Variables.Namespaces[14] + category.Replace(" ", "[ _]+") + @"[ _]*(?:\|[^\]]*)?\]\]"))
{
ArticleText = Regex.Replace(ArticleText,
@"\[\[" + Variables.Namespaces[14] +
category.Replace(" ", "[ _]+") +
@"[ _]*(?:\|[^\]]*)?\]\]\s*",
"",
RegexOptions.Singleline);
Summary += ", suppr. [[" + Variables.Namespaces[14] + cat + "]]";
}
}
}
if (ReplaceCategories.Length > 0)
{
foreach (string cat in ReplaceCategories)
{
category = cat;
string[] categories = cat.Split (new char[] { '|' });
if (Regex.IsMatch(ArticleText, @"\[\[" + Variables.Namespaces[14] + categories[0].Replace(" ", "[ _]+") + @"[ _]*(?:\|[^\]]*)?\]\]"))
{
ArticleText = Regex.Replace(ArticleText,
@"(?<=\[\[" + Variables.Namespaces[14] + @")" +
categories[0].Replace(" ", "[ _]+") +
@"[ _]*(?=(?:\|[^\]]*)?\]\])",
categories[1]);
Summary += ", rempl. cat. : [[" + Variables.Namespaces[14] + categories[0] + "]]"
+ " → [[" + Variables.Namespaces[14] + categories[1] + "]]";
}
}
}
if (ArticleText == ArticleTextOld)
{
Skip = true;
return ArticleText;
}
Match match;
string key;
if (!Regex.IsMatch(ArticleText, @"\{\{[ _]*DEFAULTSORT[ _]*:[^\}]*\}\}"))
{
match = Regex.Match(ArticleText, @"\[\[Catégorie:[^\|\]]+\|((?:[^,\]]+(?=,)|[^\]]{2,})(?:, *[^\]]+)?)\]\]");
if (!match.Success)
{
key = CleanKey(Tools.MakeHumanCatKey(ArticleTitle));
}
else
{
key = CleanKey(match.Groups[1].Value);
}
ArticleText = Regex.Replace(ArticleText,
@"(\[\[Catégorie:[^\]]+\]\].*)",
"{{DEFAULTSORT:" + key + "}}\n$1",
RegexOptions.Singleline);
ArticleText = Regex.Replace(ArticleText,
@"(?<=\[\[Catégorie:[^\|\]]+)\|[^\]]{2,}(?=\]\])",
"");
}
else
{
ArticleText = Regex.Replace(ArticleText,
@"(?<=\{\{)[ _]*DEFAULTSORT[ _]*:[ _]*([^\}]*?)[ _]*(?=\}\})",
new MatchEvaluator(Key),
RegexOptions.IgnoreCase);
ArticleText = Regex.Replace(ArticleText,
@"(?<=\{\{DEFAULTSORT:[^\}]*\}\})\s*(?=\[\[" +
Variables.Namespaces[14] +
@")",
"\r\n",
RegexOptions.Singleline);
}
return ArticleText;
}
private string UpFirstChar(Match m)
{
return m.Value.ToUpper();
}
private string CleanKey(string key)
{
key = Regex.Replace(key.Replace("_"," "), @" +", " ");
string[] tr1 = new string[48] { "0⅛¼⅜⅝⅞½¾٠۰", "1١۱", "2٢۲", "3٣۳", "4٤۴", "5٥۵", "6٦۶", "7٧۷", "8٨۸", "9٩۹", "aáàâãäåăąā", "AÁÀÂÃÄÅĂĄĀ", "cçćĉčċ", "CÇĆĈČĊ", "dðďđ", "DÐĎĐ", "eéèêëěėęē", "EÉÈÊËĚĖĘĒ", "gğĝġģ", "GĞĜĠĢ", "hĥħ", "HĤĦ", "iíìîïıĩįī", "IÍÌÎÏİĨĮĪ", "jĵ", "JĴ", "kĸķ", "KĶ", "lĺľłļŀ", "LĹĽŁĻĿ", "nñʼnńňņ", "NÑŃŇŅ", "oóòôõöøőō", "OÓÒÔÕÖØŐŌ", "rŕřŗ", "RŔŘŖ", "sśŝšş", "SŚŜŠŞ", "tťŧţ", "TŤŦŢ", "uúùûüŭůűũųū", "UÚÙÛÜŬŮŰŨŲŪ", "wŵ", "WŴ", "yýÿŷ", "YÝŶŸ", "zźžż", "ZŹŽŻ" };
string[] tr2 = new string[8] { "aeæ", "AEÆ", "oeœ", "OEŒ", "ssß", "ijij", "ngŋ", "NGŊ" };
foreach (string t in tr1)
{
key = Regex.Replace(key, @"[" + t.Substring(1) + @"]", t.Substring(0, 1));
}
foreach (string t in tr2)
{
key = Regex.Replace(key, @"[" + t.Substring(2) + @"]", t.Substring(0, 2));
}
return key;
}
private string Key(Match m)
{
return "DEFAULTSORT:" + CleanKey(m.Groups[1].Value);
}
Articles modifiés :
- 17/06/2007 19:24:16 Amy Madison (diff • hist • modif)
- 17/06/2007 20:30:44 Andromeda Tonks (diff • hist • modif)
- 17/06/2007 20:31:10 Dolores Ombrage (diff • hist • modif)
- 17/06/2007 20:31:30 Fée Morgane (diff • hist • modif)
- 17/06/2007 20:31:56 Ginny Weasley (diff • hist • modif)
- 17/06/2007 20:32:07 Lily Potter (diff • hist • modif)
- 17/06/2007 20:36:05 Madame Rosmerta (diff • hist • modif)
- 17/06/2007 20:36:30 Maléfique (personnage) (diff • hist • modif)
- 17/06/2007 20:37:04 Minerva McGonagall (diff • hist • modif)
- 17/06/2007 20:37:15 Miss Tick (diff • hist • modif)
- 17/06/2007 20:37:33 Molly Weasley (diff • hist • modif)
- 17/06/2007 20:39:32 Narcissa Malefoy (diff • hist • modif)
- 17/06/2007 20:39:51 Nounou Ogg (diff • hist • modif)
- 17/06/2007 20:40:26 Nurse Witch Komugi (diff • hist • modif)
- 17/06/2007 20:40:46 Nymphadora Tonks (diff • hist • modif)
- 17/06/2007 20:41:05 Olympe Maxime (diff • hist • modif)
- 17/06/2007 20:42:30 Paige Matthews (diff • hist • modif)
- 17/06/2007 20:42:47 Rita Skeeter (diff • hist • modif)
- 17/06/2007 20:42:59 Serafina Pekkala (diff • hist • modif)
- 17/06/2007 20:43:16 Sibylle Trelawney (diff • hist • modif)
- 17/06/2007 20:43:32 Tara Maclay (diff • hist • modif)
- 17/06/2007 20:43:57 Will Vandom (diff • hist • modif)
- 17/06/2007 20:44:11 Willow Rosenberg (diff • hist • modif)
Articles non modifiés :