Appearance prettified
For the eye of the programmer, that is a shameful designer.
This commit is contained in:
parent
e8a2fdb017
commit
8abf645945
22
index.html
22
index.html
|
@ -7,18 +7,22 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>TPDF - Tellico Parser anD Finder</h1>
|
<main>
|
||||||
|
<h1>TPDF - Tellico Parser anD Finder</h1>
|
||||||
|
|
||||||
<form action="main.py" method="get">
|
<form action="main.py" method="get">
|
||||||
<label for="title">Title</label>
|
<label for="title">Title</label>
|
||||||
<input type="text" name="title" />
|
<input type="text" name="title" />
|
||||||
|
<br />
|
||||||
|
|
||||||
<label for="author">Author</label>
|
<label for="author">Author</label>
|
||||||
<input type="text" name="author" />
|
<input type="text" name="author" />
|
||||||
|
<br />
|
||||||
|
|
||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
<input type="reset" />
|
<input type="reset" />
|
||||||
</form>
|
</form>
|
||||||
|
</main>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
30
style.css
30
style.css
|
@ -1,14 +1,34 @@
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
/******* Main elements *******/
|
||||||
body {
|
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 {
|
table {
|
||||||
border: 1px solid black;
|
margin: 0 auto;
|
||||||
border-collapse: collapse;
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
thead {
|
||||||
border: 1px solid black;
|
background-color: #CECECE;
|
||||||
|
}
|
||||||
|
|
||||||
|
td, th {
|
||||||
|
padding: 2px;
|
||||||
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
21
tcparser.py
21
tcparser.py
|
@ -53,6 +53,7 @@ def getHTML(library):
|
||||||
tree = ET.ElementTree()
|
tree = ET.ElementTree()
|
||||||
|
|
||||||
# Headers and other stuff needed for properly formatted HTML documents
|
# Headers and other stuff needed for properly formatted HTML documents
|
||||||
|
# plus some titles
|
||||||
html = ET.Element('html')
|
html = ET.Element('html')
|
||||||
head = ET.Element('head')
|
head = ET.Element('head')
|
||||||
title = ET.Element('title')
|
title = ET.Element('title')
|
||||||
|
@ -61,8 +62,9 @@ def getHTML(library):
|
||||||
body = ET.Element('body')
|
body = ET.Element('body')
|
||||||
main = ET.Element('main')
|
main = ET.Element('main')
|
||||||
table = ET.Element('table')
|
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)
|
tree._setroot(html)
|
||||||
html.append(head)
|
html.append(head)
|
||||||
|
@ -71,8 +73,21 @@ def getHTML(library):
|
||||||
head.append(linkstyle)
|
head.append(linkstyle)
|
||||||
html.append(body)
|
html.append(body)
|
||||||
body.append(main)
|
body.append(main)
|
||||||
|
main.append(h1)
|
||||||
main.append(table)
|
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
|
# Add a row in our table for every book in the library object
|
||||||
for i in library:
|
for i in library:
|
||||||
tr = ET.Element('tr')
|
tr = ET.Element('tr')
|
||||||
|
@ -90,7 +105,7 @@ def getHTML(library):
|
||||||
tr.append(publisher)
|
tr.append(publisher)
|
||||||
|
|
||||||
year = ET.Element('td')
|
year = ET.Element('td')
|
||||||
year.text = str(i.get('year'))
|
year.text = str(i.get('year', ''))
|
||||||
tr.append(year)
|
tr.append(year)
|
||||||
|
|
||||||
isbn = ET.Element('td')
|
isbn = ET.Element('td')
|
||||||
|
@ -98,7 +113,7 @@ def getHTML(library):
|
||||||
tr.append(isbn)
|
tr.append(isbn)
|
||||||
|
|
||||||
pages = ET.Element('td')
|
pages = ET.Element('td')
|
||||||
pages.text = str(i.get('pages'))
|
pages.text = str(i.get('pages', ''))
|
||||||
tr.append(pages)
|
tr.append(pages)
|
||||||
|
|
||||||
authors = ET.Element('td')
|
authors = ET.Element('td')
|
||||||
|
|
Loading…
Reference in New Issue