daisy / pipeline-mod-braille

!! NOTE: This project is now part of the pipeline-modules project !! | Braille Production Modules for the DAISY Pipeline 2
1 stars 3 forks source link

Support specifying default braille translator in CSS #191

Closed bertfrees closed 4 years ago

bertfrees commented 4 years ago

In general, specifying details about the translation in CSS is not such a great idea. Braille translation is typically something that the user may wish to control. It's up to the application to apply the correct translation, based on the locale and on user preferences.

However in certain cases it might actually make sense to specify translation details in CSS, or at least a default that can be overwritten. For example, it would be perfectly acceptable that a CSS style sheet says that the text should by default be transcribed with a certain contraction grade:

@text-transform {
    system: braille-translator;
    contraction: full;
}

Specifying a translator that is specific to the DAISY Pipeline implementation is not advisable because it makes the CSS not portable. But even for this there might be use cases. For example, if for some reason you need to include a Liblouis table inside an EPUB, you could use this CSS:

@text-transform {
    system: braille-translator;
    liblouis-table: url('relative/path/to/my/table.tbl');
}

For total flexibility it should also be possible to use system: braille-translator in named @text-transform rules. Note that named @text-transform rules are already supported in Pipeline (although none of the default translators do anything with it, and it's not in the braille CSS spec yet). Global @text-transform rules like in the examples above are something new. They correspond to text-transform: auto.

Below is an example of using system: braille-translator in a named @text-transform rule:

@text-transform uncontracted {
    system: braille-translator;
    contraction: no;
}

.foo {
    text-transform: uncontracted;
}

Note that this specific rule is already implicitly defined today (implemented here)!

bertfrees commented 4 years ago

For total flexibility it should also be possible to use system: braille-translator in named @text-transform rules.

This has been implemented in https://github.com/daisy/pipeline-modules/commit/210d49d3b9d8c05aea7f5e3adbeb2f9e76bed0e7.

bertfrees commented 4 years ago

Remaining part fixed in https://github.com/daisy/pipeline-modules/commit/4c46c85f2c3d2818c29c1598595dad8434198e84.