Author mode: working with -oxy-placeholder-content

Having trouble installing Oxygen? Got a bug to report? Post it all here.
friedemann_bach
Posts: 48
Joined: Wed Oct 22, 2014 4:11 pm

Author mode: working with -oxy-placeholder-content

Post by friedemann_bach »

Dear Forum,

I have an issue when trying to use "-oxy-placeholder-content".

Using TEI, I want to identify later and earlier stages of a historical text, by parallel markup. Here is an example:

Code: Select all


<app>
<lem wit="#w1">lived</lem>
<rdg wit="#w2">liveth</rdg>
<rdg wit="#w3">livd</rdg>
</app>
Which says that "lived" appears in two other sources as "liveth" and "livd" respectively.
This is the CSS used in the Author mode:

Code: Select all


app lem:after { content:']'; }
app rdg:before { content:' 'oxy_replace(attr(wit),'#','')': '; font-style:italic; }
It results in:

lived] w2 liveth w3 livd

Which fits quite nice to the purpose.

Now, imagine another source in which the word "lived" does not appear at all. It had to be marked up like that:

Code: Select all


<app>
<lem wit="#w1">lived</lem>
<rdg wit="#w2">liveth</rdg>
<rdg wit="#w3">livd</rdg>
<rdg wit="#w4"/>
</app>
And I want it to be rendered like that:

lived] w2 liveth w3 livd w4

I tried adding this line to my CSS:

text body app rdg { -oxy-placeholder-content:attr(wit)' ∅ '; }

But it does not seem to work when :before { content:'...' } is in used on the same class.
Furthermore, when omitting the rdg:before styles, it will display only the first expression, attr(wit), but not the following string, ' ∅ '.

Is there a fix or a workaround to achieve this? I would appreciate this very much.
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Author mode: working with -oxy-placeholder-content

Post by alex_jitianu »

Hello,
But it does not seem to work when :before { content:'...' } is in used on the same class.
This is actually the intended behavior. If a :before exists we don't present the placeholder anymore. A solution to your problem is to use the :empty pseudo class instead:

Code: Select all


app rdg:before { content:' 'oxy_replace(attr(wit),'#','')': '; font-style:italic; }
app rdg:empty:before { content:attr(wit)' ∅ '; }
Furthermore, when omitting the rdg:before styles, it will display only the first expression, attr(wit), but not the following string, ' ∅ '.
Yes. It's probably something we've missed but an workaround is to use the oxy_concat() CSS function:

Code: Select all

-oxy-placeholder-content:oxy_concat(attr(wit), ' ∅ ');
Best regards,
Alex
friedemann_bach
Posts: 48
Joined: Wed Oct 22, 2014 4:11 pm

Re: Author mode: working with -oxy-placeholder-content

Post by friedemann_bach »

Thanks a lot - I was not aware of the :empty pseudo class. This works great!
The concat() solution is a nice workaround for this situation, too.
Post Reply