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

Handle precedingseparator with CSS #30

Closed
bertfrees opened this issue Jun 30, 2016 · 7 comments
Closed

Handle precedingseparator with CSS #30

bertfrees opened this issue Jun 30, 2016 · 7 comments

Comments

@bertfrees
Copy link
Contributor

bertfrees commented Jun 30, 2016

Currently it is handled with XSLT: see handle-precedingseparator.xsl. In order to handle this in CSS a new CSS feature would be needed, e.g. an ::outside pseudo-element.

@bertfrees
Copy link
Contributor Author

bertfrees commented Jul 26, 2016

@bertfrees bertfrees added the S label Jul 26, 2016
@bertfrees bertfrees added this to the 2016/Q4 milestone Jul 26, 2016
@bertfrees
Copy link
Contributor Author

bertfrees commented Nov 2, 2016

I've chosen an easier solution which does not require any new CSS features:

p.precedingseparator {
    $separator-width: 6;
    text-indent: 0;
    &::before {
        content: "\A"                                              /* empty line */
                 repeat("\A0", ($page-width - $separator-width)/2) /* centering */
                 repeat("⠒", $separator-width) "\A"                /* separator */
                 "\A"                                              /* empty line */
                 "\A0 ";                                           /* text indent */
        white-space: pre-line;
        text-transform: none;
        hyphens: initial;
    }
}

Note that this only works for positive text-indents.

The "::outside pseudo-element" path can be explored later but for now I don't really see a good reason to go there. Maybe when some more use cases appear.

bertfrees added a commit to sbsdev/pipeline that referenced this issue Nov 2, 2016
@bertfrees
Copy link
Contributor Author

bertfrees commented Dec 15, 2016

Moved upstream: daisy/pipeline-mod-braille@cb448df

@mixa72
Copy link

mixa72 commented Jan 30, 2017

It appears that I can't combine: class="precedingseparator noindent"

Is it possible to add a rule for the combination?

p.precedingseparator.noindent {
    $separator-width: 6;
    text-indent: 0;
    &::before {
        content: "\A"                                            /* empty line */
                 repeat(" ", ($page-width - $separator-width)/2) /* centering */
                 repeat("⠒", $separator-width) "\A"              /* separator */
                 "\A";                                            /* empty line */
        white-space: pre-line;
        text-transform: none;
        hyphens: initial;
    }
}

does not work though.

bertfrees added a commit that referenced this issue Jul 31, 2017
@mixa72 mixa72 added prio:1 and removed prio:2 labels Jan 4, 2018
@egli
Copy link
Member

egli commented Feb 19, 2018

Whether or not this is implemented in css or xslt doesn't really matter. What is important is that the user

  1. can combine the precedingseparator class attribute with other class attributes like noindent or even brl:class
  2. can define the separator (would be nice if this could be defined in css)

@bertfrees
Copy link
Contributor Author

OK. The current solution is really the worst. It's a ugly workaround, it's not simpler than the XSLT solution and it can't make the corner cases work. So let's go back to the XSLT solution and make everything work, and then we can see if a real CSS is needed to make it configurable enough.

@bertfrees
Copy link
Contributor Author

bertfrees commented Jul 10, 2018

Defining the separator could be done in CSS if we handle it like in EPUB, namely by converting a <p class="precedingseparator"> into a <hr class="separator"/> followed by a normal <p> (with XSLT) and then apply this CSS:

$separator-width: 6;

hr.separator {
    display: block;
    text-align: center;
    margin: 1 0;
    &::before {
        content: repeat("⠒", $separator-width);
        text-transform: none;
        hyphens: initial;
    }
}

I don't think an hr is valid DTBook so maybe I'll use a div.

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

3 participants