Пример #1
0
	def get_html(self,answer):
		j = 0
		html = "<style type='text/css'>"
		html += html_util.make_css_borders(1)
		html += "</style>"
		html += "<p>Use a <b>caesar</b> cipher with key %d to encrypt the plain text.</p><center>" % self.key
		plaintext_list = [("plain text", "right")]
		for i in range(0, len(self.plaintext)):
			plaintext_list.append(("<tt>" + self.plaintext[i] + "</tt>", "left_border center")) # DR1
		ciphertext_list = [("cipher text", "top_border right")]
		for i in range(0, len(self.ciphertext)):
			if(i in self.hotspots):
				ciphertext_list.append(("<tt>" + html_util.get_text("char_%i" % j, '' if answer['char_%i' % j] is None else answer['char_%i' % j]) + "</tt>", "left_border top_border")) # DR2, DR3, DR4
				j += 1
			else:
				ciphertext_list.append(("<tt>" + self.ciphertext[i] + "</tt>", "left_border top_border")) # DR 5
		html += html_util.get_table([plaintext_list, ciphertext_list], "cellspacing=0 cellpadding=3")
		html += "</center>"	

		return html	
Пример #2
0
	def get_css(self,answer):
		return ('#hamming_table td { '
		 'text-align:center;'
		 'width:%i; height:%i; }'%(MIN_CELL_WIDTH,MIN_CELL_HEIGHT)
		 + html_util.make_css_borders(BORDER,'hamming_table'))
Пример #3
0
 def get_css(self, answer):
     return ('#hamming_table td { '
             'text-align:center;'
             'width:%i; height:%i; }' % (MIN_CELL_WIDTH, MIN_CELL_HEIGHT) +
             html_util.make_css_borders(BORDER, 'hamming_table'))
import html_util

print '''<html>
<head>
<title>html_util.get_table() - with border</title>
<style type='text/css'>''' + \
html_util.make_css_borders(1,'my_id_string') + \
'''
</style>
</head>
<body>
''' + \
html_util.get_table([['a','b'],['c','d']],'id="my_id_string"') + \
'''
</body>
</html>
'''
import html_util

print '''<html>
<head>
<title>html_util.get_table() - with selective 3px border</title>
<style type='text/css'>''' + \
html_util.make_css_borders(3) + \
'''
</style>
</head>
<body>
''' + \
html_util.get_table([
 ['','9','8'],
 ['','','3'],
 [('1','top_border'),('0','top_border'),('1','top_border')]
],'cellspacing=0') + \
'''
</body>
</html>
'''
Пример #6
0
import html_util

print '''<html>
<head>
<title>html_util.get_table() - with selective 3px border</title>
<style type='text/css'>''' + \
html_util.make_css_borders(3) + \
'''
</style>
</head>
<body>
''' + \
html_util.get_table([
    ['','9','8'],
    ['','','3'],
    [('1','top_border'),('0','top_border'),('1','top_border')]
],'cellspacing=0') + \
'''
</body>
</html>
'''