Jump to content

User:ChrisChow

From Meta, a Wikimedia project coordination wiki

ChrisChow is.

[edit]

human

email-able, see instantchow (special sign that rhymes with hat) and gmail , com

chow_wikical.pl

[edit]

working on an updated wiki calendar table creation script based on the Documentation:wikical.pl script. It is moddified to display a calendar that looks more like a paper calender.

  • Links removed from the days
  • Months are now headers not table captions
  • The days are in a larger square that can have text inside that area
  • Script only has one option (-y) for what year you want becuase it prints all the months at once



the code

[edit]
#!perl

use Getopt::Std;

getopt('y');
@nowdate=localtime(time());
#print the whole year
#$month=$opt_m?$opt_m:$nowdate[4]+1;
$year=$opt_y?$opt_y:$nowdate[5]+1900;

for ($month = 1; $month <= 12; $month++){
	
	open CAL, "cal $month $year|";
		
	while (<CAL>) {
		if (/^\s+[A-Z]/) {  # month and year
			$string = $_;
			$string =~ s/^\s/==/;
			$string =~ s/200+[0-9]/==/;
			#printf ("==$string==", $string);
			print "$string";
			print "{| border cellspacing=0 cellpadding=2\n";
				next;
		}
		if (/^Su/) {  # days of week
			@dow=split;
			print "|- valign=\"top\" align=\"center\" style=\"background:lightgrey\"\n|style=\"width:120px\" |".join("\n|style=\"width:120px\" |",@dow)."\n";
			next;
		}
		print "|- style=\"height:150px\" valign=\"top\" align=\"left\"\n";
		
		@days=split;
		if ($days[0]==1) {
			$paddays=7-scalar(@days);
			while ($paddays--) { print "| |"; 
			}
		}
		foreach $day (@days) {
			printf ("|'''$day'''\n",$day);
		}
	
	}  #end while
			print "|}\n";
}
 

example output for 2006

[edit]

March

[edit]
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 ChrisChow turns older by one year 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31