pfefferniels / probstuecke-digital

A digital edition of the 24 Probstücke of the Oberclasse by Johann Mattheson.
http://probstuecke-digital.de
GNU General Public License v3.0
10 stars 1 forks source link

Word breaks #83

Closed pfefferniels closed 3 years ago

pfefferniels commented 4 years ago

I'd like to propose using <pc force="weak">-</pc> for the hyphens at line breaks (as suggested by the TEI guidelines). This could be added by a simple regex on all the TEI documents. I don't feel very good about the regex replacements by JS everytime a Probstück is loaded … This would allow us to simply hide linebreaks by CSS: tei-pc[@force='weak'] { display: none } and tei-lb { display: none }

pfefferniels commented 4 years ago

@rettinghaus do you have an opinion on this? Here hyphens at line breaks are also encoded (but using <g> instead of <pc> ...)

rettinghaus commented 4 years ago

No project has figured out a perfect solution for this. <pc> isn't mentioned in DTABf. <g> is mentioned, but strictly ruled out … And the TEI Guidelines say, that <g>

represents a glyph, or a non-standard character

Do you think, changing this would improve anything?

pfefferniels commented 4 years ago

I don't have a strong opinion on this, but those lines

  if ($('#ignore-lb').is(':checked')) {
    const lbWithHyphen = /\-(\n|\s)*<lb(\s)*\/>([a-z]|ſ)/g;
    teiComments = teiComments.replace(lbWithHyphen, '$3&#xAD;');
    keyCharacteristics = keyCharacteristics.replace(lbWithHyphen, '$3&#xAD;');
    meterCharacteristics = meterCharacteristics.replace(lbWithHyphen, '$3&#xAD;');

    await Promise.all([renderComments(), renderKeyOverlay(), renderMeterOverlay()]);
    $('tei-lb').hide();
  } else {
    const softHyphen = /\&#xAD;/g;
    teiComments = teiComments.replace(softHyphen, '-<lb/>');
    keyCharacteristics = keyCharacteristics.replace(softHyphen, '-<lb/>');
    meterCharacteristics = meterCharacteristics.replace(softHyphen, '-<lb/>');

    await Promise.all([renderComments(), renderKeyOverlay(), renderMeterOverlay()]);
    $('tei-lb').show();
  }

do not only take quite some time – each time a page gets loaded, for hiding line breaks is activated by default, but also don't function very reliably.

pfefferniels commented 3 years ago

Using now the DTAs CAB service to turn the textes into their modern forms, including hyphenation. This happens automatically before deploying. It is for sure the best way to cover all kinds of corner cases.