-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Update epub.css #7109
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
base: main
Are you sure you want to change the base?
Update epub.css #7109
Conversation
Correct "title" to "main" and add missing items (subtitle, publisher, and rights). Explanatory comments.
/* For title, author, and date on the cover page */ | ||
h1.title { } | ||
/* For (sub)title, author, date, and publisher on the cover page */ | ||
h1.main { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the default template you'll see it has
$for(title)$
$if(title.text)$
<h1 class="$title.type$">$title.text$</h1>
$else$
<h1 class="title">$title$</h1>
$endif$
$endfor$
Thus, if they use a structured title (e.g. title { text = ___, type = ___ }
) then "main" will be used (or maybe something else, depending on the value of "type"). If they just specify title
as an unstructured field, title
will be used.
Perhaps we could improve this by changing the first case to
<h1 class="title $title.type$">$title.text$</h1>
so that the title
class is consistently applied.
Anyway, I'd suggest we make that change to the template, but also leave out main
from the default template.
(I'm actually not quite sure what motivated these structured titles -- would need to dig through git history.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw there was something going on in the template - which I don't really understand - but I'm going by what I get in the output epub3 document (title_page.xhtml) when I have "title" in my yaml:
<section epub:type="titlepage" class="titlepage">
<h1 class="main">My Title</h1>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must have a structured object for title
in your YAML metadata, then.
---
title:
type: main
text: My Title
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, I do. I was just copying the example in the Guide. If I switch to an unstructured title in yaml, I do indeed get h1 with a class of title (and if I keep subtitle in on its own, it gets a p).
Given that the Guide example gives an h1 with class main and that it does no harm being in the css if not used, would a solution be to have both main and title in there for h1, perhaps with a comment? I'm thinking of this css file as more of a template for the user to customize, so the comments are helpful.
For subtitle, it seems to go either with p or h1, depending on whether so just having it work for either would seem to be a solution:
p.subtitle, h1.subtitle { }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to have h1.main
, then shouldn't we also have h1.subtitle
, p.ROLE
for various possible creator roles, et.c?
Correct "title" to "main" and add missing items (subtitle, publisher, and rights). Explanatory comments.