wepub

Check-in [cb7f4d4130]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tidy up display and styling. Fix (again) bug with chapter numbering.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:cb7f4d41307494a863a15ffd679371f2668fc10a5df39ce9eebf2ce53d0385e3
User & Date: vandyswa@gmail.com 2018-04-26 00:55:40
Context
2018-06-12
23:41
Normalize use of [un]quote_plus. Fix chapter numbering error (very first chapter was previously not reachable). check-in: e73f6a45c6 user: vandys tags: master, trunk
2018-04-26
00:55
Tidy up display and styling. Fix (again) bug with chapter numbering. check-in: cb7f4d4130 user: vandyswa@gmail.com tags: master, trunk
2017-06-24
04:32
Add UI for font size up/down, smooth scroll, save font size for book. check-in: 5d74a2880e user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added css/epub.css.

            1  +body {
            2  + background: black;
            3  + border-width: 0px;
            4  +}
            5  +body > a {
            6  + color: gold;
            7  +}

Deleted css/main.css.

     1         -../chore/css/main.css

Deleted css/normalize.css.

     1         -../chore/css/normalize.css

Changes to get.py.

   131    131           # Is this an active book?
   132    132           # /prefix/...path.../<book>/<chap#>
   133    133           if (len(parts) > 1) and parts[-2].endswith(".epub"):
   134    134               try:
   135    135                   chapnum = int(parts[-1])
   136    136               except:
   137    137                   return False,None
   138         -            if chapnum < 0:
          138  +            if chapnum <= 0:
   139    139                   return False,None
          140  +	    chapnum -= 1
   140    141   
   141    142               # Access the book file
   142    143               try:
   143    144                   docpath = os.path.join(path, *(parts[:-1]))
   144    145                   doc = epub.open_epub(docpath, "r")
   145    146                   book = epub.Book(doc)
   146    147                   chap = book.chapters[chapnum]
................................................................................
   150    151               # Here's your chapter
   151    152               nm = book.titles[0] if book.titles else parts[-2]
   152    153               head = "%s chapter %d" % (nm, chapnum)
   153    154               buf = self.build_header(head)
   154    155               buf += '<script src="/js/reader.js"></script>\n'
   155    156               if chapnum > 0:
   156    157                   buf += '<a href="%d">Previous Chapter</a>\n' % \
   157         -                 (chapnum-1,)
          158  +                 (chapnum,)
          159  +	    buf += '<link rel="stylesheet" type="text/css"'
          160  +	    buf += ' href="/css/epub.css" />\n'
   158    161               buf += '<div id="textview"\n'
   159    162               buf += '  style="color: white; background: black;'
   160    163               buf += '  width: 100%; font-size: 14px;">\n'
   161    164               buf += chore.utils.uncharenc(chap.read())
   162    165               buf += '</div>\n'
   163    166               if chapnum < len(book.chapters)-1:
   164    167                   buf += '<a href="%d">Next Chapter</a>\n' % \