Appearance prettified

For the eye of the programmer, that is a shameful designer.
This commit is contained in:
giomba 2018-10-21 12:01:31 +02:00
parent e8a2fdb017
commit 8abf645945
3 changed files with 56 additions and 17 deletions

View File

@ -7,18 +7,22 @@
</head>
<body>
<h1>TPDF - Tellico Parser anD Finder</h1>
<main>
<h1>TPDF - Tellico Parser anD Finder</h1>
<form action="main.py" method="get">
<label for="title">Title</label>
<input type="text" name="title" />
<form action="main.py" method="get">
<label for="title">Title</label>
<input type="text" name="title" />
<br />
<label for="author">Author</label>
<input type="text" name="author" />
<label for="author">Author</label>
<input type="text" name="author" />
<br />
<input type="submit" />
<input type="reset" />
</form>
<input type="submit" />
<input type="reset" />
</form>
</main>
</body>
</html>

View File

@ -1,14 +1,34 @@
@charset "utf-8";
/******* Main elements *******/
body {
background-color: #FFCECE;
font-family: sans-serif;
color: black;
background-color: #DEDEDE;
}
main {
text-align: center;
}
/******* Search form *******/
form label {
display: inline-block;
width: 10em;
}
/******* Results output table *******/
table {
border: 1px solid black;
border-collapse: collapse;
margin: 0 auto;
border: 1px solid black;
border-collapse: collapse;
}
td {
border: 1px solid black;
thead {
background-color: #CECECE;
}
td, th {
padding: 2px;
border: 1px solid black;
}

View File

@ -53,6 +53,7 @@ def getHTML(library):
tree = ET.ElementTree()
# Headers and other stuff needed for properly formatted HTML documents
# plus some titles
html = ET.Element('html')
head = ET.Element('head')
title = ET.Element('title')
@ -61,8 +62,9 @@ def getHTML(library):
body = ET.Element('body')
main = ET.Element('main')
table = ET.Element('table')
h1 = ET.Element('h1')
title.text = 'Tellico parsed Library HTML'
title.text = h1.text = 'TPDF - Tellico Parser anD Finder'
tree._setroot(html)
html.append(head)
@ -71,8 +73,21 @@ def getHTML(library):
head.append(linkstyle)
html.append(body)
body.append(main)
main.append(h1)
main.append(table)
# Build a beautiful table header
thead = ET.Element('thead')
tr = ET.Element('tr')
table.append(thead)
thead.append(tr)
for i in ('ID', 'Title', 'Publisher', 'Year', 'ISBN', 'Pages', 'Author'):
th = ET.Element('th')
th.text = i
tr.append(th)
# Add a row in our table for every book in the library object
for i in library:
tr = ET.Element('tr')
@ -90,7 +105,7 @@ def getHTML(library):
tr.append(publisher)
year = ET.Element('td')
year.text = str(i.get('year'))
year.text = str(i.get('year', ''))
tr.append(year)
isbn = ET.Element('td')
@ -98,7 +113,7 @@ def getHTML(library):
tr.append(isbn)
pages = ET.Element('td')
pages.text = str(i.get('pages'))
pages.text = str(i.get('pages', ''))
tr.append(pages)
authors = ET.Element('td')