Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an HTML renderer that generates multiple files #8

Closed
crowdagger opened this issue Mar 3, 2016 · 9 comments
Closed

Add an HTML renderer that generates multiple files #8

crowdagger opened this issue Mar 3, 2016 · 9 comments

Comments

@crowdagger
Copy link
Owner

Currently, the only HTML renderer (besides EPUB, which is technically HTML too) generates a standalone file. For long texts, it might make more sense to give the possibillity to generate a multiple file, probably in a directory with one file by chapter. This could be an additonal option output.html_dir that would operate in a similar manner to the EPUB renderer: generate one file by chapter in this directory, generate a CSS files and copy linked images in this directory.

@taophp
Copy link
Contributor

taophp commented Mar 7, 2016

Following my comments on Twitter, I've made a first tentative to make a standalone HTML file that use JavaScript to enable chapter pagination. Many improvements should be done, but it's a first step. It requires some changes in the HTML output, i.e. in {{content}} mark I saw in the template. I suppose some rust skills are required to do so, so I didn't tried and let you make it.
So I decided to attach a zip file with an HTML one, sample-mod.html, changes included, so you can test it and figure if it match your needs. If yes, I'm sure you are able to extract significant code and make it yours. To help, I have also include the original file I started with, sample-ori.html. You'll recognized the first three chapters of one of your books that you shared previously. I hope you don't bother to see it again here in this manner.
diff sample-ori.html sample-mod.html should help.
sample.zip
Please, let me know what you think.

@crowdagger
Copy link
Owner Author

Looking into it!

@taophp
Copy link
Contributor

taophp commented Mar 9, 2016

Any news ?

@crowdagger
Copy link
Owner Author

Had a bit less time for this project. Still looking at it. My current thoughts:

  • your current implementation would be practical for standalone page, allowing it to give the same aspect (displaying one chapter at a time) than the multi-files html.
  • it would be nice to allow the reader to choose whether to display all chapters at once or not (e.g. for doing a search in the whole book). In term of javascript code this is easy but I'm not sure how to make it work for GUI: I don't see an easy icon which could convey the meaning "display all chapters/only one at a time", and if it's text-based it means it should probably be translated according to the lang setting, so it might need a bit more work for the rest of the code. Not sure how to do this yet. Maybe not allow the reader to change it and add an option in crowbook would be the easiest way but it's not very satisfying.
  • for multifiles rendering it would need a bit more adaptation (using xmlhttprequest, i suppose) to avoid loading all the book at once (e.g. if the book is long or contains a lot of images that can make a pretty big file).

@taophp
Copy link
Contributor

taophp commented Mar 10, 2016

your current implementation would be practical for standalone page, allowing it to give the same aspect (displaying one chapter at a time) than the multi-files html.

That was exactly my goal.

it would be nice to allow the reader to choose whether to display all chapters at once or not

It is on my todo list, but waiting your validation of the current work.

I don't see an easy icon

There is no obvious icon for that. Maybe a two states button : a book icon when on chapter will make the page display the whole text, a sheet icon when on book mode will page the page display only one chapter (but which one ?)

if it's text-based

It must also be text-based for accessibility purposes.

it means it should probably be translated according to the lang setting

Yes.

Not sure how to do this yet.

You should maintain a translation table and add languages when possible, so Crowbook will be able to handle it automatically. If the user use a language that is not currently supported, Crowbook should throw a warning suggesting the use of an option to force the text to use, and fall-back to english. The option, if set, should override the translation even if available.

for multifiles rendering

This was not my goal. I thought your current implementation for displaying multifile content was sufficient and I was not aware that you planned to propose both functionalities. However, it makes sense.
But I don't think I will use it. So, put it at the end of the todo list if you expect me to do it one day or another.

@taophp
Copy link
Contributor

taophp commented Mar 10, 2016

What I expect from you at this point : change the HTML output, and externalize the JavaScript in a dedicated file so I can improving it on my fort and pull request.

@crowdagger
Copy link
Owner Author

Made a new branch for that: https://github.com/lise-henry/crowbook/tree/newjs

Some modifications have been made, but the navigation menu doesn't work yet (needs more changes than I thought). The script can be modified either at compile time by modifying templates/script.js or at runtime by setting the html.script option.

@crowdagger
Copy link
Owner Author

Navigation menu now works

@taophp
Copy link
Contributor

taophp commented Mar 12, 2016

I'll switch to this branch and implement the "view all" feature next week I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants