baker icon indicating copy to clipboard operation
baker copied to clipboard

HPub definition

Open svdgraaf opened this issue 16 years ago • 90 comments

Hi Guys!

Should we perhaps start with writing down the definition of the hpub standard, and then move on from there? Perhaps first setup a draft and get input from others? The Baker.app could serve as an an example implementation of the standard, and other people could start working on -for example- an Android implementation.

~

The current specification is here: https://github.com/Simbul/baker/wiki/hpub-specification

svdgraaf avatar Nov 07 '10 18:11 svdgraaf

Yes, it's one of the biggest part I'm working on, I didn't open the issue because I wasn't expecting to discuss this part so soon and I need some time to synthesize what I already have, but surely we can start collecting feedback.

I'll mark this issue as discussion. :)

I can already say:

  • the least number of mandatory parts
  • no new syntaxes as much as possible

From those assumptions, hpub as you see today is already quite there: with alphabetical ordering and zipping it's complete imho, content wise.

We still need somewhere to specify a sort fo "meta" or "manifest" container. For the discussion I had up until now this is the current dratf:

  • HTML syntax
  • must contain title
  • must contain author
  • must contain URI identifier with specific "ebook" protocol
  • should contain width (in whole pixels?)

folletto avatar Nov 07 '10 19:11 folletto

Another thing I thought of this afternoon (also in combination with the Footer bar/navigation), is thumbnails.

I can imagine an author would want to set an image per chapter (page), and one for the overall book.

We could set the preview image for the overall book in the meta file (or perhaps define a thumbnail.png, and the images could be set in a meta header or something, or look for an image with the same filename, but with a .png extension.

I would not define any image sizes, as the user can use the images in different ways.

svdgraaf avatar Nov 10 '10 19:11 svdgraaf

Yes, but please always keep in mind that we need to strive for simplicity at least for version 1.0 of the HPub standard. If we start to add parameters, settings, thumbnails, etc. we'll make the life more difficult to book creators. Since HPub is not yet a "standard", we have first to aim for a good baseline, simple and clean, and on that build extensions (i.e. navigation, thumbnails).

For example: I was thinking if it was possible to dynamically generate the thumbnails from the HTML pages: that would allow the author to have ZERO effort and allows the user to get real 1:1 matching thumbnails.

However, I like the idea of having page thumbs that have the same name of the HTML with a PNG extension. That could be a good, minimal-effort, extension :)

folletto avatar Nov 11 '10 10:11 folletto

I would like to generate thumbs from the html pages as well, but I don't think that that is a option for now. The PNG extension is the best option for now I guess :)

svdgraaf avatar Nov 11 '10 12:11 svdgraaf

hello! If the bottom navigation is contained in an HTML, I think that the authors will have more versatility. We could create a navigation as simple or complex as required by the design ... thumbnails, photo and text, just text, etc. Besides if we do not put the nav.html, we do not have navigation.

For the standard hpub, I think we could create a base template within nav.html (button text), then be customized if required by the author.

segundoseis avatar Nov 11 '10 21:11 segundoseis

I think the good is that each author can customize the content to the maxim. Personally I'm starting to hate the adobe plugin. All magazines are equal! :-(

segundoseis avatar Nov 11 '10 21:11 segundoseis

Exactly. Let's see that solution how could work out:

  1. How would a user open the nav?
  2. How could we make it so it's usable consistently (adapted, but consistent) no different page sizes (vertical, horizontal for example)?

folletto avatar Nov 11 '10 21:11 folletto

as for the thumbnails/icons, something along the lines of the html "favicon" seems simple enough. agreed that it probably belongs to a future version of the spec.

bru avatar Nov 14 '10 09:11 bru

I just had an idea. We can save the meta file as json file. Why? Because it's easy to parse (there is a good library for it), xml is a lot of unnecessary overhead, and the enduser can use the json file in their javascript in their pages itself to do additional stuff. And above all of that, it's easy to read, write and understand, and it's easy to add additional custom fields.

svdgraaf avatar Nov 14 '10 12:11 svdgraaf

JSON +1 ;-). I like it

segundoseis avatar Nov 14 '10 12:11 segundoseis

I asked in another issue why not use Zhook instead of creating yet another e-book format. Unfortunately all those comments are gone with Github's recent outage.

Basically the argument against Zhook was that it uses one single file instead of many, an is thus less capable or performant. (I'll explain below why I think this isn't really an issue, [1]).

