User:Timeshifter/Sandbox81


 * For more how-to info see: Commons:Convert tables and charts to wiki code or image files

A table update for:
 * Estimated number of civilian guns per capita by country

This table update was copied from this PDF. The PDF was converted to Excel using a free online converter. The Excel file was downloaded and opened within freeware LibreOffice Calc. Calc was used to put the table in rank order. Columns were moved (click column head, and then click in a column cell and drag column). The table was copied from Calc and pasted in a blank table within Visual Editor (VE). Keep telling your browser to continue. It can take 30 seconds to show up in the Visual Editor table. Rows and columns were further moved around or deleted within VE.

Adding flags and linking the countries: Make sure the countries are in the first column. The regular expression wraps all the text in the first cell of each row with the flagcountry template. . So do this before adding any styling to the first column. The default source editor has regular expressions on "Advanced" followed by the search and replace icon on the right. There it works to search for  and replace with. Select "Treat search string as a regular expression" before clicking "Replace all". Nearly all countries will be linked and will have flags. For the red links create redirects as necessary. Save this table permanently in a user sandbox (without overwriting it) so that the redirects are kept due to being in use. Otherwise, admins will delete unused redirects, and you will have to do this tedious, time-consuming redirect task every time you fully update the table. In the edit summary of such redirects, add something like this: "Please do not delete this redirect. It is sometimes used in updates of Estimated number of civilian guns per capita by country."

Add a rank column: Go to any table with a rank column. For example; I went to this revision that had a rank column. I launched the Visual Editor. I selected that column by clicking on its header, and then shift-clicked the bottom cell in that column. That selects the whole column. I clicked "copy" in the edit menu of my Firefox browser. I then went to the table without a rank column. I launched the Visual Editor. I added a blank column in front of the table. I selected its header cell by clicking on it. No need to select the whole column. I clicked on "paste" in the edit menu of my Firefox browser.

Add styling: This aligns all the numbers to the right side of the the cells. This is better for scanning numbers in columns. But the country names look better aligned to the left. Find and replace  with

Table
Computation method:
 * 1: survey(s) and expert estimate(s)
 * 2: expert estimate(s)
 * 3: analogous comparison