Re: Con(key)reffing terms: uppercase - lowercase


Nicholas Mucks
 

Hi Yves,
We added custom processing on keyword, term, and abbreviated-form that transforms the first letter to uppercase if the writer sets outputclass = cap_first_letter.

We decided to the let the writer decide instead of doing this automatically because all the edge cases would make processing more complex. It also means they can use the same keyreffed element but control the output depending on where the element exists in context.

Take care,
- Nick

Sent from mobile

On Oct 17, 2020, at 8:21 AM, Jarno Elovirta <jelovirt@...> wrote:


Hi,

I've written a DITA-OT implementation for a customer where if you had markup such as

<p><keyword keyref="color-def"/> blaa blaa <keyword keyref="color-def"/>. <keyword keyref="color-def"/> blaa.</p>

When the keyrefs were processed, got transformed into something like

<p><keyword><?keyref?>color definitions</keyword> blaa blaa <keyword><?keyref?>color definitions</keyword>. <keyword><?keyref?>color definitions</keyword> blaa.</p>

So processing instruction keyref is used to mark that something comes from a keyref. Then, another step goes through all those processing instructions and tries to guess if the first character of the keyref content should be uppercased. The rules were simple,
  • Is this the first character in a block element
  • is this character preceded by one or more whitespace characters and a period, exclamation mark or question mark.
This would result in

<p><keyword><?keyref?>Color definitions</keyword> blaa blaa<keyword><?keyref?>color definitions</keyword>. <keyword><?keyref?>Color definitions</keyword> blaa.</p>

This worked well enough, but you could add more complex rules using this same approach.

So you can solve this problem at processing side.

Jarno

On Wed, 19 Aug 2020 at 15:46, Yves Barbion <yves.barbion@...> wrote:
Hi group

Suppose you wish to reuse a term, for example the term "color definitions". This term can, of course, occur anywhere in a sentence, so also at the beginning, where it needs to start with a capital.

What's the best practice in this case? Having the term twice in the "warehouse topic": once with uppercase "C" and once with lowercase?

Or are there any better solutions?

Thanks

Yves

Join main@dita-users.groups.io to automatically receive all group messages.