In my opinion there is much more to gain from joining forces on a standard, than fragmenting:

  • We're essentially doing the same thing
  • Thought has been put into Zhook, and it's a format already being used (Monocle, Booki.sh, Widescript, ...)
  • Interactivity is something that isn't limited by any of these formats. (As a matter of fact, I just finished authoring a really interactive Zhook -- more than anything I've seen out there)
  • Tools: convert to and from ePub: https://github.com/joseph/peregrin ; also I should be releasing something very handy quite soon

Baker is a neat idea. It would be perfect if we could pull together towards the same goal, a solid, no-fuss alternative to ePub, making it easier for authors to decide where and how to distribute their content. What do you think?

[1] I don't remember who answered my last comment, it was said that it was non performant, heavy on memory consumption, etc. Whilst I don't think this is the case, it could be addressed by splitting files before bundling them into an app... we'll find some sort of solution? One of the longest books in history, "Les Misérables" by Victor Hugo weighs in at (only) 4mb of total HTML size; I'm sure there are other problems performance-wise -- which of course need to be measured first.

frank06 avatar Nov 15 '10 19:11 frank06

Yes, I completely agree that it would be better to join our effort, also because Zhook already has some degree of adoption. I tried to think about solutions to solve the differences, but so far I wasn't able to meet our needs using the Zhook format.

Basically the point, as of today, is: Zhook is almost a subset of HPub focused on a normal book experience. Because HPub and Zhook are both HTML5 zipped, but HPub supports multiple files, while Zhook only one.

Reasons for HPub:

  1. It's not book-only. HPub targets everything from book to magazines.
  2. It's based on a different interaction model made possible by digital readers: multiple chapters of unlimited length one on the side of the other.
  3. We are focused on the simplest possible approach for the whole production chain of complete multimedia experiences.
  4. It doesn't prescribe anything to the reader different from what's already obvious.
  5. It's going to address the cross-referencing of books problem.

Why Zhook doesn't work for each one of those points:

  1. It's book only. It's "the best of breed EPUB". HPub isn't, but allows a great book experience too.
  2. Zhook is based on the old epub idea of a "whole page". HPub allows that, plus the new natural interaction emerged with the touch devices (Zhook is a subset of HPub).
  3. With one big file, you are just allowing for one person working on it, or you require the editors/programmers/designers to use a versioning system to merge changes. If you split a book in chapters, then you can easily work on one file while another person works on another file. Faster to manage, easy to send, discuss. And since it's not pre-defined, you can organize the files in the best way you want to work with them. We don't even constrain the name of the "first" file: it's just alphabetical, exactly what you get from the filesystem. I can go on a lot on this, but as you might understand, it's really intuitive the way we are designing HPub.
  4. Zhook leaves a lot in the hand of Reading Systems: "the RS must give the element an id that is unique", "the RS may modify the DOM", "the RS may split the DOM". When I'm building a book or a magazine, I want that my reader gets a consistent and determined experience. What if I build a wonderful JS/CSS interaction within my book and the reader "splits" it? How do I know? Have I to test every different implementation PLUS the HTML5 evolutions and quirks? Painful.
  5. We are going to create the separated URI reference scheme and add to the HPub standard as a MUST. This is going to allow easy referencing, something that epub didn't get: they have an ID, but what could you do with that? Who would you query? Where's the file? And Zhook just misses it: "The unique book identifier is an EPUB concept that has no analogy in Zhook. I'm not really a fan of the idea — it seems like half a solution to a not particularly significant problem".

In the end, think about it: would you build a whole, complex, feature rich website inside a single HTML file? I'm sure not. :)

That's why we need to have multiple files. :)

That's why HPub and not Zhook.

