User:Timeshifter/Sandbox74
Please do not edit this page. It is linked from other pages. Create your own user pages for trying out things. See also: Commons:Convert tables and charts to wiki code or image files.
Worksheet for full rapid update of List of countries by incarceration rate. Copy the country list (all countries) of prison population rates from here:
- http://www.prisonstudies.org/highest-to-lowest/prison_population_rate?field_region_taxonomy_tid=All - Click on the "title" header first until the list is in alphabetical order. Paste the list into freeware LibreOffice Calc. Click the top of the rank column. Then right-click the top of that column, and then click "delete column" from the popup context menu.
Then control-click the top of the columns that remain in order to select them. Then copy and paste into tab2wiki. Click the "do it" button at the bottom. It converts the spreadsheet into wikitext for a table.
The country links are created all at once. Copy the wikitext result from tab2wiki into freeware NoteTab Light. Put a checkmark in the regular expression box. Then click "replace" in the search menu. Then copy the following into it:
^.*?\|\h*\K(.*?)(?=\h*\|)
"replace all" with[[$1]]
This creates a link of anything in the first cell of each row. So all the country names are linked. This must be done before other formatting. Such as adding the text-align styles. Those styles are added all at once too.
Do not add flag icons. The flag template sometimes changes the country names, and this messes up the alphabetical order of the table. So it takes much longer to update the chart due to having to change the order of the table rows in order to accommodate the name changes. Also, there are still some country names that do not have redirects yet. So a red link shows up instead of a flag icon and a clickable country link.
Please do not delete the country redirects. This allows the table to be fully updated much more often. It only takes half an hour to fully update the table if redirects do not also have to be recreated each time (which can take hours). The source page uses these country, territory, and subnational names.
Incarceration rates
[edit]This list is initially sorted alphabetically. Click the sorting cell (with the icon) below the incarceration rate header to sort by rate. (Requires JavaScript.) The table can be sorted in ascending or descending order. The row number column stays static, and does not sort.
In the table below see "United Kingdom" to find the rates for Scotland, Northern Ireland, and England and Wales. There is no rate listed for the UK as a whole. South Korea is listed as Republic of (South) Korea. For info on North Korea, see notes below.
- "Notes" column links to notes section below the chart.