diff --git a/index.html b/index.html index 8bb842f..9b23cd3 100644 --- a/index.html +++ b/index.html @@ -7,18 +7,22 @@ -

TPDF - Tellico Parser anD Finder

+
+

TPDF - Tellico Parser anD Finder

-
- - + + + +
- - + + +
- - -
+ + + +
diff --git a/style.css b/style.css index 8048b67..63c7b29 100644 --- a/style.css +++ b/style.css @@ -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; } diff --git a/tcparser.py b/tcparser.py index 15c9d86..b2d25ea 100644 --- a/tcparser.py +++ b/tcparser.py @@ -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')