But still: we could make Zhook and HPub ideas converge, if the author wants to (since Zhook to me looks like a single company invention, isn't it?). I also don't really care about the name, I don't really like HPub - and neither Zhook if I have to be clear - so I'm open to suggestions.

folletto avatar Nov 15 '10 20:11 folletto

I'm going to append some thoughts to Francisco's comment first, and then get back to your specific Zhook questions, folletto.

First, yes, arguments about the performance of file formats are bonkers. They conflate two different problem domains. Here are the respective challenges:

The app: be fast The format: be easy to author

Zhook builds in zero requirements for the book creator to be mindful of app-level optimisations. But it does provide a simple algorithm for componentizing its single HTML file into multiple discrete chunks if the reading system desires it (that's what we do with Booki.sh, for instance).

Now I think there's more than enough room for multiple ebook formats to co-exist. The one-ring-to-bind-them-all can wait another decade at least. But various people have pointed out to me the similar goals between Zhook and hPub, and it seems worth covering how Zhook arrived at its present point. Francisco has done a terrific job, I'll back it up with a few points about why we went single-HTML-file.

Previewability. If you have multiple files, it's hard to preview the whole book in a web browser. If you're clever, you can install Firefox extensions that recognise rel links, and pop these in your <head>. Or you could get tricky with a meta HTML file that loads all the components in iframes. But if you want it to be dead-simple for web designers to make books, your best option is a single page.

Whole-book operations are common when editing. You've probably already discovered that what you tend to do when editing a book is perform batch operations. Some people like simple find-and-replace. Some get serious with regexes. Power developers will use a swiss army knife like Nokogiri. If you spread out across multiple files, things become a chore quickly, and destructive errors creep in.

You get structure for free (manifests suck). Obviously this is the most important point. You're looking at JSON to explain the structure of the book and capture its metadata. That's not bad. EPUB uses several byzantine XML files. That's sucky. But what are you really doing here? You're marking up an arbitrarily complex, single document: a book.

It turns out that's what HTML is built for. Want to chunk your book into chapters? Or nested sections within sections? Just wrap each discrete component in an <article> tag. Want to have a table of contents? Just give each section a heading: <h1>, <h2>, etc. Want metadata? Use the <meta> tag (or RDF-a for complex metadata).

Anyway, I had thought that if there was a point of difference between Zhook and hPub, it was reflowability. Zhook has to be reflowable (and paginatable) — hPub does not. Dismissing that requirement does potentially give hPub a number of affordances that would be worth exploiting. But I see there's been recent work to support multiple orientations and resolutions. Which arrives you at reflowability. At this point, if you'll excuse the pun, there might be some value in pooling our resources.

joseph avatar Nov 15 '10 22:11 joseph

Different interaction models: I see this as a real point of difference. If we decide that HPub is for one interaction model, and Zhook is for another interaction model, it definitely makes sense to shake hands and wish each other well. Can we define these different interaction models? (If it's pagination vs scrolling, fair enough — my unshakeable opinion is that pagination is essential for long-form text.)

Book-only: yes, unashamedly. I wouldn't use the word 'subset', but it's not important: we can get together and compare Venn diagrams sometime.

Focussing on the simplest possible approach to production: then you'll want to get rid of manifests. :)

No prescription: that's fine as long as you've only got one reading system. Giving the <html> element a reader-specific ID simply allows book designers to do different things with different reading systems. You can leave it out, but soon enough book designers will beg for it. 100% of our focus with both Monocle and Zhook is on modifying the DOM as little as possible. But if you want to avoid it entirely, at the end of the day you've just built a web browser.

Cross-referencing books: that quote of mine about a "not particularly significant problem" is accurate. It hasn't bothered me so far. I think that there are definitely use cases of course, and they simply demand a central registry. Everyone making up their own IDs is just half a solution — and that's where EPUB currently stands. If you're going down this path, stand on the shoulders of giants and use Keith Fahlgren's work on the topic: http://blog.threepress.org/2010/10/21/developing-an-epub-linking-spec

Co-working: that "one big file" is the HTML. I don't really believe you would have multiple people working on that at the same time — it's not a workflow that makes sense to me. Now, you might have one person creating semantic HTML while another does CSS and even another does images/scripting/etc, but authoring the book content itself is more or less indivisible. In large-team cases, of course, you can write a 3-line shell script to stitch stuff together. I recommend you optimise for one-person book teams, not big teams. That's the most common case.

The difference between a book and a "whole, complex, feature rich website" is that a book is a single document — even when it has multiple sections with quite distinct personalities.

Zhook is no more a single-company invention than HPub. The official spec is a Gist — by all means fork away! Contributions very welcome.

Naming: I like HPub better than I like Zhook. Zhook is a ridiculous name! :)

joseph avatar Nov 15 '10 22:11 joseph

I see one big issue, which is my main point to prefer split files over one big file. I'm looking for ways to easily distribute magazines across different tablets. Every page could potentially have a completeley different stylesheet and have a lot of dynamic content (slideshows, videos, etc) which is not going to go well with one big file. Our HTML files are actually going to be built by multiple persons.

That being sad, it would be silly to both work on somewhat the same standard, and I like the idea of not having to use a manifest file at all.

Btw, the bigger players in the market (woodwind, adobe) do use multiple split files, with a manifest XML structure (last time I checked).

Oh, and hpub is actually a better name ;)

My 2 cents

svdgraaf avatar Nov 15 '10 23:11 svdgraaf

From your comment, I'm thinking that you are referring a specific usage, both for authors and readers. As I've said before, HPub is born to be wide in scope and address a lot of different usage patterns.

Point-by-point, your first comment:

  • Previewability: Since a reader is something external from a book, you can just make a simple JS engine that loads inside any div a book taken from a specific URL, doing exactly the same thing we do inside Baker Framework. I don't think it should be declared inside the book itself, like swf files or m4v files don't have the player embedded inside. No difference.
  • Whole-book operations: you look like having a developer point of view, but even from that point of view the difference between a batch operation on a single file or multiple file is usually the difference between cmd-f and shift-cmd-f. But again, that's a developer's point of view. I'm talking about different chains, where authors deliver content in single articles or chapters. Where editors work on them. Where designers take it in Photoshop, InDesign or Illustrator. Where developers convert them to the right format. It's way more complex, and it's even more complex when you move from books to magazine or interactive books: multiple authors, multiple designers, maybe video experts for multimedia content. As I've said before: you would never do a website in a single HTML file. Plus for HPub.
  • Structure for free: Zhook and HPub share the same structure: HTML5, so I can't see why we are taking about structure, we are on the same ground. We aren't talking of the manifest for structure, but for other things. About structure we're good with the current multifile, HTML5 base, exactly like Zhook. The manifest here is discussed for other reasons. No difference, with a plus for HPub if you need filenames to manage your structure. ;)
  • Reflowability: it isn't a difference, because again, while Zhook inherits from epub and so it focuses on books, HPub don't. So if an author wants reflowability, he gets it. If not? Then it doesn't. HPub gives this choice to the author. Zhook doesn't. HPub is as simple as a website, as flexible as a website. Try doing our published book, "5x15 in Tokyo" in epub - you can't. Zhook? Probably, but it's going to be way more complex... unless it's extended to cover the same parts that HPub already does.

Your second comment:

  1. Different interaction mode: from your comment it seems that you haven't tried the book. Please do. :) HPub is new because it allows an interaction mode that's what it's being used in many digital magazines: scrolling and pagination. With complete design control in the hands of the designers, pixel perfect. With again a choice for the author: if he wants to, he can paginate, otherwise, scroll, or any in between.
  2. Book-only: I'm saying subset just because in some ways the standard is a "one file version" of the current, evolving, HPub definition. I'm sorry if it looked harsh, it was just a technical consideration.
  3. Simple: Exactly, I'm trying to avoid the manifesta as much as possible. If HPub is going to use a manifest, will be to add MORE functionality than the one provided today by either epub or Zhook. That's what's boiling.
  4. No prescription: Almost. We already have CSS for that and readers can simply load the CSS they require to work: it's the same. Instead of prescribing "inject an ID" the reader can just say "load this CSS". It's the same, without injection, and completely in the hands of the reader's hands.
  5. Cross-referencing: I know that epubs position is wrong, and that's what we are planning to solve. I also think that Keith solution misses a big point (too focused on the book side again), but this is another discussion. ;)
  6. Co-working: you're too developer oriented, and book oriented, as I was saying above. HPub solution includes book, but it's not limited at it. :)

