Mobileread
Comments? server-side book-like html?
#1  pittendrigh 03-16-2020, 07:05 PM
A year or so ago I posted something about some experimental software that displays epub3 on an Apache web server. If you unzipped the epub in the DOCUMENT_ROOT
and edited one line of a config file the epub displayed on the server in book-like fashion.

I gave up on that project for various reasons. I got it to work with epub3 produced by Sigil and Jutoh but free sample epubs from github often broke. I also didn't like being dependent on a desktop editor like Sigil or Jutoh for making changes, always followed by scp copying.

So now, basically since the old people stay home virus scare from a week ago, I've rewritten last year's epub3 stuff as server-side php that displays simple web pages--enhanced by page sequencing with Next Page and Previous Page buttons, plus a slideshow and a gallery mode. It isn't in any way epub. It's web pages that act like a book./index.php?robopage=Flies/Library/Sandy-Pittendrigh/Dryflies/

Lots of stuff still missing, like javascript display:none button to collapse the TOC and then back again, and a cookie set mechanism so the codes remember the last page you visited, so if you come back next week you'll automatically jump back to where you were last time. Perhaps in a few more days.

This is a book about Montana Trout Flies, which probably isn't interesting to anyone here. But it is a good demo I think.


https://montana-riverboats.com/index.php?robopage=Flies/Library/Sandy-Pittendrigh/Dryflies

....the codes are on github.com but not pushed out to the master yet. It will be a few more days before I do that.
Reply 

#2  hobnail 03-16-2020, 09:29 PM
It's a great idea.

For the various sites that offer books in epub, kindle, and web/html I get the impression that they made the web html first and I've always wondered if it wouldn't be easier or make more sense to start with epub. On the one hand it shouldn't make any difference which format is used for the starting point but when they start with web html they often add stuff that's nice for the web but a hindrance in an epub that'll be read on an e-ink device; background colors and whatnot, and that stuff ends up in the epub.
Reply 

#3  pittendrigh 03-16-2020, 09:41 PM
git clone https://github.com/pittendrigh/robopages


RE> "great idea" ........thank you. I've been selling passwords that grant access to online blueprints and boat building instructions since 2005. These codes are the current state of that 15 year evolution. Web pages that attempt to teach something complex NEED to look and act like a book. An online book needs some global navigation that never goes away, that appears on all pages no matter what (chapters, for instance, but perhaps other things too like links to a "contact me" form.

But a online book also needs locally dynamic navigation, that changes slightly for each new page. Or at least for each new chapter the user enters. These codes have all of that. They just need polishing.

I've been running my "display epub3" for boat building instructions (that I sell for $25) for a bit over a year now. I edit an epub3 on my desktop. scp it up. Unzip it and it displays. But I'm old and stubborn and I realize now I need to be able to edit directly, on the server. Perhaps in a test subdomain but I need it that way.

So I ditched the epub3 display and made the above. I've got some of it running on my website now. On a free page. It's too buggy to marry to what I sell just yet. But I like it.

I like the plain Jane HTML. The TOC has top-level "chapters" that always appear. Below that additional navigation appears dynamically depending upon which chapter you are currently viewing. There are slide shows and photo galleries if you want them. The slide shows depend on running perl and/or python scripts. There is an Admin GUI that maintains everything but this new code. Adding these new HTML book-like codes to the Admin GUI will happen eventually. I never use that Admin GUI but I do have one customer (who has a site running my software). So I made it for him.

There is also page sequencing. That depends on a text file initially generated by a python script. I can make manual changes to the page sequencing file with vi. If I then run tocit.py again I don't lose my manual changes. tocit.py is smart enough to maintain the previous sequencing, while doing its best to insert an new chapter sub-folders and/or pages in the right place in the (p2n) file. PageUrl to PageNumber hash file. The codes maintain a page to number hash, a page number to page url hash and a numerical array of Urls, which the codes use to keep the sequence order.

This is fun code for me but a long way from prime time. I just thought I'd ask for some feedback. I'll work on it (on and off) for the next few months. And then perhaps announce an alpha release.
Reply 

#4  hobnail 03-16-2020, 10:00 PM
vi? perl? You're showing your age dude!
Reply 

#5  pittendrigh 03-16-2020, 10:03 PM
One final note. Eventually I'll write a (probably python) utility that recurses the book-like HTML pages and spits out an epub, suitable for downloading to a phone. At that point it would amount to an epub editor. You could spend a year or two gradually enhancing web pages (perhaps hidden behind a password barrier). Once happy with the result you would run the epub generator.

Epub3 is just a collection of *.xhtml pages with one or two XML config files. It is eminently scriptable.
Reply 

#6  pittendrigh 03-20-2020, 08:31 AM
Quote hobnail
vi? perl? You're showing your age dude!
Indeed. I'm sevnny one. I do all utilities in python now. Plan to put mod_python on my (virtual) dedicated server. So I can ditch php. For future stuff anyway.
Reply 

#7  Doitsu 03-20-2020, 03:28 PM
Quote pittendrigh
One final note. Eventually I'll write a (probably python) utility that recurses the book-like HTML pages and spits out an epub, suitable for downloading to a phone.
You might want to have a look at BeautifulSoup. It's an extremely easy to use universal Python html/xml parser library.
Sigil also comes with an epub helper library that can be used independently of Sigil (epub_utils.py). (It requires unipath.py and compatibility_utils.py).

Of course, the Calibre API also contains countless functions that you could re-use.
Reply 

#8  pittendrigh 05-31-2020, 06:54 PM
This is an old thread. But I do have an update.

I started off displaying uncompressed epub3 on a website with PHP. I got it to work for output for Calibre (and Jutoh for that matter). But my codes didn't work for all epub3.

Epub3 Best Practices uncompressed didn't work because its XML made relative paths between *.xhtml pages and images differently than calibre. I didn't like being tied to a GUI to make new content too. Sometimes I like to ssh into a site and then just use a text editor.

So I made a plugin (to my system) that shows HTML pages as book pages.
Top level directories are chapters. Next Page and Prev Page buttons set a "last page read" cookie you you can come back a week later and jump to your last read page.

A collapsable table of contents provides random access to all parts of the book without resetting the "last read page" cookie. So you can jump around and look at diagrams, and then return to your last read page. Right now or days later.

An searchable index is still missing. But it's in the works. I'll use Apache Lucene. I've worked with Lucene on a Java Servlet Engine. So I kinda sorta know how it works.

This code is not ready for distribution yet. Maybe soon. I'm working on it. It will be on Github.

https://montana-riverboats.com/?robopage=Birds
Reply 

Today's Posts | Search this Thread | Login | Register