Usuário(a):GoEThe/Desambiguações

O código seguinte serve para formatar (parcialmente) as páginas de desambiguação segundo as recomendações usando o AWB. Caso comece a usar o código, por favor indique por que letra está a começar, para não haver sobreposição. Sinta-se à vontade de melhorar o código. O código deve ser corrido em modo supervisionado, pois nem sempre as ligações feitas são apropriadas depois dos ajustes do código.

A fazerEditar

  • Código para retirar negrito das ligações de cada entrada. Note que itálico pode ser necessário. Actualmente quando uma página tem entradas com negrito na ligação principal, o código não consegue retirar as ligações do resto da entrada.
  • Transformar secções começadas com ; em secções bem formatas == ==. Ao princípio, estava a retirar as secções e transformá-las em ;, mas isso foi provavelmente má ideia.
  • Padronizar uso de vírgula depois do termo principal da entrada. Actualmente, vê-se tanto vírgulas ou travessões.
  • Padronizar ponto no fim de cada entrada. Neste momento, algumas usam ponto, outras ponto-e-vírgula e outros ainda não usam nada.
  • A - Feito. GoEThe (discussão) 11h08min de 16 de maio de 2010 (UTC)
  • B - A decorrer. GoEThe (discussão) 16h38min de 16 de maio de 2010 (UTC)
  • C
  • D
  • E
  • F
  • G
  • H
  • I
  • J
  • K
  • L
  • M
  • N
  • O
  • P
  • Q
  • R
  • S
  • T
  • U
  • V
  • W
  • X
  • Y
  • Z

