-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Discussion] Book representation #146
Comments
This is a good start! Based on books I produced in the past, I'd recommend to extend this a bit to recognize other common features of a book's structure. See the structure of the Table of Contents in the EPUB and PDF of these books for example, to get an idea of some more challenging structures. I'd like to be able to reproduce these with In
The frontmatter is typically a handful of chapters (Preface, Introduction, Editor's Note), which are not numbered when rendering. The backmatter is also often more than one un-numbered chapters (Glossary, Appendix, Copyright). Sometimes there are more than one Appendix chapters, but in that case I think it is enough to number it manually in the title, passing "Appendix A", "Appendix B". For
"Chapter 19", "Chapter XIX" or "Chapter Nineteen" are what I had to use before. So that you can open a chapter with:
I suppose this might be a method on The
I know what's below looks overkill at first, but it really helps to anticipate managing the details. Ideally these can be loaded from Say, when one has to update an ISBN number, one really doesn't want to track down manually (or w/ grep) how many files have to be updated, just update This is just to indicate what information has to be handled in a book. I didn't give much thought to what is
Ebook subjects come from the BISAC Subject Headings List. |
Thanks for your post, it's very helpful and contains interesting ideas I would like to explore further! :)
I like that, it's more generic and corresponds to the latex naming.
Having an author per chapter is interesting, but I have a hard time figuring out how / where all this metadata will be provided by the user.
There is one important design goal I would like to adhere to: mdBook should be as easy to use as possible when you don't require more "advanced" features. By that, I mean that the option to have one author per chapter should not complicate the simple case where a book has only one author.
Index would be the field containing the chapter number? How would you handle nested chapters? (e.g. Regarding the |
Absolutely agree with the simple as possible principle. I'd love to see the minimum effort to be:
And it would build an HTML page, epub and mobi, and a PDF out of that (if LaTeX is installed). But then there are the books that have all the detail and effort of a full-on publication. I find that these need a lot of custom input and tweaks for each book, but nonetheless they are finite and possible to anticipate. Author and other chapter-specific metadata is easiest to provide either in the
So these struct would provide containers for whatever field is useful for these specific targets. Ebooks for example need a unique identifier in the metadata such as a |
I see! I forgot to write down some of my thoughts about how the renderers (and their settings) should work. I've update #149 to detail this a little more. I think it should clarify why I think |
Looking back, it seems this will be an API design concern, and what I was asking really is to be able to store different variables for the ebook and paperback (i.e. LaTeX), and access them in the page templates (maybe that will be through the renderer?). For an ebook, the renderer would generate new ebook files every time. I found that with LaTeX this is not practicable. The best was to just generate the LaTeX once and then work on those files directly for the publication, and not call the LaTeX generator again. These files would be committed. So generating the LaTeX is more similar to getting a book template started (creating a file an folder structure for the user to edit). |
How would a simple integer index hanle sub-chapters? Or should this index be relative to the next parent chapter?
That's something for the YAML/TOML/Whatever Summary Issue, I think. With such a thing you can easily add metadata to chapters and define rules on how to derive default values, e.g. by inspecting parent chapters. |
@Evrey I think what I had in mind with the chapter Anyway, it's a bit speculative until the overall renderer and representation is settled. |
I believe a lot of the issues here around metadata is solved when the configuration system was updated to be more flexible (#457), so it's not difficult to add your own Regarding the underlying structure used to represent a book, I'd prefer to keep that as backend/language agnostic as possible.For example, it doesn't really make sense to embed ISBN metadata as part of the
Regarding multi-language support, I think by far the easiest way would be to just have a different book for each language under the same repository (e.g. have a |
Currently, the internal representation is very uni-language focused. We have one struct
MDBook
containing all the information and the chapters for the book.To support multiple languages we have to store multiple books with different metadata. There should be one default language, the rest are assumed to be translations.
I propose that
MDBook
holds a hashmap with language codes like"en"
or"fr"
as keys andBook
s as values.The
Book
structure would be defined as follows:Chapter
would beAnd
BookMetadata
would beAnd finally
Author
andLanguage
would beThis is what PR #147 implements. (not merged)
It allows to represent multiple languages, each with different book structures, authors / translators etc.
Open questions
Store the key (language code) for the default language in
MDBook
?The text was updated successfully, but these errors were encountered: