fixing sorting loop

fixed infinate loop when sorting by CMC, also added slight styling
changes
This commit is contained in:
reimannsum 2016-06-14 15:25:38 -04:00
parent 595d636490
commit 4bf2d6f219
2 changed files with 3 additions and 2 deletions

View file

@ -97,7 +97,7 @@ def main(fname, oname = None, verbose = True, encoding = 'std',
# for coloring of each box seperately cardlib.Card.format() must change non-minimaly # for coloring of each box seperately cardlib.Card.format() must change non-minimaly
writer.write('<div id="' + utils.segment_ids[i] + '">') writer.write('<div id="' + utils.segment_ids[i] + '">')
writehtml(writer, segments[i]) writehtml(writer, segments[i])
writer.write("</div>") writer.write("</div><hr>")
# closing the html file # closing the html file
writer.write(utils.html_append) writer.write(utils.html_append)
return #break out of the write cards funcrion to avoid writing cards twice return #break out of the write cards funcrion to avoid writing cards twice
@ -207,7 +207,7 @@ def main(fname, oname = None, verbose = True, encoding = 'std',
for card in card_set: for card in card_set:
# make sure there is an empty set for each CMC # make sure there is an empty set for each CMC
while len(sorted_cards)-1 < card.get_cmc(): while len(sorted_cards)-1 < card.get_cmc():
sorted_cards += [] sorted_cards += [[]]
# add card to correct set of CMC values # add card to correct set of CMC values
sorted_cards[card.get_cmc()] += [card] sorted_cards[card.get_cmc()] += [card]
# combine each set of CMC valued cards together # combine each set of CMC valued cards together

View file

@ -501,4 +501,5 @@ html_prepend = """<!DOCTYPE html>
<li style="background-color:lightgrey;"><a href="#colorless" style="color:black">Colorless Cards</a></li> <li style="background-color:lightgrey;"><a href="#colorless" style="color:black">Colorless Cards</a></li>
<li style="background-color:darkgoldenrod;"><a href="#lands" style="color:black">lands Cards</a></li> <li style="background-color:darkgoldenrod;"><a href="#lands" style="color:black">lands Cards</a></li>
</ul> </ul>
<hr>
""" """