User talk:DCDuring/UncategorizedTemplates

From Wiktionary, the free dictionary
Latest comment: 11 years ago by Ruakh in topic Updated list.
Jump to navigation Jump to search

Generating this list[edit]

To generate the list of page-IDs and template-names of all non-redirect non-subpage pages in the Template: namespace, I used this:

time \
  bzip2 -d < enwiktionary-20120626-pages-articles.xml.bz2 | \
  perl -e 'use warnings;
           use strict;
           $/ = "</page>\n";
           while(<>)
           { last unless m/<\/page>/;
             next if m/<redirect/;
             die unless m/<title>(Template:)?([^<]+)<\/title>/;
             next unless $1;
             my $template_name = $2;
             next if $template_name =~ m/.\//;
             die unless m/<id>(\d+)<\/id>/;
             print "$1 $template_name\r\n";
           }
          ' \
  > list-of-templates.txt

which ran in 6m50.239s and created a file that starts out like this:

34449 indexletters2
36557 punctuation
44333 index top
44335 index b
44338 index c

To generate the list of page-IDs of all categorized pages, I used this:

time \
  gzip -d < enwiktionary-20120626-categorylinks.sql.gz | \
  perl -e 'use warnings;
           use strict;
           $/ = "(";
           my $prev = "";
           while(<>)
           { if(m/^(\d+),/)
               { print +($prev = $1), "\r\n" unless $1 eq $prev; }
           }
          ' \
  > list-of-categorized-pages.txt

which ran in 0m29.542s and created a file that starts out like this:

8
12
16
19
20

To generate the final list, I used this:

perl -e 'use warnings;
         use strict;
         my %templates;
         { open my $fh, "<", "list-of-templates.txt";
           while(<$fh>)
           { die unless m/^(\d+) (.+)\r\n\z/;
             $templates{$1} = $2;
           }
         }
         { open my $fh, "<", "list-of-categorized-pages.txt";
           while(<$fh>)
           { die unless m/^(\d+)\r\n\z/;
             delete $templates{$1};
           }
         }
         foreach my $name (sort values %templates)
           { print "$name\r\n"; }
        ' \
  > list-of-uncategorized-templates.txt

which ran in a few seconds and created a file that starts out like this:

&lat
----
1x
@
BIPA

I then wikified it for posting here by running the equivalent of this:

perl -ne 's/\r\n\z// or die;
          m/^([\x20-\x7E]|[\xC0-\xF7][\x80-\xBF]+)/ or die;
          print "\n==$1==\n" unless $1 eq $prev;
          $prev = $1;
          s/=/&#x3D;/g;
          print "* {{temp|$_}}\n"
         ' < list-of-uncategorized-templates.txt > wikified-list-of-uncategorized-templates.txt

except formatted even less nicely than that.

RuakhTALK 23:59, 26 June 2012 (UTC)Reply

Thanks for creating and updating this. :)
Curiously, Template:R:Cleasby-Vigfússon is in the list, although it's been in two categories since last year. I thought that might be because the categories are in the documentation rather than directly in the Template, but {{LDL}}'s categorisation is also only through its documentation subpage and it isn't listed. - -sche (discuss) 00:41, 27 June 2012 (UTC)Reply
That's because it's the category-links table doesn't think it belongs to any category. Note that if you visit Category:Old Norse reference templates or Category:Icelandic reference templates, it's not actually listed on those pages. I'm not sure what causes this to happen sometimes, but when it does happen, you can fix it by performing a null edit; in this case, you can visit Template:R:Cleasby-Vigfússon?action=edit and click "Save page", and then it should show up in the category pages, and won't show up in this list the next time I regenerate it. —RuakhTALK 03:21, 27 June 2012 (UTC)Reply

Reference list of selected language codes[edit]

  • {{nan}} - Template:nan
  • nav - not a language code
  • py - not a language code
  • rf - not a language code

Updated list.[edit]

I have an updated list based on the July 5th dump. What should I do with it? (There are a lot of templates that DCDuring has added notes about, and there are widely-transcluded templates that he's removed from the list without actually fixing, and so on. If I just replace the page with the updated list, all of that information will be lost.) —RuakhTALK 03:48, 6 July 2012 (UTC)Reply

Well, anyway, let me know if/when you want an updated list. —RuakhTALK 13:15, 26 July 2012 (UTC)Reply