We can discuss to merge the two standards in one, that would be wonderful, but HPub objectives need multiple files for all the reasons stated here and above. Otherwise you are just making another epub, and that's not something this project is for, that's not something we are receiving loads of enthusiast email, feedback (and more...) for.

From your second comment, I think that you built Zhook explicitly for books, while HPub has a wider approach. That's philosophically different, and leads to all the points we have commented before. But those points are a consequence of that choice

However, if you think about it, as of today the main differences are:

  1. Must have one file -vs- multiple files (No difference).
  2. Must have a specific name -vs- choose you name as long as it's alphabetically ordered (HPub is simpler).
  3. Must include a cover -vs- no cover required (HPub is simpler).

After that, we are discussing a few other things that might require a manifest... or not. I'd like to avoid that, but well... let's settle one discussion before moving to another.

So: do you want to join forces? I'll be fine with a shake of hands and a good luck, but I'd really love to join forces, efforts and minds on that.

folletto avatar Nov 15 '10 23:11 folletto

Of course I've tried Baker! I've had 5x15 on my iPad since your launch day. It's great, delightfully simple, and yes — seems to take interaction cues from the recent slew of magazine apps like Wired. I like the design quality. I hope the project isn't jeopardised by Apple's recent decision to ban 'templated' single-title book apps from the App Store.

