Kun:LabNotes/MONOD/2015-4-21
Jump to navigation
Jump to search
- Now, I do know how to insert figures, but I don't know how to insert tables into MediaWiki. Therefore, I write a small code to transfer routine table to wikitable.
perl table2wikitable.pl input.table.txt
#!/usr/bin/perl #table2wikitable.pl use strict; use Cwd; chdir getcwd; my $input=@ARGV[0]; open F,$input; print "{| class=\"wikitable\" style=\"text-align: right; color: red;\"\n"; while(<F>){ chomp; my @line=split /\t/; my $tmp=join("||",@line); print "| $tmp\n|-\n"; } print"|}\n";
- corresponding table is as the following:
A1 | A2 | A3 | A4 | A5 |
A2 | A3 | A4 | A5 | A6 |
A3 | A4 | A5 | A6 | A7 |
A4 | A5 | A6 | A7 | A8 |
A5 | A6 | A7 | A8 | A9 |
A6 | A7 | A8 | A9 | A10 |
A7 | A8 | A9 | A10 | A11 |
A8 | A9 | A10 | A11 | A12 |
A9 | A10 | A11 | A12 | A13 |
A10 | A11 | A12 | A13 | A14 |
A11 | A12 | A13 | A14 | A15 |
A12 | A13 | A14 | A15 | A16 |
A13 | A14 | A15 | A16 | A17 |
A14 | A15 | A16 | A17 | A18 |
A15 | A16 | A17 | A18 | A19 |