|Glossary of terms|
|Edit review process|
Replace text is a special function that allows a user to replace one text string with another throughout Ballotpedia.
Who can perform a text replacement?
To perform the function of text replacement, a Ballotpedia user must have administrator privileges.
How to "text replace"
Steps in the process:
There, you will observe options as in the graphic to the right of this page.
- In the box labeled "Original text:", type the string of text you want to replace.
- In the box labeled "Replacement text:", type of string of text you want to use to replace the text that you have chosen to replace.
- Hit 'Continue'.
- You are then shown a list of all the pages on Ballotpedia that contain the string of text you entered in the "Original text" box.
- If you do not want to replace the string of text in all of those articles, you can move down through the list and un-check the box in front of any articles where you do not want the text replacement to take place.
- Once you have done that, you may then click the box that says "Replace".
- Once you have clicked the "replace" box, the text replacement will be performed automatically for you.
What can be replaced
Nearly any string of text on Ballotpedia can be replaced. This includes:
Words and phrases
Strings of text (words or phrases) in sentences and paragraphs can be replaced. For example, you might observe that the word "constitution" is misspelled as "consitution" in an article. You may wonder if the word was similarly misspelled across a series of articles. If you think that is possible, or you know it happened, you can correct all such misspellings at once by using the text replace function to search for instances of "consitution" and have them replaced with "constitution".
Strings of text in section and subsection titles can be replaced.
For example, you might want to replace:
Strings of text in article titles can be replaced. To accomplish this, you have to check the text replacement option that says "Replace text in page titles as well, when possible."
Text replacement can be very useful when you have decided to change the name of a category. You can do this by, for example, typing these words into the "Original text" box:
and these words in the "Replacement text" box:
The "text replace" function only searches for and replaces strings of text that are an exact match for what you type into the "Original text" box. If you've decided that you want all section headings of the "See also" variety to have "also" start with a lower-case "a", and you put this in your "original text" box:
...you will fail to catch instances of "See also" that are coded like this:
== See also ==
So, when you think that previous users may have typed the text you want to replace in several different ways, you have to creatively imagine all the different ways they might have typed it, in order to replace every one of those examples. You will have to perform the "replace text" function several times, each time putting into the "Original text" box a different way that a previous user might have misspelled a word, or coded a section heading.
Caution about categories
The use of "replace text" for categories can create some problems that need to be solved as you work through the process.
If, for example, you want to change the category Category:Marijuana, Alaska to Category:Cannabis, Alaska, you should keep a tab open to the old category. After you've performed the replacement, refresh that tab. If it still has articles in it, that means that the category itself was typed in a variety of different ways (such as Category:Marijuana, Alaska with a lower case "c" or Category:Marijuana, Alaska or Category:Marijuana, Alaska with a space after the colon).
If, after you perform the category text replacement, you refresh the tab and find that the category is now empty of articles, the category is still mostly likely in one or more parent categories. Most likely, you want the new category ("Cannabis, Alaska") to be in those very same parent categories. So, copy-and-paste those parent categories and put the new category in them.
Create a re-direct
Also, you can re-direct the old category to the new category. Once the old category is empty of articles, and you've removed all text from it, type:
#redirect [[:Category:Cannabis, Alaska]]
It's important to re-direct the old category instead of deleting it because someone might have wiki-linked to the old category in a sentence in an article like this:
There have been [[:Category:Marijuana, Alaska|6 ballot measures on Alaska's statewide ballot about marijuana]].
If you deleted the category, that wiki-link would now manifest as a red link; whereas, if you re-direct it to the new category, it'll still be a blue link, and when a reader clicks on it, they will be taken to the new category.
Ballotpedia has many pages that are built through the use of the Dynamic Page List (or DPL).
DPLs are built using categories.
If you change a category, it is possible that there is some page on Ballotpedia that uses DPL that will be negatively impacted (aka "ruined") by the category change. Category changes should, therefore, only be performed by someone who is intimately familiar with the relevant part of Ballotpedia and is therefore either:
- Aware that there are no pages on Ballotpedia that use the to-be-changed category to build up a DPL list.
- Aware that there are such pages, and plans to change the typography on those pages after performing the text replace so that those pages retain their previous value.