My point about pagination vs scrolling is this: from a reader's perspective, as soon as you have any scrolling, you don't have pagination in a meaningful sense (you might still have article-ization or something). Pagination to a reader means "give me a screenful of text at a time". I like to apply the nose test: can I read this using only my nose? :)

Structure: no, this is really, really important. Of course all popular ebook formats use HTML for markup. Zhook uses it to describe the structure of the book to the reading system. The reading system optionally generates a table of contents from the headings. Components from the article tags. Footnotes from sup'ed links. Metadata from the head. All the meta-information about the book — everything you're planning to store in the manifest — is in the semantic structure itself. It's actually simply an outcome of using HTML5.

Well, here's what I think should happen next. I like Zhook's focus on books. I don't want to widen it to magazines, because I think they have very different problems to books. But I think something really terrific is happening here. Actual reading system developers are coming together and talking about the hard bits. You guys with Baker and HPub, Widescript (frank06) who are using EPUB and Zhook, and us with Monocle and Zhook. I'd really like to see this conversation continue. The environment at the moment is full of opportunites, and it's better to experiment than to try to consolidate things (if anything, this is my primary criticism of the current EPUB3 initiative).

EPUB3->HPub->Zhook all sit on a conservative/radical continuum of HTML5 ebooks, and it'd be good to share ideas and problems. Maybe some kind of ebook-dev Google Group? To the people here I would add Keith and Liza of Threepress (also reading system developers — Ibis Reader — and easily the smart and wisest people in our field), then blaine and augustl, who have both built interesting HTML5 ebook reading systems here on Github, and Hadrien Gardeur, the clever bastard behind Feedbooks.

joseph avatar Nov 16 '10 00:11 joseph

  • Scroll: yes, that's why we support also vertical single-page scrolling (tap once at the bottom, nose test passed!). I don't think it's "perfect", but seems working well so far. :)
  • Structure: I agree. It's just slightly different with multiple files: you have to aggregate that structural parsing: since HTML5 have not anymore a "universal" h1, you can easily think that a group of files is in fact another top level article block, with the titles as h1. Zhook has surely a slight advantage here from my point of view, but not heavy if you want to build a single-html HPub. ;)

~

As I thought, you're surely way ahead of me on the book field. :) I'd love to join the discussion, but I also need to push out of the gate a first draft because we keep receiving a huge amount of emails of people building something with Baker and so I'd like to have something as simple as possible but with one more piece in place than we currently have: the URI (and you might easily guess why).

I think that if we are going to have a non-merger point, it's due to your focus on book and our focus on page-perfect magazine-like pages. But maybe... it could be just a difference in the same standard.

Even if...

I strive for simplicity. :)

folletto avatar Nov 16 '10 00:11 folletto

Woah, that's a lot of text to digest.

I am thrilled to notice that both standards are not that far apart, and that everybody is "striving for simplicity". There seems to be, however, some confusion regarding the format's and the reader's concerns.

The (not-really-significant) differences boil down to:

  1. One-page vs multi-page
  2. Book-oriented vs magazine-oriented
  3. Cross-referencing
  4. The name

Let me develop:

1

The pages approaches have their pros and cons (previewability for Zhook, collaboration / "every page could potentially have a completeley different stylesheet" for hPub). But seriously, it can be solved either way by running a 3-line shell script as Joseph said.

A format is merely descriptive. Most of what we're discussing here is ultimately up to the Reading System. Zhook has it down right when it comes to using HTML5 markup to describe structure.

2

We are using Zhook to build highly interactive publications that share many features with magazines – and don't feel limited in any way by the format. It's flexible... But remember: it's a book. If you want to build an app, check PhoneGap.

Re: pagination and scrolling: again, up to the reader. Widescript doesn't paginate (we have our reasons) and Zhook works just fine.

3 I haven't dug enough into cross-referencing, but anyway this can be addressed by something on top of Zhook, like a convention on IDs.

4 Hopefully not too difficult to solve :)

frank06 avatar Nov 16 '10 10:11 frank06

And I'm down for discussing about these topics on an "ebook-dev" or similar group. Joseph are you creating one?

frank06 avatar Nov 16 '10 10:11 frank06