User:Monkbot/task 10: Templates for NRHP and NHLS urls

Task 10 is a simple search and replace tool that looks for certain nps.gov urls and replaces them with a template so that if (when) nps.gov changes the location of the target pdf files, and so breaks thousands of links in thousands of pages, those broken links can be repaired by fixing a single template.

There are three templates involved with this task: {{NRHP url}}, {{NHLS url}}, and {{NRHP url/core}}. Task 10 replaces plain urls commonly used in cs1|2 |url= parameters, and replaces external wikilinks.

This task also 'fixes' urls that have been manually repaired to also use the above mentioned templates.

AWB settings

edit
<?xml version="1.0" encoding="utf-8"?>
<AutoWikiBrowserPreferences xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:space="preserve" Version="5.8.5.1">
  <Project>wikipedia</Project>
  <LanguageCode>en</LanguageCode>
  <CustomProject />
  <Protocol>http://</Protocol>
  <LoginDomain />
  <List>
    <ListSource>CS1 maint: Unrecognized language</ListSource>
    <SelectedProvider>SpecialPageListProvider</SelectedProvider>
    <ArticleList />
  </List>
  <FindAndReplace>
    <Enabled>true</Enabled>
    <IgnoreSomeText>false</IgnoreSomeText>
    <IgnoreMoreText>false</IgnoreMoreText>
    <AppendSummary>false</AppendSummary>
    <Replacements>
      <Replacement>
        <Find>(/http:)//(pdfhost\.focus\.nps\.gov/docs/(?:NRHP|NHLS)/(?:[Tt]ext|[Pp]hotos))</Find>
        <Replace>$1__H1DD3N__$2</Replace>
        <Comment>broken: hide url in archives</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>(/http:)//(focus\.nps\.gov/pdfhost/docs/(?:NRHP|NHLS)/(?:[Tt]ext|[Pp]hotos))</Find>
        <Replace>$1__H1DD3N__$2</Replace>
        <Comment>working: hide url in archives</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://pdfhost\.focus\.nps\.gov/docs/NRHP/Text/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NRHP url|id=$1|title=$2}}</Replace>
        <Comment>broken NRHP external text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://pdfhost\.focus\.nps\.gov/docs/NRHP/Photos/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NRHP url|id=$1|title=$2|photos=y}}</Replace>
        <Comment>broken NRHP external photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://pdfhost\.focus\.nps\.gov/docs/NRHP/Text/([^\.]+)\.pdf</Find>
        <Replace>{{NRHP url|id=$1}}</Replace>
        <Comment>broken NRHP plain text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://pdfhost\.focus\.nps\.gov/docs/NRHP/Photos/([^\.]+)\.pdf</Find>
        <Replace>{{NRHP url|id=$1|photos=y}}</Replace>
        <Comment>broken NRHP plain photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://pdfhost\.focus\.nps\.gov/docs/NHLS/Text/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NHLS url|id=$1|title=$2}}</Replace>
        <Comment>broken NHLS external text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://pdfhost\.focus\.nps\.gov/docs/NHLS/Photos/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NHLS url|id=$1|title=$2|photos=y}}</Replace>
        <Comment>broken NHLS external photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://pdfhost\.focus\.nps\.gov/docs/NHLS/Text/([^\.]+)\.pdf</Find>
        <Replace>{{NHLS url|id=$1}}</Replace>
        <Comment>broken NHLS plain text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://pdfhost\.focus\.nps\.gov/docs/NHLS/Photos/([^\.]+)\.pdf</Find>
        <Replace>{{NHLS url|id=$1|photos=y}}</Replace>
        <Comment>broken NHLS plain photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://focus\.nps\.gov/pdfhost/docs/NRHP/Text/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NRHP url|id=$1|title=$2}}</Replace>
        <Comment>working NRHP external text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://focus\.nps\.gov/pdfhost/docs/NRHP/Photos/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NRHP url|id=$1|title=$2|photos=y}}</Replace>
        <Comment>working NRHP external photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://focus\.nps\.gov/pdfhost/docs/NRHP/Text/([^\.]+)\.pdf</Find>
        <Replace>{{NRHP url|id=$1}}</Replace>
        <Comment>working NRHP plain text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://focus\.nps\.gov/pdfhost/docs/NRHP/Photos/([^\.]+)\.pdf</Find>
        <Replace>{{NRHP url|id=$1|photos=y}}</Replace>
        <Comment>working NRHP plain photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://focus\.nps\.gov/pdfhost/docs/NHLS/Text/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NHLS url|id=$1|title=$2}}</Replace>
        <Comment>working NHLS external text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>\[http://focus\.nps\.gov/pdfhost/docs/NHLS/Photos/([^\.]+)\.pdf\s*([^\]]*)]</Find>
        <Replace>{{NHLS url|id=$1|title=$2|photos=y}}</Replace>
        <Comment>working NHLS external photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://focus\.nps\.gov/pdfhost/docs/NHLS/Text/([^\.]+)\.pdf</Find>
        <Replace>{{NHLS url|id=$1}}</Replace>
        <Comment>working NHLS plain text</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>http://focus\.nps\.gov/pdfhost/docs/NHLS/Photos/([^\.]+)\.pdf</Find>
        <Replace>{{NHLS url|id=$1|photos=y}}</Replace>
        <Comment>working NHLS plain photos</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
      <Replacement>
        <Find>__H1DD3N__</Find>
        <Replace>//</Replace>
        <Comment>unhide</Comment>
        <IsRegex>true</IsRegex>
        <Enabled>true</Enabled>
        <Minor>false</Minor>
        <BeforeOrAfter>false</BeforeOrAfter>
        <RegularExpressionOptions>IgnoreCase</RegularExpressionOptions>
      </Replacement>
    </Replacements>
    <AdvancedReps />
    <SubstTemplates />
    <IncludeComments>false</IncludeComments>
    <ExpandRecursively>true</ExpandRecursively>
    <IgnoreUnformatted>false</IgnoreUnformatted>
  </FindAndReplace>
  <Editprefs>
    <GeneralFixes>false</GeneralFixes>
    <Tagger>false</Tagger>
    <Unicodify>false</Unicodify>
    <Recategorisation>0</Recategorisation>
    <NewCategory />
    <NewCategory2 />
    <ReImage>0</ReImage>
    <ImageFind />
    <Replace />
    <SkipIfNoCatChange>false</SkipIfNoCatChange>
    <RemoveSortKey>false</RemoveSortKey>
    <SkipIfNoImgChange>false</SkipIfNoImgChange>
    <AppendText>false</AppendText>
    <AppendTextMetaDataSort>false</AppendTextMetaDataSort>
    <Append>true</Append>
    <Text />
    <Newlines>2</Newlines>
    <AutoDelay>2</AutoDelay>
    <BotMaxEdits>5000</BotMaxEdits>
    <SupressTag>true</SupressTag>
    <RegexTypoFix>false</RegexTypoFix>
  </Editprefs>
  <General>
    <AutoSaveEdit>
      <Enabled>false</Enabled>
      <SavePeriod>30</SavePeriod>
      <SaveFile />
    </AutoSaveEdit>
    <SelectedSummary>[[User:Monkbot/task 10: Templates for NRHP and NHLS urls|Monkbot task 10]]: brfa trail: Templates for NRHP and NHLS urls;</SelectedSummary>
    <Summaries>
      <string>clean up</string>
      <string>re-categorisation per [[WP:CFD|CFD]]</string>
      <string>clean up and re-categorisation per [[WP:CFD|CFD]]</string>
      <string>removing category per [[WP:CFD|CFD]]</string>
      <string>[[Wikipedia:Template substitution|subst:'ing]]</string>
      <string>[[Wikipedia:WikiProject Stub sorting|stub sorting]]</string>
      <string>[[WP:AWB/T|Typo fixing]]</string>
      <string>bad link repair</string>
      <string>Fixing [[Wikipedia:Disambiguation pages with links|links to disambiguation pages]]</string>
      <string>Unicodifying</string>
      <string>[[User:Monkbot/task 10: Templates for NRHP and NHLS urls|Monkbot task 10]]: brfa trail: Templates for NRHP and NHLS urls;</string>
    </Summaries>
    <PasteMore>
      <string />
      <string />
      <string />
      <string />
      <string />
      <string />
      <string />
      <string />
      <string />
      <string />
    </PasteMore>
    <FindText />
    <FindRegex>false</FindRegex>
    <FindCaseSensitive>false</FindCaseSensitive>
    <WordWrap>true</WordWrap>
    <ToolBarEnabled>false</ToolBarEnabled>
    <BypassRedirect>true</BypassRedirect>
    <AutoSaveSettings>false</AutoSaveSettings>
    <noSectionEditSummary>false</noSectionEditSummary>
    <restrictDefaultsortAddition>true</restrictDefaultsortAddition>
    <restrictOrphanTagging>true</restrictOrphanTagging>
    <noMOSComplianceFixes>false</noMOSComplianceFixes>
    <syntaxHighlightEditBox>false</syntaxHighlightEditBox>
    <highlightAllFind>true</highlightAllFind>
    <PreParseMode>false</PreParseMode>
    <NoAutoChanges>false</NoAutoChanges>
    <OnLoadAction>0</OnLoadAction>
    <DiffInBotMode>false</DiffInBotMode>
    <Minor>true</Minor>
    <AddToWatchlist>2</AddToWatchlist>
    <TimerEnabled>false</TimerEnabled>
    <SortListAlphabetically>false</SortListAlphabetically>
    <AddIgnoredToLog>false</AddIgnoredToLog>
    <EditToolbarEnabled>true</EditToolbarEnabled>
    <filterNonMainSpace>false</filterNonMainSpace>
    <AutoFilterDuplicates>false</AutoFilterDuplicates>
    <FocusAtEndOfEditBox>false</FocusAtEndOfEditBox>
    <scrollToUnbalancedBrackets>false</scrollToUnbalancedBrackets>
    <TextBoxSize>10</TextBoxSize>
    <TextBoxFont>Courier New</TextBoxFont>
    <LowThreadPriority>false</LowThreadPriority>
    <Beep>false</Beep>
    <Flash>false</Flash>
    <Minimize>false</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>
    <AlertPreferences />
  </General>
  <SkipOptions>
    <SkipNonexistent>true</SkipNonexistent>
    <Skipexistent>false</Skipexistent>
    <SkipDontCare>false</SkipDontCare>
    <SkipWhenNoChanges>false</SkipWhenNoChanges>
    <SkipSpamFilterBlocked>false</SkipSpamFilterBlocked>
    <SkipInuse>false</SkipInuse>
    <SkipWhenOnlyWhitespaceChanged>false</SkipWhenOnlyWhitespaceChanged>
    <SkipOnlyGeneralFixChanges>true</SkipOnlyGeneralFixChanges>
    <SkipOnlyMinorGeneralFixChanges>false</SkipOnlyMinorGeneralFixChanges>
    <SkipOnlyCosmetic>false</SkipOnlyCosmetic>
    <SkipOnlyCasingChanged>false</SkipOnlyCasingChanged>
    <SkipIfRedirect>false</SkipIfRedirect>
    <SkipIfNoAlerts>false</SkipIfNoAlerts>
    <SkipDoes>false</SkipDoes>
    <SkipDoesText />
    <SkipDoesRegex>false</SkipDoesRegex>
    <SkipDoesCaseSensitive>false</SkipDoesCaseSensitive>
    <SkipDoesAfterProcessing>false</SkipDoesAfterProcessing>
    <SkipDoesNot>false</SkipDoesNot>
    <SkipDoesNotText />
    <SkipDoesNotRegex>false</SkipDoesNotRegex>
    <SkipDoesNotCaseSensitive>false</SkipDoesNotCaseSensitive>
    <SkipDoesNotAfterProcessing>false</SkipDoesNotAfterProcessing>
    <SkipNoFindAndReplace>false</SkipNoFindAndReplace>
    <SkipMinorFindAndReplace>false</SkipMinorFindAndReplace>
    <SkipNoRegexTypoFix>false</SkipNoRegexTypoFix>
    <SkipNoDisambiguation>false</SkipNoDisambiguation>
    <SkipNoLinksOnPage>false</SkipNoLinksOnPage>
    <GeneralSkipList />
  </SkipOptions>
  <Module>
    <Enabled>false</Enabled>
    <Language>C# 3.5</Language>
    <Code />
  </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>
  <Special>
    <namespaceValues>
      <int>0</int>
      <int>4</int>
      <int>6</int>
      <int>10</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>
    <PluginPrefs>
      <Name>CSV Loader</Name>
      <PluginSettings>
        <anyType xsi:type="PrefsKeyPair">
          <Name>TextMode</Name>
          <Setting xsi:type="xsd:string">Append</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>InputText</Name>
          <Setting xsi:type="xsd:string" />
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>ColumnHeaders</Name>
          <Setting xsi:type="xsd:string" />
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>Skip</Name>
          <Setting xsi:type="xsd:boolean">true</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>Separator</Name>
          <Setting xsi:type="xsd:string">,</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>CreateLists</Name>
          <Setting xsi:type="xsd:boolean">false</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>ListSeparator</Name>
          <Setting xsi:type="xsd:string">^</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>FindReplace</Name>
          <Setting xsi:type="xsd:boolean">false</Setting>
        </anyType>
        <anyType xsi:type="PrefsKeyPair">
          <Name>EditSummary</Name>
          <Setting xsi:type="xsd:string" />
        </anyType>
      </PluginSettings>
    </PluginPrefs>
  </Plugin>
</AutoWikiBrowserPreferences>