Skip to content

Instantly share code, notes, and snippets.

@Klortho
Created September 1, 2012 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Klortho/3564040 to your computer and use it in GitHub Desktop.
Save Klortho/3564040 to your computer and use it in GitHub Desktop.
This script generates the mult-mesh field template for Wikipedia's Infobox_disease
# This script generates the mult-mesh field template for Wikipedia's Infobox_disease
print "| label8 = [[Medical Subject Headings|MeSH]]\n";
print "| data8 = ";
print "{{#if:{{{MeshID|}}}{{{MeSH|}}}{{{MeSH1|}}}";
print "|{{mesh2|{{{MeshID|{{{MeSH|{{{MeSH1}}}}}}}}}";
print "|year={{{MeshYear|{{{MeshYear1|{{CURRENTYEAR}}}}}}}}}}}}";
my $startm = "{{{MeshID|}}}{{{MeSH|}}}{{{MeSH1|}}}";
my $starty = "{{{MeshYear|{{{MeshYear1|}}}}}}";
for (my $i = 2; $i < 10; ++$i) {
print "{{#if:{{{MeSH$i|}}}|";
print "{{#if:";
print $startm;
for (my $j = 2; $j < $i; ++$j) {
print "{{{MeSH$j|}}}";
}
print "|,}}";
print " {{mesh2|{{{MeSH$i|}}}|year={{{MeshYear$i|{{CURRENTYEAR}}}}}}}";
print "}}";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment