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

Web UI handling of em and strong #217

Open
KariRudjord opened this issue Feb 12, 2019 · 10 comments
Open

Web UI handling of em and strong #217

KariRudjord opened this issue Feb 12, 2019 · 10 comments
Assignees

Comments

@KariRudjord
Copy link

I would like an option that leave out strong i a production and an option that leave out em in production. E.g. under Tekstelementer. Nice to use in cooking books who always have a lot of em and strong that is only related to layout.

@josteinaj
Copy link
Member

So two separate options? One to leave out <em> and one to leave out <strong>?

For books that don't have <em>, only <strong>, we currently treat the <strong> tags as if they were <em>. If we use the options to say that we want to leave out <em> but keep <strong>, what should happen for such books? Should we remove the <strong> tags in that case? If not, should they be treated as if they were <em> tags, even though the option to leave out <em> tags are enabled?

@bertfrees
Copy link
Collaborator

If we reconsider implementing emphasis in Liblouis instead of XSLT (nlbdev/pipeline-mod-nlb#20), the toggling could be easily implemented in CSS. It's also easily implemented in XSLT of course, but the less XSLT code the better I think.

@josteinaj
Copy link
Member

We'd be fine with using liblouis. Controlling it with CSS would be great. I think the issue was the ordering of the open- and close "tags" in braille. <em><strong>…</strong></em> vs <strong><em>…</em></strong> vs <em><strong>…</em></strong> vs <strong><em>…</strong></em>, which could not be controlled in liblouis.

@bertfrees
Copy link
Collaborator

Ah yes, indeed, this can not be controlled at the moment.

@KariRudjord
Copy link
Author

KariRudjord commented Feb 13, 2019

Two separate options, yes. And if we leave out em in a production, still treat strong as em.

I don't know how much we will use the option, but then we can controle every situation without editing the source file (which can be quite a job).

@bertfrees
Copy link
Collaborator

I need a name/description of the options (Norwegian).

@bertfrees
Copy link
Collaborator

I have made the text formatting fully configurable in CSS. For now there is no option yet but it's very easy to add. The CSS now looks like this:

/* -------------------------------------------------------------------------- */
/*                Text formatting                                             */
/* -------------------------------------------------------------------------- */

@text-transform strong {
    system: -nlb-indicators;
    open: "⠠⠄";
    close: "⠠⠄";
}

@text-transform em {
    system: -nlb-indicators;
    open: "";
    close: "";
}

@text-transform u {
    system: -nlb-indicators;
    open: "";
    close: "";
}

@text-transform strike {
    system: -nlb-indicators;
    open: "⠐⠂";
    close: "⠐⠂";
}

strong, b {
    text-transform: strong;
    :root:not(:has(em, i)) & {
        text-transform: em;
    }
}

em, i {
    text-transform: em;
}

u {
    text-transform: u;
}

strike, s {
    text-transform: strike;
}

sub {
    text-transform: -louis-emph-4;
}

sup {
    text-transform: -louis-emph-5;
}

As you can see there are now the text-transform values strong, em, u and strike, and they are declared with @text-transform rules. The @text-transform rule is something I was already using for SBS.

The @text-transform rules are interpreted in the block-translate.xsl file.

When we are ready to handle emphasis in Liblouis, we only need a very small modification in the CSS, namely text-transform: strong needs to become text-transform: -louis-emph-1, etc.

@KariRudjord
Copy link
Author

KariRudjord commented Apr 5, 2019

Name of options:
First option em:
Inkluder em.
Når boksen er tom, blir em utelatt fra produksjonen.

Second option strong:
Inkluder strong.
Når boksen er tom, vil strong bli utelatt fra produksjonen.

Description: For both options (don't need to be numbered in GUI) there will be a cheked box as standard, and if you uncheck the box, the em (or strong) will be left out of the production.

I think the right place to put these options is under "Tekstelementer".

@bertfrees
Copy link
Collaborator

Updated the CSS to the following. Hope I got it right.

@if ($include-strong) {
    strong, b {
        @if ($include-em) {
            text-transform: strong;
            :root:not(:has(em, i)) & {
                text-transform: em;
            }
        } @else {
            text-transform: em;
        }
    }
}

@if ($include-em) {
    em, i {
        text-transform: em;
    }
}

@KariRudjord
Copy link
Author

The option works, but the two are mixed up. When you choose to leave out em, strong is left out and vice versa. When you choose to leave out strong, em is left out.

The braille representation for the highlighting is wrong in the test versjon of PIP (should be em: 23 before and 56 after and strong: 6-3 before and 6-3 after). This is correct in production-PIP.

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

4 participants