COPIAR A PARTIR DA LINHA ABAIXO EM MODO EDIÇÃO E SALVAR EM FORMATO UTF-8 E COM EXTENSÃO .XML <source lang="XML"><?xml version="1.0"?> <AutoWikiBrowserPreferences xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:space="preserve" Version="5.0.2.0">

 <Project>wikipedia</Project>
 <LanguageCode>pt</LanguageCode>
 <CustomProject />
 <PHP5>false</PHP5>
 <List>
   <ListSource>Desambiguação</ListSource>
   <SelectedProvider>CategoryRecursiveListProvider</SelectedProvider>
   <ArticleList>
     
   </ArticleList>
 </List>
 <FindAndReplace>
   <Enabled>true</Enabled>
   <IgnoreSomeText>false</IgnoreSomeText>
   <IgnoreMoreText>false</IgnoreMoreText>
   <AppendSummary>true</AppendSummary>
   <AfterOtherFixes>false</AfterOtherFixes>
   <Replacements />
   <AdvancedReps>
     <IRule xsi:type="Rule">
       <enabled_>true</enabled_>
       <Children />
       <Name>Remover piped link</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_>\* *?\[\[([^\|\[\]]*?)\|[^\]]*?\]\]</replace_>
       <with_>*$1</with_>
       <ifContains_ />
       <ifNotContains_ />
       <regex_>true</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>100</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>IgnoreCase</regexOptions_>
     </IRule>
     <IRule xsi:type="Rule">
       <enabled_>true</enabled_>
       <Children />
       <Name>Remover ligações após a primeira</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_>(\* *?\[\[.*?\]\].*?)\[\\[\*?\|?([^\|\[\]]*?)\]\]</replace_>
       <with_>$1$2</with_>
       <ifContains_ />
       <ifNotContains_ />
       <regex_>true</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>100</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>IgnoreCase</regexOptions_>
     </IRule>
     <IRule xsi:type="Rule">
       <enabled_>true</enabled_>
       <Children />
       <Name>Remover sem-interwiki</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_>Predefinição:(Seminterwiki\r?\n</replace_>
       <with_ />
       <ifContains_ />
       <ifNotContains_ />
       <regex_>true</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>10</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>IgnoreCase</regexOptions_>
     </IRule>
     <IRule xsi:type="Rule">
       <enabled_>true</enabled_>
       <Children />
       <Name>Remover ligações na primeira frase</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_>^(.*)\[\\[\*?\|?([^\|\[\]]*?)\]\]</replace_>
       <with_>$1$2</with_>
       <ifContains_ />
       <ifNotContains_ />
       <regex_>true</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>100</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>IgnoreCase</regexOptions_>
     </IRule>
     <IRule xsi:type="Rule">
       <enabled_>false</enabled_>
       <Children />
       <Name>Secções</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_>^\=+ *\[?\[?([^\[\=\]]*?\|)?([^\[\=\]]*?)(\]?\]? ?\=).*?$</replace_>
       <with_>;$2</with_>
       <ifContains_ />
       <ifNotContains_>Ver também</ifNotContains_>
       <regex_>true</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>100</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>IgnoreCase Multiline</regexOptions_>
     </IRule>
     <IRule xsi:type="Rule">
       <enabled_>true</enabled_>
       <Children />
       <Name>Retira desambiguação do defaultsort</Name>
       <ruletype_>OnWholePage</ruletype_>
       <replace_> (Desambiguacao)}}</replace_>
       <with_>}}</with_>
       <ifContains_ />
       <ifNotContains_ />
       <regex_>false</regex_>
       <ifIsRegex_>false</ifIsRegex_>
       <numoftimes_>1</numoftimes_>
       <ifRegexOptions_>None</ifRegexOptions_>
       <regexOptions_>None</regexOptions_>
     </IRule>
   </AdvancedReps>
   <SubstTemplates>
     <string>{{</string>
   </SubstTemplates>
   <IncludeComments>false</IncludeComments>
   <ExpandRecursively>true</ExpandRecursively>
   <IgnoreUnformatted>false</IgnoreUnformatted>
 </FindAndReplace>
 <Editprefs>
   <GeneralFixes>false</GeneralFixes>
   <Tagger>false</Tagger>
   <Unicodify>true</Unicodify>
   <Recategorisation>0</Recategorisation>
   <NewCategory />
   <NewCategory2 />
   <ReImage>0</ReImage>
   <ImageFind />
   <Replace />
   <SkipIfNoCatChange>false</SkipIfNoCatChange>
   <RemoveSortKey>false</RemoveSortKey>
   <SkipIfNoImgChange>false</SkipIfNoImgChange>
   <AppendText>true</AppendText>
   <Append>true</Append>
   <Text />
   <Newlines>0</Newlines>
   <AutoDelay>9</AutoDelay>
   <SupressTag>true</SupressTag>
   <RegexTypoFix>false</RegexTypoFix>
 </Editprefs>
 <General>
   <AutoSaveEdit>
     <Enabled>false</Enabled>
     <SavePeriod>30</SavePeriod>
     <SaveFile />
   </AutoSaveEdit>
   <SelectedSummary>Formatando desambiguação</SelectedSummary>
   <Summaries>
     <string>Ajustes (2.2)</string>
     <string>Testes (2.2)</string>
     <string>Checkwiki + ajustes (2.2)</string>
     <string>Ajustes em EAD</string>
     <string>Ajustes em destacados</string>
     <string>Ajustes em Categoria:!Artigos precisando de wikificação</string>
     <string>Cat / recat + ajustes</string>
     <string>Datando predefs de manutenção + ajustes</string>
     <string>Adicionando Infobox + ajustes</string>
     <string>Add predefs de manutenção + ajustes</string>
     <string>Desambiguando + ajustes</string>
     <string>Correção de afluentes + ajustes</string>
     <string>Aplicando LE + ajustes</string>

<string>

  Nota: Para outros significados, veja GoEThe/Desambiguações (desambiguação).

+ ajustes</string>

     <string>Datando predefs de manutenção + ajustes (2.2)</string>
     <string>Formatando desambiguação</string>
   </Summaries>
   <PasteMore>
     <string />
     <string />
     <string />
     <string />
     <string />
     <string />
     <string />
     <string />
     <string />
     <string />
   </PasteMore>
   <FindText />
   <FindRegex>true</FindRegex>
   <FindCaseSensitive>false</FindCaseSensitive>
   <WordWrap>true</WordWrap>
   <ToolBarEnabled>false</ToolBarEnabled>
   <BypassRedirect>true</BypassRedirect>
   <AutoSaveSettings>true</AutoSaveSettings>
   <noSectionEditSummary>true</noSectionEditSummary>
   <restrictDefaultsortAddition>false</restrictDefaultsortAddition>
   <restrictOrphanTagging>false</restrictOrphanTagging>
   <noMOSComplianceFixes>false</noMOSComplianceFixes>
   <syntaxHighlightEditBox>false</syntaxHighlightEditBox>
   <highlightAllFind>true</highlightAllFind>
   <PreParseMode>false</PreParseMode>
   <NoAutoChanges>false</NoAutoChanges>
   <OnLoadAction>0</OnLoadAction>
   <DiffInBotMode>false</DiffInBotMode>
   <Minor>false</Minor>
   <AddToWatchlist>2</AddToWatchlist>
   <TimerEnabled>false</TimerEnabled>
   <SortListAlphabetically>false</SortListAlphabetically>
   <AddIgnoredToLog>false</AddIgnoredToLog>
   <EditToolbarEnabled>false</EditToolbarEnabled>
   <filterNonMainSpace>false</filterNonMainSpace>
   <AutoFilterDuplicates>true</AutoFilterDuplicates>
   <FocusAtEndOfEditBox>false</FocusAtEndOfEditBox>
   <scrollToUnbalancedBrackets>true</scrollToUnbalancedBrackets>
   <TextBoxSize>10</TextBoxSize>
   <TextBoxFont>Courier New</TextBoxFont>
   <LowThreadPriority>false</LowThreadPriority>
   <Beep>false</Beep>
   <Flash>false</Flash>
   <Minimize>true</Minimize>
   <LockSummary>false</LockSummary>
   <SaveArticleList>true</SaveArticleList>
   <SuppressUsingAWB>false</SuppressUsingAWB>
   <AddUsingAWBToActionSummaries>false</AddUsingAWBToActionSummaries>
   <IgnoreNoBots>false</IgnoreNoBots>
   <ClearPageListOnProjectChange>false</ClearPageListOnProjectChange>
   <SortInterWikiOrder>true</SortInterWikiOrder>
   <ReplaceReferenceTags>true</ReplaceReferenceTags>
   <LoggingEnabled>true</LoggingEnabled>
 </General>
 <SkipOptions>
   <SkipNonexistent>true</SkipNonexistent>
   <Skipexistent>false</Skipexistent>
   <SkipWhenNoChanges>true</SkipWhenNoChanges>
   <SkipSpamFilterBlocked>false</SkipSpamFilterBlocked>
   <SkipInuse>false</SkipInuse>
   <SkipWhenOnlyWhitespaceChanged>true</SkipWhenOnlyWhitespaceChanged>
   <SkipOnlyGeneralFixChanges>false</SkipOnlyGeneralFixChanges>
   <SkipOnlyMinorGeneralFixChanges>true</SkipOnlyMinorGeneralFixChanges>
   <SkipOnlyCasingChanged>true</SkipOnlyCasingChanged>
   <SkipIfRedirect>false</SkipIfRedirect>
   <SkipIfNoAlerts>false</SkipIfNoAlerts>
   <SkipDoes>false</SkipDoes>
   <SkipDoesNot>false</SkipDoesNot>
   <SkipDoesText>desambiguação</SkipDoesText>
   <SkipDoesNotText>\[\[%%title%%</SkipDoesNotText>
   <Regex>true</Regex>
   <CaseSensitive>false</CaseSensitive>
   <AfterProcessing>false</AfterProcessing>
   <SkipNoFindAndReplace>false</SkipNoFindAndReplace>
   <SkipMinorFindAndReplace>false</SkipMinorFindAndReplace>
   <SkipNoRegexTypoFix>false</SkipNoRegexTypoFix>
   <SkipNoDisambiguation>false</SkipNoDisambiguation>
   <SkipNoLinksOnPage>false</SkipNoLinksOnPage>
   <GeneralSkipList />
 </SkipOptions>
 <Module>
   <Enabled>true</Enabled>
   <Language>C# 2.0</Language>
   WikiFunctions.Parse.Parsers parser = new WikiFunctions.Parse.Parsers();

WikiFunctions.Parse.HideText removeText = new WikiFunctions.Parse.HideText(false, true, false);

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip) { Skip = false; Summary = "";

       ArticleText = "▓" + ArticleText;
       ArticleText = ArticleText + "\n░";

Article a = new Article(ArticleTitle, ArticleText); a.InitialiseLogListener("test", awb.TraceManager);

a.HideText(removeText);

//a.FixHeaderErrors(parser, Variables.LangCode, false); a.SetDefaultSort(Variables.LangCode, false);

a.AWBChangeArticleText("Fix categories", WikiFunctions.Parse.Parsers.FixCategories(a.ArticleText), true);

a.AWBChangeArticleText("Fix images", WikiFunctions.Parse.Parsers.FixImages(a.ArticleText), true);

a.AWBChangeArticleText("Fix whitespace in links", WikiFunctions.Parse.Parsers.FixLinkWhitespace(a.ArticleText, ArticleTitle), true);

a.AWBChangeArticleText("Fix syntax", WikiFunctions.Parse.Parsers.FixSyntax(a.ArticleText), true, true);

a.AWBChangeArticleText("Fix temperatures", WikiFunctions.Parse.Parsers.FixTemperatures(a.ArticleText), true); // The two slashes below are inserted to disable the insertion of non-breaking spaces HTML markup (sample) // a.AWBChangeArticleText("Fix non-breaking spaces", parser.FixNonBreakingSpaces(a.ArticleText), true);

a.AWBChangeArticleText("Fix main article", WikiFunctions.Parse.Parsers.FixMainArticle(a.ArticleText), true);

a.AWBChangeArticleText("Fix reference tags", WikiFunctions.Parse.Parsers.FixReferenceListTags(a.ArticleText), true);

a.AWBChangeArticleText("Fix empty links and templates", WikiFunctions.Parse.Parsers.FixEmptyLinksAndTemplates(a.ArticleText), true);

a.AWBChangeArticleText("FixReferenceTags", WikiFunctions.Parse.Parsers.FixReferenceTags(a.ArticleText), true);

a.AWBChangeArticleText("ReorderReferences", WikiFunctions.Parse.Parsers.ReorderReferences(a.ArticleText), true);

a.AWBChangeArticleText("Fix empty references", WikiFunctions.Parse.Parsers.SimplifyReferenceTags(a.ArticleText), true);

       if(a.IsMissingReferencesDisplay)

a.AWBChangeArticleText("Add missing

", WikiFunctions.Parse.Parsers.AddMissingReflist(a.ArticleText), true, true);

a.AWBChangeArticleText("Mdashes", parser.Mdashes(a.ArticleText, ArticleTitle), true);

       a.EmboldenTitles(parser, false);

a.FixLinks(false);

a.BulletExternalLinks(false);

a.AWBChangeArticleText("Remove empty comments", WikiFunctions.Parse.Parsers.RemoveEmptyComments(a.ArticleText), false);

a.AWBChangeArticleText("Fix Date Ordinals/Of", parser.FixDateOrdinalsAndOf(a.ArticleText, ArticleTitle), true, true);

// a.AWBChangeArticleText("Sort meta data", parser.SortMetaData(a.ArticleText, ArticleTitle), true);

a.AWBChangeArticleText("Format sticky links", WikiFunctions.Parse.Parsers.StickyLinks(WikiFunctions.Parse.Parsers.SimplifyLinks(a.ArticleText)), true);

// a.AWBChangeArticleText("FixHeadings", WikiFunctions.Parse.Parsers.FixHeadings(a.ArticleText, ArticleTitle), true); a.UnHideText(removeText);

return a.ArticleText; }

 </Module>
 <ExternalProgram>
   <Enabled>false</Enabled>
   <Skip>false</Skip>
   <Program />
   <Parameters />
   <PassAsFile>true</PassAsFile>
   <OutputFile />
 </ExternalProgram>
 <Disambiguation>
   <Enabled>false</Enabled>
   <Link />
   <Variants />
   <ContextChars>20</ContextChars>
 </Disambiguation>
 <Logging>
   <LogVerbose>false</LogVerbose>
   <LogWiki>false</LogWiki>
   <LogXHTML>false</LogXHTML>
   <UploadYN>false</UploadYN>
   <UploadAddToWatchlist>false</UploadAddToWatchlist>
   <UploadOpenInBrowser>false</UploadOpenInBrowser>
   <UploadToWikiProjects>false</UploadToWikiProjects>
   <DebugUploading>false</DebugUploading>
   <UploadMaxLines>1000</UploadMaxLines>
   <LogFolder />
   <UploadJobName />
   <UploadLocation />
   <LogCategoryName />
 </Logging>
 <Special>
   <namespaceValues>
     <int>0</int>
   </namespaceValues>
   <remDupes>true</remDupes>
   <sortAZ>true</sortAZ>
   <filterTitlesThatContain>false</filterTitlesThatContain>
   <filterTitlesThatContainText />
   <filterTitlesThatDontContain>false</filterTitlesThatDontContain>
   <filterTitlesThatDontContainText />
   <areRegex>false</areRegex>
   <opType>0</opType>
   <remove />
 </Special>
 <Tool>
   <ListComparerUseCurrentArticleList>0</ListComparerUseCurrentArticleList>
   <ListSplitterUseCurrentArticleList>0</ListSplitterUseCurrentArticleList>
   <DatabaseScannerUseCurrentArticleList>0</DatabaseScannerUseCurrentArticleList>
 </Tool>
 <Plugin />

</AutoWikiBrowserPreferences>