Ns126:Calendar/NOTES/2015-4-21: Difference between revisions
Jump to navigation
Jump to search
>Shicheng No edit summary |
>Shicheng No edit summary |
||
Line 1: | Line 1: | ||
{| class="table" style="text-align: | |||
*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 | |||
<nowiki> | |||
#!/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"; | |||
</nowiki> | |||
*corresponding table is as the following: | |||
{| class="wikitable" style="text-align: right; color: red;" | |||
| A1||A2||A3||A4||A5 | | A1||A2||A3||A4||A5 | ||
|- | |- |
Revision as of 18:25, 21 April 2015
- 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 |