Another "Is this expected behaviour?"

CSS XPP 9.4.1

I have an interesting issue - the XML I have been supplied with has "xxx</close><open>Zzz". The requirement (apart from changing typeface etc) is to add a period and a space so I end up with:

xxx</close>. <open>Zzz

I am generating the period and space in the close::after pseudo-element selector and most of the time it is working perfectly. However if the last word before the </close> is a very long word (and its in 2 columns to a short measure) then the last word will not hyphenate. If I only generate the period and add space manually, either before or after the <open> element then the long word hyphenates perfectly and as expected. However is does act as you would expect if the justification means finishing a line! Interestingly if I remove the space altogether the word xxx.Zzz will hyphenate.

One option would be to transform and add the space but I am very nervous about that is this could cause issues if the XML is inconsistent.

Interested to hear if anyone else has encountered a similar issue.

Chris

Parents
  • So, possibly I've got an alternative for you than having to do a (complicated) transform.

    Not sure it's better or easier or will really work (no guarantees), but maybe. It does involve doing more complicated things in the CSS.

    It's really the generated space that's the crux of the challenge, because a space is always an implied word end and if the space is generated then you are attaching "generated text" to the end of a word (and thus it won't hyphenate because of the limitation).

    I tried another approach, where I separated the handling of the generated period from the generated space and attempted to account for (and use) all the intricacies of the handling of spaces, and using your sample mocked up something that appears to work.

    In the data stream, I just have ...</test1><test2>… (i.e. nothing added at all to the actual data stream).

    I added this macro definition (name it as you want):
    Macro name: testspace
    Expansion: <mc;%lnwidth]0;nul;skp><mh;0>

    And in the CSS I have this:
    test1::after {
        content: ".";
    }
    test2::before {
        content: -xpp-macro(testspace) " ";
    }
    test2 {
        display: -xpp-word;
    ...
    }

    What I found was that the -xpp-word needed to be in the <test2> element; trying to do the end word with '!' at the beginning of the <testspace> macro expansion did not work.

    And, I am using the magic <mh;0> as well.

    When I compose the sample as provided, the word "understandably" does hyphenate and it's followed by a period and a "space".

    When I remove the word "times" that appears a few words before "understandably" and compose, the word "understandably" followed by a period falls at the end of the line and the word "presented" falls at the beginning of the next line (w/o any "space" before it).

    Only potential "problem" I see is that while in the xyview if I was doing a Search with Codes/Tags set to "ignore" then Search would see "understandably.presented" as the data sequence. Maybe not worth worrying about since in the original data stream if you were ignoring tags you would see "understandablypresented" anyway.

    I'm imagining that you'll be able to figure out what I'm doing (and why), as far as the <mc> and <mh;0>, but if you want me to explain further just ask.

    If you look at it all as doing this sequence then it probably is easier to understand it: "... understandably</test1>.(-xpp-word from <test2>)<mc;%lnwidth]0;nul;skp><mh;0>(generated space)<test2>presented ..."

    Jonathan Dagresta
    SDL XPP Engineering

    Jonathan Dagresta
    RWS Group/
    XPP Development

  • Initial testing look good - thanks Jonathan - will look more carefully in the morning.

Reply Children