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 Unified Diffs Ignore Whitespace Patch

Added css/epub.css.















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

Deleted css/main.css.

1
../chore/css/main.css
<


Deleted css/normalize.css.

1
../chore/css/normalize.css
<


Changes to get.py.

131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
...
150
151
152
153
154
155
156
157


158
159
160
161
162
163
164
        # Is this an active book?
        # /prefix/...path.../<book>/<chap#>
        if (len(parts) > 1) and parts[-2].endswith(".epub"):
            try:
                chapnum = int(parts[-1])
            except:
                return False,None
            if chapnum < 0:
                return False,None


            # Access the book file
            try:
                docpath = os.path.join(path, *(parts[:-1]))
                doc = epub.open_epub(docpath, "r")
                book = epub.Book(doc)
                chap = book.chapters[chapnum]
................................................................................
            # Here's your chapter
            nm = book.titles[0] if book.titles else parts[-2]
            head = "%s chapter %d" % (nm, chapnum)
            buf = self.build_header(head)
            buf += '<script src="/js/reader.js"></script>\n'
            if chapnum > 0:
                buf += '<a href="%d">Previous Chapter</a>\n' % \
                 (chapnum-1,)


            buf += '<div id="textview"\n'
            buf += '  style="color: white; background: black;'
            buf += '  width: 100%; font-size: 14px;">\n'
            buf += chore.utils.uncharenc(chap.read())
            buf += '</div>\n'
            if chapnum < len(book.chapters)-1:
                buf += '<a href="%d">Next Chapter</a>\n' % \







|

>







 







|
>
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
        # Is this an active book?
        # /prefix/...path.../<book>/<chap#>
        if (len(parts) > 1) and parts[-2].endswith(".epub"):
            try:
                chapnum = int(parts[-1])
            except:
                return False,None
            if chapnum <= 0:
                return False,None
	    chapnum -= 1

            # Access the book file
            try:
                docpath = os.path.join(path, *(parts[:-1]))
                doc = epub.open_epub(docpath, "r")
                book = epub.Book(doc)
                chap = book.chapters[chapnum]
................................................................................
            # Here's your chapter
            nm = book.titles[0] if book.titles else parts[-2]
            head = "%s chapter %d" % (nm, chapnum)
            buf = self.build_header(head)
            buf += '<script src="/js/reader.js"></script>\n'
            if chapnum > 0:
                buf += '<a href="%d">Previous Chapter</a>\n' % \
                 (chapnum,)
	    buf += '<link rel="stylesheet" type="text/css"'
	    buf += ' href="/css/epub.css" />\n'
            buf += '<div id="textview"\n'
            buf += '  style="color: white; background: black;'
            buf += '  width: 100%; font-size: 14px;">\n'
            buf += chore.utils.uncharenc(chap.read())
            buf += '</div>\n'
            if chapnum < len(book.chapters)-1:
                buf += '<a href="%d">Next Chapter</a>\n' % \