2 # -*- coding: utf-8 -*-
4 #Copyright 2009-2011 Ray E. Barker
5 #This program is free software: you can redistribute it and/or modify
6 #it under the terms of the GNU Affero General Public License as published by
7 #the Free Software Foundation, version 3 of the License.
9 #This program is distributed in the hope that it will be useful,
10 #but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #GNU General Public License for more details.
14 #You should have received a copy of the GNU Affero General Public License
15 #along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #In the "official" distribution you can find the license in agpl-3.0.txt.
21 +-------------+---------------------+------+-----+---------+----------------+
22 | Field | Type | Null | Key | Default | Extra |
23 +-------------+---------------------+------+-----+---------+----------------+
24 | id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
25 | tourneyId | int(10) unsigned | NO | MUL | NULL | |
26 | playerId | int(10) unsigned | NO | MUL | NULL | |
27 | payinAmount | int(11) | NO | | NULL | |
28 | rank | int(11) | NO | | NULL | |
29 | winnings | int(11) | NO | | NULL | |
30 | comment | text | YES | | NULL | |
31 | commentTs | datetime | YES | | NULL | |
32 +-------------+---------------------+------+-----+---------+----------------+
40 # get rid of the verticle spacing and clean up
41 desc
= re
.sub("[\+\-]+", "", desc
)
42 desc
= re
.sub("^\n+", "", desc
) # there's probably a better way
43 desc
= re
.sub("\n\n", "\n", desc
)
45 # the first line is the header info
46 temp
, desc
= re
.split("\n", desc
, 1)
47 temp
= re
.sub("\|", "!", temp
)
48 temp
= re
.sub(" !", " !!", temp
)
49 table
+= temp
+ " Comments\n"
51 # the rest is he body of the table
52 for line
in re
.split("\n", desc
):
53 line
= re
.sub(" \|", " ||", line
)
54 table
+= "|+\n" + line
+ "\n"